Skip to content

Commit 73c538e

Browse files
author
Can Gokmen
committed
Working on debugging
1 parent c591c2c commit 73c538e

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

run.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ int main(int argc, char** argv) {
192192
long long insertion_time = 0;
193193
for (int64_t i = 0; i < N; i++) {
194194
//cout << i << " " << keys[i] << endl;
195-
//cout << "Current leafValue: " << ART::getLeafValue(tree->fp_leaf) << endl;
195+
cout << "Current leafValue: " << ART::getLeafValue(tree->fp_leaf) << endl;
196196
uint8_t key[4];
197197
ART::loadKey(keys[i], key);
198198
auto start = chrono::high_resolution_clock::now();
@@ -240,6 +240,8 @@ int main(int argc, char** argv) {
240240

241241
if (verbose) {
242242
cout << "Query time: " << query_time << " ns" << endl;
243+
cout << "Number of fp inserts: " << tree->number_of_fp_inserts << endl;
244+
cout << "Number of top inserts: " << tree->number_of_top_inserts << endl;
243245
}
244246

245247
// Output the times in csv format, including tree type

trees/QuART_stail_reset_bidir.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ class QuART_stail_reset_bidir : public QuART_stail {
1212
bool dir;
1313

1414
public:
15-
QuART_stail_reset_bidir() : QuART_stail(), reset_counter(300), dir(true) {}
15+
int number_of_fp_inserts = 0;
16+
int number_of_top_inserts = 0;
17+
18+
QuART_stail_reset_bidir() : QuART_stail(), reset_counter(300), dir(true), number_of_fp_inserts(0), number_of_top_inserts(0) {}
1619

1720
void insert(uint8_t key[], uintptr_t value) {
1821
/* Check if we can tail insert */
@@ -48,6 +51,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
4851
else if (key[i] < leafByte) {
4952
QuART_stail::insert_recursive_preserve_fp(
5053
this->root, &this->root, key, 0, value, maxPrefixLength);
54+
this->number_of_top_inserts++;
5155
return;
5256
}
5357
// Key byte is greater than leaf byte
@@ -63,6 +67,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
6367
QuART_stail::insert_recursive_change_fp(
6468
this->root, &this->root, key, 0, value,
6569
maxPrefixLength);
70+
this->number_of_top_inserts++;
6671
return;
6772
}
6873
// If it is not a bridge value and counter ended, force fp change
@@ -73,6 +78,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
7378
this->insert_recursive_change_fp(
7479
this->root, &this->root, key, 0, value,
7580
maxPrefixLength);
81+
this->number_of_top_inserts++;
7682
return;
7783
}
7884
// If it is not a bridge value, insert without changing
@@ -81,6 +87,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
8187
QuART_stail::insert_recursive_preserve_fp(
8288
this->root, &this->root, key, 0, value,
8389
maxPrefixLength);
90+
8491
return;
8592
}
8693
}
@@ -95,6 +102,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
95102
QuART_stail::insert_recursive_change_fp(
96103
this->root, &this->root, key, 0, value,
97104
maxPrefixLength);
105+
this->number_of_top_inserts++;
98106
return;
99107
}
100108
// If it is not a bridge value and counter ended, force fp change
@@ -105,6 +113,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
105113
this->insert_recursive_change_fp(
106114
this->root, &this->root, key, 0, value,
107115
maxPrefixLength);
116+
this->number_of_top_inserts++;
108117
return;
109118
}
110119
// If it is not a bridge value, insert without changing
@@ -113,6 +122,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
113122
QuART_stail::insert_recursive_preserve_fp(
114123
this->root, &this->root, key, 0, value,
115124
maxPrefixLength);
125+
this->number_of_top_inserts++;
116126
return;
117127
}
118128
}
@@ -127,6 +137,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
127137
QuART_stail::insert_recursive_change_fp(
128138
this->root, &this->root, key, 0, value,
129139
maxPrefixLength);
140+
this->number_of_top_inserts++;
130141
return;
131142
}
132143
// If it is not a bridge value and counter ended, force fp change
@@ -137,6 +148,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
137148
this->insert_recursive_change_fp(
138149
this->root, &this->root, key, 0, value,
139150
maxPrefixLength);
151+
this->number_of_top_inserts++;
140152
return;
141153
}
142154
// If it is not a bridge value, insert without changing
@@ -145,6 +157,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
145157
QuART_stail::insert_recursive_preserve_fp(
146158
this->root, &this->root, key, 0, value,
147159
maxPrefixLength);
160+
this->number_of_top_inserts++;
148161
return;
149162
}
150163
}
@@ -174,6 +187,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
174187
else if (key[i] > leafByte) {
175188
QuART_stail::insert_recursive_preserve_fp(
176189
this->root, &this->root, key, 0, value, maxPrefixLength);
190+
this->number_of_top_inserts++;
177191
return;
178192
}
179193
// Key byte is greater than leaf byte
@@ -189,6 +203,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
189203
QuART_stail::insert_recursive_change_fp(
190204
this->root, &this->root, key, 0, value,
191205
maxPrefixLength);
206+
this->number_of_top_inserts++;
192207
return;
193208
}
194209
// If it is not a bridge value and counter ended, force fp change
@@ -199,6 +214,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
199214
this->insert_recursive_change_fp(
200215
this->root, &this->root, key, 0, value,
201216
maxPrefixLength);
217+
this->number_of_top_inserts++;
202218
return;
203219
}
204220
// If it is not a bridge value, insert without changing
@@ -207,6 +223,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
207223
QuART_stail::insert_recursive_preserve_fp(
208224
this->root, &this->root, key, 0, value,
209225
maxPrefixLength);
226+
this->number_of_top_inserts++;
210227
return;
211228
}
212229
}
@@ -221,6 +238,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
221238
QuART_stail::insert_recursive_change_fp(
222239
this->root, &this->root, key, 0, value,
223240
maxPrefixLength);
241+
this->number_of_top_inserts++;
224242
return;
225243
}
226244
// If it is not a bridge value and counter ended, force fp change
@@ -231,6 +249,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
231249
this->insert_recursive_change_fp(
232250
this->root, &this->root, key, 0, value,
233251
maxPrefixLength);
252+
this->number_of_top_inserts++;
234253
return;
235254
}
236255
// If it is not a bridge value, insert without changing
@@ -239,6 +258,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
239258
QuART_stail::insert_recursive_preserve_fp(
240259
this->root, &this->root, key, 0, value,
241260
maxPrefixLength);
261+
this->number_of_top_inserts++;
242262
return;
243263
}
244264
}
@@ -253,6 +273,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
253273
QuART_stail::insert_recursive_change_fp(
254274
this->root, &this->root, key, 0, value,
255275
maxPrefixLength);
276+
this->number_of_top_inserts++;
256277
return;
257278
}
258279
// If it is not a bridge value and counter ended, force fp change
@@ -263,6 +284,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
263284
this->insert_recursive_change_fp(
264285
this->root, &this->root, key, 0, value,
265286
maxPrefixLength);
287+
this->number_of_top_inserts++;
266288
return;
267289
}
268290
// If it is not a bridge value, insert without changing
@@ -271,6 +293,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
271293
QuART_stail::insert_recursive_preserve_fp(
272294
this->root, &this->root, key, 0, value,
273295
maxPrefixLength);
296+
this->number_of_top_inserts++;
274297
return;
275298
}
276299
}
@@ -287,6 +310,7 @@ class QuART_stail_reset_bidir : public QuART_stail {
287310
// If depth is at maxPrefixLength - 1, we do not need to worry about
288311
// leaf expansion of prefix mismatch, we can directly insert the new
289312
// leaf into fp node
313+
this->number_of_fp_inserts++;
290314
if (this->fp_depth == maxPrefixLength - 1) {
291315
// Insert leaf into fp
292316
ArtNode* newNode = makeLeaf(value);

0 commit comments

Comments
 (0)