koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame^] | 1 | from typing import Union, Dict, List, Any, Tuple |
| 2 | |
| 3 | # Stores test result for integral value, which |
| 4 | # can be expressed as a single value for given time period, |
| 5 | # like IO, BW, etc. |
| 6 | TimeSeriesIntegral = List[float] |
| 7 | |
| 8 | |
| 9 | # Stores test result for value, which |
| 10 | # requires distribution to be stored for any time period, |
| 11 | # like latency. |
| 12 | TimeSeriesHistogram = List[List[float]] |
| 13 | |
| 14 | |
| 15 | TimeSeries = Union[TimeSeriesIntegral, TimeSeriesHistogram] |
| 16 | RawTestResults = Dict[str, TimeSeries] |
| 17 | |
| 18 | |
| 19 | class SensorInfo: |
| 20 | """Holds information from a single sensor from a single node""" |
| 21 | node_id = None # type: str |
| 22 | source_id = None # type: str |
| 23 | sensor_name = None # type: str |
| 24 | begin_time = None # type: int |
| 25 | end_time = None # type: int |
| 26 | data = None # type: TimeSeries |
| 27 | |
| 28 | def __init__(self, node_id: str, source_id: str, sensor_name: str) -> None: |
| 29 | self.node_id = node_id |
| 30 | self.source_id = source_id |
| 31 | self.sensor_name = sensor_name |
| 32 | |
| 33 | |
| 34 | class TestInfo: |
| 35 | """Contains done test information""" |
| 36 | name = None # type: str |
| 37 | iteration_name = None # type: str |
| 38 | nodes = None # type: List[str] |
| 39 | start_time = None # type: int |
| 40 | stop_time = None # type: int |
| 41 | params = None # type: Dict[str, Any] |
| 42 | config = None # type: str |
| 43 | node_ids = None # type: List[str] |
| 44 | |
| 45 | |
| 46 | class FullTestResult: |
| 47 | test_info = None # type: TestInfo |
| 48 | |
| 49 | # TODO(koder): array.array or numpy.array? |
| 50 | # {(node_id, perf_metrics_name): values} |
| 51 | performance_data = None # type: Dict[Tuple[str, str], TimeSeries] |
| 52 | |
| 53 | # {(node_id, perf_metrics_name): values} |
| 54 | sensors_data = None # type: Dict[Tuple[str, str, str], SensorInfo] |