Skip to content

Commit 2d1da89

Browse files
committed
Clang format changes
1 parent 7ae506c commit 2d1da89

3 files changed

Lines changed: 462 additions & 22 deletions

File tree

‎run.cpp‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ std::vector<key_type> read_bin(const char* filename) {
2727

2828
int main(int argc, char** argv) {
2929
bool verbose = false; // optional argument
30-
int N = 500000000; // optional argument
30+
int N = 500000000; // optional argument
3131
string input_file; // required argument
3232
string tree_type = "ART"; // default tree type
3333

@@ -71,12 +71,12 @@ int main(int argc, char** argv) {
7171
cout << "Tree type: " << tree_type << endl;
7272
cout << "Insertion time: " << insertion_time << " ns" << endl;
7373
}
74-
74+
7575
// Query 1% of entries
7676
uint64_t minval = 1;
7777
uint64_t maxval = N;
7878
srand(time(0));
79-
79+
8080
long long query_time = 0;
8181
for (uint64_t i = 0; i < (N / 100); i++) {
8282
int random = rand() % (maxval - minval + 1) + minval;
@@ -88,17 +88,17 @@ int main(int argc, char** argv) {
8888
auto duration =
8989
chrono::duration_cast<chrono::nanoseconds>(stop - start);
9090
query_time += duration.count();
91-
assert(ART::isLeaf(leaf) && ART::getLeafValue(leaf) == keys[random]);
91+
assert(ART::isLeaf(leaf) &&
92+
ART::getLeafValue(leaf) == keys[random]);
9293
}
93-
94+
9495
if (verbose) {
9596
cout << "Query time: " << query_time << " ns" << endl;
9697
}
97-
98+
9899
// Output the times in csv format, including tree type
99100
cout << insertion_time << "," << query_time << endl;
100-
}
101-
else if (tree_type == "QuART_tail") {
101+
} else if (tree_type == "QuART_tail") {
102102
ART::QuART_tail* tree = new ART::QuART_tail();
103103
long long insertion_time = 0;
104104
for (uint64_t i = 0; i < N; i++) {
@@ -116,12 +116,12 @@ int main(int argc, char** argv) {
116116
cout << "Tree type: " << tree_type << endl;
117117
cout << "Insertion time: " << insertion_time << " ns" << endl;
118118
}
119-
119+
120120
// Query 1% of entries
121121
uint64_t minval = 1;
122122
uint64_t maxval = N;
123123
srand(time(0));
124-
124+
125125
long long query_time = 0;
126126
for (uint64_t i = 0; i < (N / 100); i++) {
127127
int random = rand() % (maxval - minval + 1) + minval;
@@ -133,17 +133,17 @@ int main(int argc, char** argv) {
133133
auto duration =
134134
chrono::duration_cast<chrono::nanoseconds>(stop - start);
135135
query_time += duration.count();
136-
assert(ART::isLeaf(leaf) && ART::getLeafValue(leaf) == keys[random]);
136+
assert(ART::isLeaf(leaf) &&
137+
ART::getLeafValue(leaf) == keys[random]);
137138
}
138-
139+
139140
if (verbose) {
140141
cout << "Query time: " << query_time << " ns" << endl;
141142
}
142-
143+
143144
// Output the times in csv format, including tree type
144145
cout << insertion_time << "," << query_time << endl;
145-
}
146-
else if (tree_type == "QuART_lil") {
146+
} else if (tree_type == "QuART_lil") {
147147
ART::QuART_lil* tree = new ART::QuART_lil();
148148
long long insertion_time = 0;
149149
for (uint64_t i = 0; i < N; i++) {
@@ -161,12 +161,12 @@ int main(int argc, char** argv) {
161161
cout << "Tree type: " << tree_type << endl;
162162
cout << "Insertion time: " << insertion_time << " ns" << endl;
163163
}
164-
164+
165165
// Query 1% of entries
166166
uint64_t minval = 1;
167167
uint64_t maxval = N;
168168
srand(time(0));
169-
169+
170170
long long query_time = 0;
171171
for (uint64_t i = 0; i < (N / 100); i++) {
172172
int random = rand() % (maxval - minval + 1) + minval;
@@ -178,17 +178,17 @@ int main(int argc, char** argv) {
178178
auto duration =
179179
chrono::duration_cast<chrono::nanoseconds>(stop - start);
180180
query_time += duration.count();
181-
assert(ART::isLeaf(leaf) && ART::getLeafValue(leaf) == keys[random]);
181+
assert(ART::isLeaf(leaf) &&
182+
ART::getLeafValue(leaf) == keys[random]);
182183
}
183-
184+
184185
if (verbose) {
185186
cout << "Query time: " << query_time << " ns" << endl;
186187
}
187-
188+
188189
// Output the times in csv format, including tree type
189190
cout << insertion_time << "," << query_time << endl;
190-
}
191-
else {
191+
} else {
192192
cerr << "Unknown tree type: " << tree_type << endl;
193193
return 1;
194194
}

‎test.sh‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# filepath: /projectnb/manoslab/cgokmen/Qu-ART/test.sh
3+
4+
SUFFIX=$(date +"%Y%m%d_%H%M%S")
5+
RESULTSDIR="results"
6+
mkdir -p "$RESULTSDIR"
7+
RESULTS="${RESULTSDIR}/results_run_${SUFFIX}.txt"
8+
9+
echo "input_file,N,result" > "$RESULTS"
10+
11+
for FILE in ../bods/all_workloads/workload_N*_K*_L*.bin; do
12+
[ -f "$FILE" ] || continue
13+
14+
BASENAME=$(basename "$FILE")
15+
N=$(echo "$BASENAME" | sed -n 's/.*_N\([0-9]*\)_K[0-9]*_L[0-9]*.bin/\1/p')
16+
17+
OUTPUT=$(./build/run -t QuART_stail -f "$FILE" -N "$N" )
18+
# Write all output to results file, one block per workload
19+
echo "==== $FILE ====" >> "$RESULTS"
20+
echo "$OUTPUT" >> "$RESULTS"
21+
echo "" >> "$RESULTS"
22+
done

0 commit comments

Comments
 (0)