-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared.py
More file actions
63 lines (44 loc) · 1.28 KB
/
shared.py
File metadata and controls
63 lines (44 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from enum import IntEnum
class TestMode(IntEnum):
NONE = 0
LATENCY = 1
ACCURACY = 2
class ClientStatus(IntEnum):
NONE = 0
STARTED = 1
READY_FOR_MODEL = 2
READY_FOR_CHUNK = 3
READY_FOR_INPUT = 4
READY_FOR_TASK = 5
DONE = 6
class Command(IntEnum):
NONE = 0
START_LATENCY_TEST = 1
STOP = 2
RESET = 3
class Topic:
def __init__(self, device_id):
self.device_id = device_id
def CONFIG_ITERATIONS(self):
return f"bench/{self.device_id}/config/iterations"
def CONFIG_MODE(self):
return f"bench/{self.device_id}/config/mode"
def MODEL(self):
return f"bench/{self.device_id}/model"
def INPUT_LATENCY(self):
return f"bench/{self.device_id}/input/latency"
def INPUT_ACCURACY(self):
return f"bench/{self.device_id}/input/accuracy"
def CMD(self):
return f"bench/{self.device_id}/cmd"
def STATUS(self):
return f"bench/{self.device_id}/status"
def RESULT_LATENCY(self):
return f"bench/{self.device_id}/result/latency"
def RESULT_ACCURACY(self):
return f"bench/{self.device_id}/result/accuracy"
class Logger:
def __init__(self, name):
self.name = name
def log(self, message):
print(f"[{self.name}] {message}")