1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-02-07 05:30:44 +00:00

instrument: Add MeasurementType for time_us

Add time_us MeasurementType for time expressed in microseconds and
define conversions to/form time. This is a very common unit for low-level
operations, and it may be desirable to avoid converting large number of
metrics to floats in order to report as a "standard" type.
This commit is contained in:
Sergei Trofimov 2017-06-06 14:17:03 +01:00
parent df81742100
commit 871c59a3f4

View File

@ -72,7 +72,16 @@ class MeasurementType(object):
# Standard measures
_measurement_types = [
MeasurementType('time', 'seconds'),
MeasurementType('time', 'seconds',
conversions={
'time_us': lambda x: x * 1000,
}
),
MeasurementType('time_us', 'microseconds',
conversions={
'time': lambda x: x / 1000,
}
),
MeasurementType('temperature', 'degrees'),
MeasurementType('power', 'watts', 'power/energy'),
@ -83,6 +92,8 @@ _measurement_types = [
MeasurementType('tx', 'bytes', 'data transfer'),
MeasurementType('rx', 'bytes', 'data transfer'),
MeasurementType('tx/rx', 'bytes', 'data transfer'),
MeasurementType('frames', 'frames', 'ui render'),
]
for m in _measurement_types:
MEASUREMENT_TYPES[m.name] = m