10 lines
774 B
Python
10 lines
774 B
Python
import importlib.util
|
|
from pathlib import Path
|
|
spec=importlib.util.spec_from_file_location('evidence',Path(__file__).resolve().parents[1]/'scripts/realm-evidence.py')
|
|
m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
|
|
p=m.normalize_performance({'generatedAt':10,'enabled':True,'fullTickCount':2,'fullTickTotalTime':4000,'metrics':[{'type':'action','rows':[{'name':'move','count':2,'totalTime':3000,'avgTime':1500,'maxTime':2000,'timePerTick':1500}]}]})
|
|
assert p['averageTickMs']==2 and p['rows'][0]['averageMs']==1.5
|
|
assert m.normalize_performance({'fullTickCount':0})['averageTickMs']==0
|
|
assert m.normalize_performance({'fullTickTotalTime':float('nan')})['averageTickMs']==0
|
|
print('Native profiler microsecond conversion and malformed measurements passed')
|