-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathebs_wrapper.cpp
More file actions
77 lines (64 loc) · 1.67 KB
/
Copy pathebs_wrapper.cpp
File metadata and controls
77 lines (64 loc) · 1.67 KB
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
#include "ebs_wrapper.h"
#include "common.h"
#include "btree_array.h"
namespace EbsUInt64
{
using namespace fbs;
typedef btree_array<64/sizeof(uint64_t),uint64_t,uint64_t,true> EbsArray;
template<bool enforcedDep>
void EbsExecuteWorkload(WorkloadUInt64& workload)
{
printf("Ebs executing workload, enforced dependency = %d\n", (enforcedDep ? 1 : 0));
int n = workload.numInitialValues;
sort(workload.initialValues, workload.initialValues + n);
EbsArray A(workload.initialValues, workload.numInitialValues);
printf("Ebs executing workload..\n");
{
AutoTimer timer;
if (enforcedDep)
{
uint64_t lastAnswer = 0;
for (int i = 0; i < workload.numOperations; i++)
{
uint32_t x = workload.operations[i].type;
x ^= (uint32_t)lastAnswer;
WorkloadOperationType type = (WorkloadOperationType)x;
uint64_t realKey = workload.operations[i].key ^ lastAnswer;
uint64_t answer;
switch (type)
{
case WorkloadOperationType::EXIST:
{
int x = A.search(realKey);
if (x < n)
answer = (A.get_data(x) == realKey);
else
answer = false;
break;
}
case WorkloadOperationType::LOWER_BOUND:
{
int x = A.search(realKey);
if (x < n)
answer = A.get_data(x);
else
answer = 0xffffffffffffffffULL;
break;
}
}
workload.results[i] = answer;
lastAnswer = answer;
}
}
else
{
ReleaseAssert(false);
}
}
printf("DenseHashSet workload completed.\n");
}
// explicitly instantiate template function
//
template void EbsExecuteWorkload<false>(WorkloadUInt64& workload);
template void EbsExecuteWorkload<true>(WorkloadUInt64& workload);
} // DenseHashSetUInt64