mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-10-31 14:01:20 +00: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:
		| @@ -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, | ||||||
|         } |         } | ||||||
|     ), |     ), | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user