-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoptions.h
49 lines (37 loc) · 863 Bytes
/
options.h
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
#ifndef OPTION_H
#define OPTION_H
#include <atomic>
#include <cstdint>
void usage();
bool parse_option(int argc, char *argv[]);
bool verify_variables();
void free_option();
enum TestMode {
CONSISTENT,
SHORT_CONNECT,
REMAIN_QPS,
};
class Statistics {
public:
Statistics() {
m_cnt.store(0);
m_cnt_failed.store(0);
}
~Statistics() {}
void operator=(const Statistics &state) {
m_cnt.store(state.m_cnt.load());
m_cnt_failed.store(state.m_cnt_failed.load());
}
uint64_t get_cnt_total() { return m_cnt.load(); }
uint64_t get_cnt_failed() { return m_cnt_failed.load(); }
void increase_cnt_total() { m_cnt++; }
void increase_cnt_failed() { m_cnt_failed++; }
void clear() {
m_cnt.store(0);
m_cnt_failed.store(0);
}
private:
std::atomic<uint64_t> m_cnt{0};
std::atomic<uint64_t> m_cnt_failed{0};
};
#endif