1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 10:50:51 +01:00

instrument/measurment_types: Add nanoseconds

Add a 'nanosecond' measurement type and the appropriate conversions.
Also update notion of existing conversions to make things clearer.
This commit is contained in:
Marc Bonnici 2019-01-09 13:27:07 +00:00
parent aabb74c8cb
commit c13e3c260b

View File

@ -97,20 +97,30 @@ _measurement_types = [
# covert without being familar with individual instruments. # covert without being familar with individual instruments.
MeasurementType('time', 'seconds', 'time', MeasurementType('time', 'seconds', 'time',
conversions={ conversions={
'time_us': lambda x: x * 1000000, 'time_us': lambda x: x * 1e6,
'time_ms': lambda x: x * 1000, 'time_ms': lambda x: x * 1e3,
'time_ns': lambda x: x * 1e9,
} }
), ),
MeasurementType('time_us', 'microseconds', 'time', MeasurementType('time_us', 'microseconds', 'time',
conversions={ conversions={
'time': lambda x: x / 1000000, 'time': lambda x: x / 1e6,
'time_ms': lambda x: x / 1000, 'time_ms': lambda x: x / 1e3,
'time_ns': lambda x: x * 1e3,
} }
), ),
MeasurementType('time_ms', 'milliseconds', 'time', MeasurementType('time_ms', 'milliseconds', 'time',
conversions={ conversions={
'time': lambda x: x / 1000, 'time': lambda x: x / 1e3,
'time_us': lambda x: x * 1000, 'time_us': lambda x: x * 1e3,
'time_ns': lambda x: x * 1e6,
}
),
MeasurementType('time_ns', 'nanoseconds', 'time',
conversions={
'time': lambda x: x / 1e9,
'time_ms': lambda x: x / 1e6,
'time_us': lambda x: x / 1e3,
} }
), ),