Add rt-app calibration logging
Test the calibration using a script like that:
Can be invoked using e.g.
python3 testcalib.py --conf target_conf.yml
See --help
for more ways of specifying the target.
#! /usr/bin/env python3
import itertools
from pathlib import Path
import datetime
import tempfile
import json
from lisa.target import Target
from lisa.wlgen.rta import RTA
from lisa.trace import FtraceCollector
base = Path('rtapp_calibration_logs')
base.mkdir(parents=True, exist_ok=True)
events = ['sched_switch', 'sched_wakeup', 'sched_wakeup_new', 'sched_waking', 'sched_pelt_se', 'sched_pelt_cfs']
target = Target.from_cli()
def calibrate(i):
prefix = f'#{i}-{datetime.datetime.now()}-'
res_dir = Path(tempfile.mkdtemp(dir=base, prefix=prefix))
trace_path = res_dir / 'trace.dat'
coll = FtraceCollector(target=target, output_path=trace_path, events=events)
with coll:
calib = RTA.get_cpu_calibrations(target, res_dir=res_dir)
with open(res_dir / 'calib.json', 'w') as f:
json.dump(calib, f)
return calib
def main():
for i in itertools.count():
print('#'*80 + '\n')
print(f'Starting calibration #{i}')
calib = calibrate(i)
pretty = ", ".join(f'{cpu}={calib}' for cpu, calib in sorted(calib.items()))
print(f'Finished calibration #{i}: {pretty}')
print('\n\n')
main()