-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsysbench_schema.py
785 lines (682 loc) · 22.8 KB
/
sysbench_schema.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
import enum
import typing
from dataclasses import dataclass
from arcaflow_plugin_sdk import plugin, schema, validation
class OnOff(enum.Enum):
ON = "on"
OFF = "off"
class RandType(enum.Enum):
UNIFORM = "uniform"
GAUSSIAN = "gaussian"
SPECIAL = "special"
PARETO = "pareto"
class SeqRnd(enum.Enum):
SEQ = "seq"
RND = "rnd"
class GlobalLocal(enum.Enum):
GLOBAL = "global"
LOCAL = "local"
class RWN(enum.Enum):
READ = "read"
WRITE = "write"
NONE = "none"
class FileTestMode(enum.Enum):
SEQWR = "seqwr"
SEQREWR = "seqrewr"
SEQRD = "seqrd"
RNDR = "rndrd"
RNDWR = "rndwr"
RNDRW = "rndrw"
class FileIoMode(enum.Enum):
SYNC = "sync"
ASYNC = "async"
MMAP = "mmap"
class FileExtraFlag(enum.Enum):
SYNC = "sync"
DSYNC = "dsync"
DIRECT = "direct"
class FileSyncMode(enum.Enum):
FSYNC = "fsync"
FDATASYNC = "fdatasync"
@dataclass
class CommonInputParameters:
threads: typing.Annotated[
typing.Optional[int],
schema.name("Threads"),
schema.description("Number of worker threads to create"),
] = None
events: typing.Annotated[
typing.Optional[int],
schema.name("Number of events"),
schema.description("Maximum number of events"),
] = None
time: typing.Annotated[
typing.Optional[int],
schema.name("Time"),
schema.description("Limit for total execution time in seconds"),
] = None
forced_shutdown: typing.Annotated[
typing.Optional[int],
schema.id("forced-shutdown"),
schema.name("Forced Shutdown Seconds"),
schema.description(
"Number of seconds to wait after the 'time' limit before forcing"
" shutdown, or exclude parameter to disable forced shutdown"
),
] = None
thread_stack_size: typing.Annotated[
typing.Optional[str],
schema.id("thread-stack-size"),
schema.name("Thread stack size"),
schema.description("size of stack per thread"),
] = None
rate: typing.Annotated[
typing.Optional[int],
schema.name("Transaction rate"),
schema.description("average transactions rate. 0 for unlimited rate"),
] = None
validate: typing.Annotated[
typing.Optional[OnOff],
schema.name("Validate"),
schema.description("perform validation checks where possible"),
] = None
rand_type: typing.Annotated[
typing.Optional[RandType],
schema.id("rand-type"),
schema.name("Random Number Type"),
schema.description("Random numbers distribution"),
] = None
rand_spec_iter: typing.Annotated[
typing.Optional[int],
schema.id("rand-spec-iter"),
schema.name("Rand spec iterations"),
schema.description("Number of iterations used for numbers generation"),
] = None
rand_spec_pct: typing.Annotated[
typing.Optional[int],
schema.id("rand-spec-pct"),
schema.name("Rand spec percentage"),
schema.description(
"Percentage of values to be treated as 'special' (for special"
" distribution)"
),
] = None
rand_spec_res: typing.Annotated[
typing.Optional[int],
schema.id("rand-spec-res"),
schema.name("Rand spec res"),
schema.description(
"Percentage of 'special' values to use (for special distribution)"
),
] = None
rand_seed: typing.Annotated[
typing.Optional[int],
schema.id("rand-seed"),
schema.name("Rand seed"),
schema.description(
"seed for random number generator. When 0, the current time is"
" used as a RNG seed."
),
] = None
rand_pareto_h: typing.Annotated[
typing.Optional[float],
schema.id("rand-pareto-h"),
schema.name("Rand pareto h"),
schema.description("parameter h for pareto distribution"),
] = None
percentile: typing.Annotated[
typing.Optional[int],
validation.min(0),
validation.max(100),
schema.name("Percentile"),
schema.description(
"percentile to calculate in latency statistics (1-100)."
" Use the special value of 0 to disable percentile calculations"
),
] = None
# Other common parameters to consider...
# Implementing report-interval would add periodic output to stdout and a new
# data format we would need to account for in the parse_output section
# of the plugin
# --report-interval=N periodically report intermediate
# statistics with a specified interval in seconds. 0 disables intermediate
# reports [0]
# Implementing report-checkpoints would dump to stdout a full run output at
# the checkpoint times, requiring additional processing in the parse_output
# section of the plugin
# --report-checkpoints=[LIST,...] dump full statistics and reset all
# counters at specified points in time. The argument is a list of
# comma-separated values representing the amount of time in seconds elapsed
# from start of test when report checkpoint(s) must be performed. Report
# checkpoints are off by default. []
# Implementing debug would add more verbose output ot stdout that we would
# need to adjust parse_output to process.
# --debug[=on|off] print more debugging info [off]
# Implementing verbosity changes the output and would require adjustments to
# the parse_output process.
# --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3]
# Implementing histogram significantly adds to the output, but this might be
# valuable information to capture, even by default.
# --histogram[=on|off] print latency histogram in report [off]
@dataclass
class SysbenchCpuInputParams(CommonInputParameters):
"""
This is the data structure for the
input parameters of Sysbench CPU benchmark.
"""
cpu_max_prime: typing.Annotated[
typing.Optional[int],
schema.id("cpu-max-prime"),
schema.name("CPU max prime"),
schema.description("The upper limit of the number of prime numbers generated"),
] = None
@dataclass
class SysbenchMemoryInputParams(CommonInputParameters):
"""
This is the data structure for the
input parameters of Sysbench Memory benchmark.
"""
memory_block_size: typing.Annotated[
typing.Optional[str],
schema.id("memory-block-size"),
schema.name("Block Size"),
schema.description("size of memory block for test in KiB/MiB/GiB"),
] = None
memory_total_size: typing.Annotated[
typing.Optional[str],
schema.id("memory-total-size"),
schema.name("Total Size"),
schema.description("Total size of data to transfer in GiB"),
] = None
memory_scope: typing.Annotated[
typing.Optional[GlobalLocal],
schema.id("memory-scope"),
schema.name("Memory Scope"),
schema.description("Memory Access Scope(global/local)"),
] = None
memory_oper: typing.Annotated[
typing.Optional[RWN],
schema.id("memory-oper"),
schema.name("Memory Operation"),
schema.description("Type of memory operation(write/read)"),
] = None
memory_hugetlb: typing.Annotated[
typing.Optional[OnOff],
schema.id("memory-hugetlb"),
schema.name("Memory hugetlb"),
schema.description("Allocate memory from HugeTLB pool (on/off)"),
] = None
memory_access_mode: typing.Annotated[
typing.Optional[SeqRnd],
schema.id("memory-access-mode"),
schema.name("Memory Access Mode"),
schema.description("memory access mode (seq,rnd)"),
] = SeqRnd.SEQ
@dataclass
class SysbenchIoInputParams(CommonInputParameters):
"""
This is the data structure for the
input parameters of Sysbench I/O benchmark.
"""
file_num: typing.Annotated[
typing.Optional[int],
schema.id("file-num"),
schema.name("Files number"),
schema.description("Number of files to create"),
] = None
file_block_size: typing.Annotated[
typing.Optional[int],
schema.id("file-block-size"),
schema.name("File Block Size"),
schema.description("Block size to use in all IO operations"),
] = None
file_total_size: typing.Annotated[
typing.Optional[str],
schema.id("file-total-size"),
schema.name("File Total Size"),
schema.description("Total size of files to create"),
] = None
file_test_mode: typing.Annotated[
typing.Optional[FileTestMode],
schema.id("file-test-mode"),
schema.name("File Test Mode"),
schema.description("Test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}"),
] = None
file_io_mode: typing.Annotated[
typing.Optional[FileIoMode],
schema.id("file-io-mode"),
schema.name("File I/O Mode"),
schema.description("File operations mode {sync,async,mmap}"),
] = None
file_async_backlog: typing.Annotated[
typing.Optional[int],
schema.id("file-async-backlog"),
schema.name("File Async Backlog"),
schema.description("Number of asynchronous operatons to queue per thread"),
] = None
file_extra_flags: typing.Annotated[
typing.Optional[FileExtraFlag],
schema.id("file-extra-flags"),
schema.name("File I/O Mode"),
schema.description("File operations mode {sync,async,mmap}"),
] = None
file_fsync_freq: typing.Annotated[
typing.Optional[int],
schema.id("file-fsync-freq"),
schema.name("File Fsync Frequency"),
schema.description(
"Do fsync() after this number of requests (0 - don't use fsync())"
),
] = None
file_fsync_all: typing.Annotated[
typing.Optional[OnOff],
schema.id("file-fsync-all"),
schema.name("File Fsync Frequency"),
schema.description(
"Do fsync() after this number of requests (0 - don't use fsync())"
),
] = None
file_fsync_end: typing.Annotated[
typing.Optional[OnOff],
schema.id("file-fsync-end"),
schema.name("File Fsync At End"),
schema.description("Do fsync() at the end of test"),
] = None
file_fsync_mode: typing.Annotated[
typing.Optional[FileSyncMode],
schema.id("file-fsync-mode"),
schema.name("File Fsync Mode"),
schema.description(
"Which method to use for synchronization {fsync, fdatasync}"
),
] = None
file_merged_requests: typing.Annotated[
typing.Optional[int],
schema.id("file-merged-requests"),
schema.name("File Fsync Frequency"),
schema.description(
"Merge at most this number of IO requests if possible (0 - don't merge)"
),
] = None
file_rw_ratio: typing.Annotated[
typing.Optional[float],
schema.id("file-rw-ratio"),
schema.name("File R/W Ratio"),
schema.description("Reads/writes ratio for combined test"),
] = None
@dataclass
class LatencyAggregates:
avg: typing.Annotated[
float,
schema.name("Average"),
schema.description("Average Latency"),
]
min: typing.Annotated[
float,
schema.name("Minimum"),
schema.description("Minimum latency"),
]
max: typing.Annotated[
float,
schema.name("Maximum"),
schema.description("Maximum Latency"),
]
percentile: typing.Annotated[
int,
schema.name("Percentile"),
schema.description("Latency percentile selected for reporting"),
]
percentile_value: typing.Annotated[
float,
schema.name("Latency Percentile Value"),
schema.description("Latency percentile value"),
]
sum: typing.Annotated[
float,
schema.name("Sum"),
schema.description("Sum of latencies"),
]
@dataclass
class ThreadFairnessAggregates:
avg: typing.Annotated[
float,
schema.name("Average"),
schema.description("Average value across all threads"),
]
stddev: typing.Annotated[
float,
schema.name("Standard Deviation"),
schema.description("Standard deviation of all threads"),
]
@dataclass
class ThreadsFairness:
events: typing.Annotated[
ThreadFairnessAggregates,
schema.name("Thread Fairness events"),
schema.description("number of events executed by the threads "),
]
executiontime: typing.Annotated[
ThreadFairnessAggregates,
schema.name("Thread Fairness execution time"),
schema.description("Execution time of threads"),
]
@dataclass
class CPUmetrics:
eventspersecond: typing.Annotated[
float,
schema.name("Events per second"),
schema.description("Number of events per second to measure CPU speed"),
]
@dataclass
class FileOperationMetrics:
reads_s: typing.Annotated[
float,
schema.name("Read Ops/sec"),
schema.description("Read operations per second"),
]
writes_s: typing.Annotated[
float,
schema.name("Write Ops/s"),
schema.description("Write Operations per second"),
]
fsyncs_s: typing.Annotated[
float,
schema.name("Fsync/sec"),
schema.description("Number of fsync() per second"),
]
@dataclass
class ThroughputMetrics:
read_MiB_s: typing.Annotated[
float,
schema.name("Read Mebibytes/s"),
schema.description("Read Mebibyte (2^20 bytes) per second"),
]
written_MiB_s: typing.Annotated[
float,
schema.name("Written Mebibytes/s"),
schema.description("Written Mebibyte (2^20 bytes) per second"),
]
@dataclass
class SysbenchCommonOutputParams:
"""
This is the data structure for common output
parameters returned by sysbench benchmarks.
"""
totaltime: typing.Annotated[
float,
schema.name("Total time"),
schema.description("Total execution time of workload"),
]
totalnumberofevents: typing.Annotated[
int,
schema.name("Total number of events"),
schema.description("Total number of events performed by the workload"),
]
Numberofthreads: typing.Annotated[
int,
schema.name("Number of threads"),
schema.description("Number of threads used by the workload"),
]
Validationchecks: typing.Annotated[
typing.Optional[str],
schema.name("Validation checks"),
schema.description("Validation on/off"),
] = None
@dataclass
class SysbenchMemoryOutput:
"""
This is the data structure for specific output
parameters returned by sysbench memory benchmark.
"""
blocksize: typing.Annotated[
str,
schema.name("Block size"),
schema.description("Block size in KiB"),
]
totalsize: typing.Annotated[
str,
schema.name("Total size"),
schema.description("Total size in MiB"),
]
operation: typing.Annotated[
str,
schema.name("Operation"),
schema.description("memory operation performed"),
]
scope: typing.Annotated[
str,
schema.name("Scope"),
schema.description("scope of operation"),
]
Totaloperationspersecond: typing.Annotated[
float,
schema.name("Total operations per second"),
schema.description(
"Total number of operations performed by the memory workload" " per second"
),
]
Totaloperations: typing.Annotated[
int,
schema.name("Total operations"),
schema.description(
"Total number of operations performed by the memory workload"
),
]
memory_access_mode: typing.Annotated[
SeqRnd,
schema.name("Memory Access Mode"),
schema.description("memory access mode (seq,rnd)"),
]
@dataclass
class SysbenchCpuOutput:
"""
This is the data structure for specific output
parameters returned by sysbench cpu benchmark.
"""
Primenumberslimit: typing.Annotated[
int,
schema.name("Prime numbers limit"),
schema.description("Number of prime numbers to use for CPU workload"),
]
@dataclass
class SysbenchIoOutput:
"""
This is the data structure for specific output
parameters returned by sysbench io benchmark.
"""
Extrafileopenflags: typing.Annotated[
str,
schema.name("File Open Flags"),
schema.description("File Open Flags"),
]
@dataclass
class SysbenchMemoryResultParams:
"""
This is the output results data structure for sysbench memory results.
"""
transferred_MiB: typing.Annotated[
float,
schema.name("Transferred memory"),
schema.description("Total Memory Transferred"),
]
transferred_MiBpersec: typing.Annotated[
float,
schema.name("Transferred memory per second"),
schema.description("Total Memory Transferred per second"),
]
Latency: typing.Annotated[
LatencyAggregates,
schema.name("Latency"),
schema.description("Memory Latency in milli seconds"),
]
Threadsfairness: typing.Annotated[
ThreadsFairness,
schema.name("Threads fairness"),
schema.description(
"Event distribution by threads for number of executed events"
" by threads and total execution time by thread"
),
]
@dataclass
class SysbenchCpuResultParams:
"""
This is the output results data structure for sysbench cpu results.
"""
CPUspeed: typing.Annotated[
CPUmetrics,
schema.name("CPU speed"),
schema.description("No of events per second"),
]
Latency: typing.Annotated[
LatencyAggregates,
schema.name("Latency"),
schema.description("CPU latency in milliseconds"),
]
Threadsfairness: typing.Annotated[
ThreadsFairness,
schema.name("Threads fairness"),
schema.description(
"Event distribution by threads for number of executed events"
" by threads and total execution time by thread"
),
]
@dataclass
class SysbenchIoResultParams:
"""
This is the output results data structure for sysbench io results.
"""
Fileoperations: typing.Annotated[
FileOperationMetrics,
schema.name("FileOperations"),
schema.description("File Operation Metrics"),
]
Throughput: typing.Annotated[
ThroughputMetrics,
schema.name("Throughput"),
schema.description("Throughput metrics"),
]
Latency: typing.Annotated[
LatencyAggregates,
schema.name("Latency"),
schema.description("latency in milliseconds"),
]
Threadsfairness: typing.Annotated[
ThreadsFairness,
schema.name("Threads fairness"),
schema.description(
"Event distribution by threads for number of executed events"
" by threads and total execution time by thread"
),
]
@dataclass
class SysbenchMemoryOutputParams(SysbenchCommonOutputParams, SysbenchMemoryOutput):
"""
This is the data structure for all output
parameters returned by sysbench memory benchmark.
"""
@dataclass
class SysbenchCpuOutputParams(SysbenchCommonOutputParams, SysbenchCpuOutput):
"""
This is the data structure for all output
parameters returned by sysbench cpu benchmark.
"""
@dataclass
class SysbenchIoOutputParams(SysbenchCommonOutputParams, SysbenchIoOutput):
"""
This is the data structure for all output
parameters returned by sysbench io benchmark.
"""
ReadWriteratioforcombinedrandomIOtest: typing.Annotated[
typing.Optional[float],
schema.name("R/W Ratio Random Test"),
schema.description("Read/Write Ratio for combined random I/O test"),
] = None
NumberofIOrequests: typing.Annotated[
typing.Optional[int],
schema.name("Number of I/O requests"),
schema.description("Number of I/O requests"),
] = None
@dataclass
class WorkloadResultsCpu:
"""
This is the output results data structure
for the Sysbench CPU success case.
"""
sysbench_output_params: typing.Annotated[
SysbenchCpuOutputParams,
schema.name("Sysbench Cpu Output Parameters"),
schema.description(
"Ouptut parameters for a successful sysbench cpu workload execution"
),
]
sysbench_results: typing.Annotated[
SysbenchCpuResultParams,
schema.name("Sysbench Cpu Result Parameters"),
schema.description(
"Result parameters for a successful sysbench cpu workload execution"
),
]
@dataclass
class WorkloadResultsMemory:
"""
This is the output results data structure
for the Sysbench memory success case.
"""
sysbench_output_params: typing.Annotated[
SysbenchMemoryOutputParams,
schema.name("Sysbench Memory Output Parameters"),
schema.description(
"Ouptut parameters for a successful sysbench memory workload execution"
),
]
sysbench_results: typing.Annotated[
SysbenchMemoryResultParams,
schema.name("Sysbench Memory Result Parameters"),
schema.description(
"Result parameters for a successful sysbench Memory workload execution"
),
]
@dataclass
class WorkloadResultsIo:
"""
This is the output results data structure
for the Sysbench io success case.
"""
sysbench_output_params: typing.Annotated[
SysbenchIoOutputParams,
schema.name("Sysbench Io Output Parameters"),
schema.description(
"Ouptut parameters for a successful sysbench io workload execution"
),
]
sysbench_results: typing.Annotated[
SysbenchIoResultParams,
schema.name("Sysbench io Result Parameters"),
schema.description(
"Result parameters for a successful io Memory workload execution"
),
]
@dataclass
class WorkloadError:
"""
This is the output data structure in the error case.
"""
exit_code: typing.Annotated[
int,
schema.name("Exit Code"),
schema.description("Exit code returned by the program in case of a failure"),
]
error: typing.Annotated[
str,
schema.name("Failure Error"),
schema.description("Reason for failure"),
]
sysbench_cpu_input_schema = plugin.build_object_schema(SysbenchCpuInputParams)
sysbench_memory_input_schema = plugin.build_object_schema(SysbenchMemoryInputParams)
sysbench_io_input_schema = plugin.build_object_schema(SysbenchIoInputParams)
sysbench_cpu_output_schema = plugin.build_object_schema(SysbenchCpuOutputParams)
sysbench_cpu_results_schema = plugin.build_object_schema(SysbenchCpuResultParams)
sysbench_memory_output_schema = plugin.build_object_schema(SysbenchMemoryOutputParams)
sysbench_memory_results_schema = plugin.build_object_schema(SysbenchMemoryResultParams)
sysbench_io_output_schema = plugin.build_object_schema(SysbenchIoOutputParams)
sysbench_io_results_schema = plugin.build_object_schema(SysbenchIoResultParams)