-
Notifications
You must be signed in to change notification settings - Fork 43
/
log.h
72 lines (59 loc) · 1.32 KB
/
log.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once
#include <string>
#include <vector>
#include "minecraft_save.h"
namespace alpaca {
namespace benchmark {
struct Address {
uint32_t x0;
uint32_t x1;
uint32_t x2;
uint32_t x3;
};
struct Log {
Address address;
std::string identity;
std::string userid;
std::string date;
std::string request;
uint32_t code;
uint64_t size;
};
struct Logs {
std::vector<Log> logs;
};
template <typename Engine>
auto generate_address(Engine &eng) {
std::uniform_int_distribution<uint32_t> uint_distr(0, 20000);
return Address {
uint_distr(eng),
uint_distr(eng),
uint_distr(eng),
uint_distr(eng)
};
}
template <typename Engine>
auto generate_log(Engine &eng) {
std::uniform_int_distribution<uint32_t> uint32_distr(0, 20000);
std::uniform_int_distribution<uint64_t> uint64_distr(0, 20000);
return Log {
generate_address(eng),
generate_string(12),
generate_string(8),
generate_string(16),
generate_string(32),
uint32_distr(eng),
uint64_distr(eng)
};
}
template <typename Engine>
auto generate_logs(Engine &eng) {
constexpr auto size = 10000;
Logs result{};
for (std::size_t i = 0; i < size; ++i) {
result.logs.push_back(generate_log(eng));
}
return result;
}
}
}