-
Notifications
You must be signed in to change notification settings - Fork 1
/
Benchmark.cpp
118 lines (112 loc) · 2.51 KB
/
Benchmark.cpp
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
#include "RunMetadata.h"
#include "BloomFilter.h"
#include "LsmTree.h"
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <random>
//#include "GetTimeMs64.h"
using namespace std;
/* TODO have this use averages, or put it in the R */
//int main(int argc, char *argv[]) {
//
// if (argc < 6) {
// cout << "Insufficient arguments." << endl;
// cout << "Usage: './Benchmark runSize levelSize bloomSize file lines'" << endl;
// return 1;
// }
//
// int runSize = stoi(argv[1]);
// int levelSize = stoi(argv[2]);
// int bloomSize = stoi(argv[3]);
// string filename = argv[4];
// int numLines = stoi(argv[5]);
// ifstream file(filename.c_str());
//
// char *commands = new char[numLines];
// int *keys = new int[numLines];
// int *vals = new int[numLines];
//
// string type, key, val;
// int k, v;
//
// int i = 0;
// if(file.is_open()) {
// if (i < numLines) {
// while(getline(file, type, ',')) {
//
// commands[i] = type[0];
//
// if ((type == "i") || (type == "u") || (type == "r")) {
// getline(file, key, ',');
// keys[i] = stoi(key);
//
// getline(file, val);
// vals[i] = stoi(val);
// }
// else {
// //cerr << "second type" << endl;
// getline(file, key);
// keys[i] = stoi(key);
// }
// //cerr << keys[i] << endl;
// //cout << numLines - i << endl;
// i++;
// }
// }
// file.close();
// }
//
// TierLsmTree *tree = new TierLsmTree(runSize, levelSize, bloomSize);
//
// cerr << "Setup0" << endl;
//
// uint64 start = GetTimeMs64();
// for (int i = 0; i < numLines; i++) {
// cout << commands[i] << endl;
// switch (commands[i]) {
// case 'i':
// tree->insert(keys[i], vals[i]);
// break;
// case 'd':
// tree->remove(keys[i]);
// break;
// case 'u':
// tree->insert(keys[i], vals[i]);
// break;
// case 'g':
// tree->get(keys[i]);
// break;
// case 'r':
// tree->getRange(keys[i], vals[i]);
// break;
// }
// }
// uint64 end = GetTimeMs64();
//
// cerr << "Setup1" << endl;
//
// cout << end - start << endl;
//
// delete [] commands;
// delete [] keys;
// delete [] vals;
//
// return 0;
//
// //
//
// //
//
// /*
// // only used once to initialise (seed) engine
// std::random_device rd;
//
// // random-number engine used (Mersenne-Twister in this case)
// std::mt19937 rng(rd());
//
// // guaranteed unbiased
// std::uniform_int_distribution<int> uni(-1000,1000); */
//
// //ResultSet *rs;
//}