-
Notifications
You must be signed in to change notification settings - Fork 5
/
lat_kiops_plot.py
200 lines (184 loc) · 5.81 KB
/
lat_kiops_plot.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
import os, sys
parent_dir = os.path.abspath('..')
if parent_dir not in sys.path:
sys.path.append(parent_dir)
from bench_utils import *
from plot_utils import *
from typing import List
import argparse
ALLOWED_QDS = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
class LatencyThroughputPlot(GenericPlot):
def plot_line(self, subplotdefinition, kiops, lats, qds):
plt.plot(
kiops,
lats,
linewidth=3,
label=subplotdefinition.label,
color=subplotdefinition.color,
)
for i in range(len(kiops)):
plt.plot(kiops[i], lats[i], "o", color=subplotdefinition.color)
plt.text(
kiops[i] * (1.01), lats[i] * (1.01), s="qd=" + str(qds[i]), fontsize=9
)
@dataclass
class LatKIOPSSpec:
"""A specification for the data lat_kiops needs"""
kiops: List[int]
lats: List[int]
plot_color: str
def plot_lot_kiops(
filename: str,
title: str,
labels: List[str],
models: List[str],
lbafs: List[str],
operations: List[str],
engines: List[str],
concurrent_zones: List[int],
block_sizes: List[int],
queue_depth_limit: int,
lower_limit_y: int,
upper_limit_y: int,
lower_limit_x: int,
upper_limit_x: int,
prep_function_x: str,
prep_function_y: str,
):
# Plot
colors = ["cyan", "magenta", "green", "red", "orange", "black", "gray", "yellow"]
pick_color = iter(colors)
qds = [qd for qd in ALLOWED_QDS if qd < queue_depth_limit]
merged_dat = zip(
labels, models, engines, lbafs, operations, concurrent_zones, block_sizes
)
plot_data = {}
for (
label,
model,
engine,
lbaf,
operation,
concurrent_zone,
block_size,
) in merged_dat:
plot_data[label] = LatKIOPSSpec([], [], next(pick_color))
for qd in qds:
print(
f"Adding to plot: label={label}, model={model}, engine={engine}, lbaf={lbaf}, op={operation}, zones={concurrent_zone}, qd={qd}, block_size={block_size}"
)
fio_dat = parse_fio_file(
BenchPath(
string_to_io_engine(engine),
model,
lbaf,
operation,
concurrent_zone,
qd,
block_size,
)
)
plot_data[label].kiops.append(
prep_function(prep_function_x, fio_dat.iops_mean)
)
plot_data[label].lats.append(
prep_function(prep_function_y, fio_dat.lat_mean)
)
plot = LatencyThroughputPlot(
PlotDefinition(
get_plot_path(filename),
title,
"Througput (KIOPS)",
"Latency (micros)",
lower_limit_y,
upper_limit_y,
lower_limit_x,
upper_limit_x,
)
)
for label in labels:
lat_kiops = plot_data[label]
plot.plot_line(
SubplotDefinition(label, lat_kiops.plot_color),
lat_kiops.kiops,
lat_kiops.lats,
qds,
)
plot.save_to_disk()
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Plot latency and throughput of NVMe SSDs in one graph"
)
parser.add_argument("-t", "--title", type=str, required=True)
parser.add_argument("-l", "--labels", type=str, nargs="+", required=True)
parser.add_argument("-m", "--models", type=str, nargs="+", required=True)
parser.add_argument("-f", "--lbafs", type=str, nargs="+", required=True)
parser.add_argument(
"-e",
"--engines",
type=str,
nargs="+",
choices=["spdk", "io_uring"],
required=True,
)
parser.add_argument("-o", "--operations", type=str, nargs="+", required=True)
parser.add_argument("-c", "--concurrent_zones", type=int, nargs="+", required=True)
parser.add_argument("-b", "--block_sizes", type=int, nargs="+", required=True)
parser.add_argument(
"-q", "--queue_depth_limit", type=int, required=False, default=256
)
parser.add_argument("--lower_limit_y", type=int, required=False, default=0)
parser.add_argument("--upper_limit_y", type=int, required=False, default=550)
parser.add_argument("--lower_limit_x", type=int, required=False, default=0)
parser.add_argument("--upper_limit_x", type=int, required=False, default=300)
parser.add_argument(
"--transform_x",
type=str,
required=False,
choices=["none", "div1000", "div1000log"],
default="div1000",
)
parser.add_argument(
"--transform_y",
type=str,
required=False,
choices=["none", "div1000", "div1000log"],
default="div1000",
)
parser.add_argument("--filename", type=str, required=False, default="out")
args = parser.parse_args()
labels = args.labels
models = args.models
engines = args.engines
lbafs = args.lbafs
operations = args.operations
concurrent_zones = args.concurrent_zones
block_sizes = args.block_sizes
if (
len(labels) != len(models)
or len(models) != len(lbafs)
or len(engines) != len(lbafs)
or len(engines) != len(operations)
or len(operations) != len(concurrent_zones)
or len(concurrent_zones) != len(block_sizes)
):
print("List args must have equal length")
exit(1)
plot_lot_kiops(
args.filename,
args.title,
labels,
models,
lbafs,
operations,
engines,
concurrent_zones,
block_sizes,
args.queue_depth_limit,
args.lower_limit_y,
args.upper_limit_y,
args.lower_limit_x,
args.upper_limit_x,
args.transform_x,
args.transform_y,
)