-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy paththread_loop_builder.h
More file actions
43 lines (31 loc) · 981 Bytes
/
thread_loop_builder.h
File metadata and controls
43 lines (31 loc) · 981 Bytes
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
//
// Created by Ravil Galiev on 21.07.2023.
//
#pragma once
#include <string>
#include "random_xoshiro256p.h"
#include "thread_loop.h"
#include "nlohmann/json.hpp"
#include "globals_t.h"
namespace microbench::workload {
struct ThreadLoopBuilder {
size_t RQ_RANGE;
virtual ThreadLoopBuilder* init(int range) {
RQ_RANGE = range;
return this;
};
virtual ThreadLoop* build(globals_t* g, Random64& rng, size_t tid,
StopCondition* stop_condition) = 0;
virtual void to_json(nlohmann::json& j) const = 0;
virtual void from_json(const nlohmann::json& j) = 0;
virtual std::string to_string(size_t indents = 1) = 0;
virtual ~ThreadLoopBuilder() = default;
};
void to_json(nlohmann::json& j, const ThreadLoopBuilder& s) {
s.to_json(j);
assert(j.contains("ClassName"));
}
void from_json(const nlohmann::json& j, ThreadLoopBuilder& s) {
s.from_json(j);
}
} // namespace microbench::workload