Async wlgen API
Add an async wlgen API as an alternative to the phase tree
import operator
import functools
from lisa.platforms.platinfo import PlatformInfo
from lisa.wlgen.rta import RTAPhase, RTAConf, PeriodicWload, SleepWload
from lisa.wlgen.rta import Properties, task_factory
@task_factory
async def make_task(x):
await PeriodicWload(duty_cycle_pct=10, period=16e-3, duration=1)
async with Properties(uclamp=(1,10)):
await SleepWload(duration=2)
await PeriodicWload(duty_cycle_pct=20, period=1, duration=3)
await PeriodicWload(duty_cycle_pct=30, period=1, duration=3)
def main():
from lisa.utils import setup_logging
import logging
setup_logging()
plat_info = PlatformInfo.from_yaml_map('./doc/traces/plat_info.yml')
# Returns a factory
_phase = make_task(10)
# Run the factory, provided some initial state parameters
# for lisa.fuzz.Gen that is integrated with @task_factory
phase = _phase(seed=42)
print(phase)
profile = {
'task1': phase,
}
conf = RTAConf.from_profile(profile, plat_info=plat_info)
print(conf.json)
main()