-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench_common.py
72 lines (52 loc) · 1.98 KB
/
bench_common.py
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
64
65
66
67
68
69
70
71
72
import matplotlib.pyplot as plt
import numpy as np
def time_between(log, fr, to):
if fr not in log or to not in log:
return None
return log[to] - log[fr]
def clean_none_keys(d):
to_del = set()
for k in d.keys():
if d[k] is None:
to_del.add(k)
for k in to_del:
del d[k]
def get_info(log, required_keys):
machines = list(log["meta"].keys())
for machine in machines:
assert(log["meta"][machine]["param_num_pages"]["value"] == \
log["meta"][machines[0]]["param_num_pages"]["value"])
info = {}
info["param_num_pages"] = int(log["meta"][machines[0]]["param_num_pages"]["value"])
by_name = {}
for op in log["time_series"]["operation"]:
assert(op["value"] in "finished time calibration" or
op["value"] not in by_name)
by_name[op["value"]] = op["nanos"]
info["Prefill duration"] = time_between(by_name,
"start: init_migration", "finish: prefill writes")
info["Duration without owner"] = time_between(by_name,
"transfer ownership to destination", "done wait: receive ownership")
info["Time spent transferring dirty pages"] = time_between(by_name,
"start: setting page protections", "finish: reading dirty pages")
info["End to end latency"] = time_between(by_name, "start: init_migration",
"received: final confirmation from the destination")
# info["Time to send the object"] = time_between(by_name,
# "start: check_bandwidth", "finish: check_bandwidth")
want_keys = set(required_keys)
del_keys = set()
for k in info.keys():
if not k.startswith("param_") and k not in want_keys:
del_keys.add(k)
for k in del_keys:
del info[k]
clean_none_keys(info)
return info
def remove_zero(ax):
ticks = ax.get_xticks()
for i, x in enumerate(ticks):
if abs(x) < 1e-9:
ticks[i] = 1.0
break
ticks = ticks[1:-1]
ax.set_xticks(ticks)