6198522971
linear hash implementation. In particular, I've implemented (sort of) an iterator for linear hash, and (sort of) ported libdfa to linearhash.c I say 'sort of' since this functionality is broken with this commit. On the other hand, CVS should build now, and the tests under lladd will pass. libdfa's new tests don't pass at the moment.
41 lines
698 B
C
41 lines
698 B
C
#include <assert.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <lladd/transactional.h>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
assert(argc == 3);
|
|
|
|
int xact_count = atoi(argv[1]);
|
|
int count = atoi(argv[2]);
|
|
|
|
/* unlink("storefile.txt");
|
|
unlink("logfile.txt");
|
|
unlink("blob0_file.txt");
|
|
unlink("blob1_file.txt");*/
|
|
|
|
Tinit();
|
|
|
|
int xid = Tbegin();
|
|
|
|
recordid hash = ThashAlloc(xid, sizeof(int), sizeof(int));
|
|
|
|
Tcommit(xid);
|
|
|
|
int i = 0;
|
|
int k;
|
|
for(k = 0; k < xact_count; k++) {
|
|
xid = Tbegin();
|
|
for(; i < (count*(k+1)) ; i++) {
|
|
TnaiveHashInsert(xid, hash, &i, sizeof(int), &i, sizeof(int));
|
|
}
|
|
Tcommit(xid);
|
|
|
|
}
|
|
|
|
|
|
Tdeinit();
|
|
|
|
}
|