2010-01-21 00:03:17 +00:00
|
|
|
#include <stasis/transactional.h>
|
2005-03-10 20:10:49 +00:00
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
2010-05-12 17:51:20 +00:00
|
|
|
assert(argc == 3 || argc == 4);
|
2005-03-10 20:10:49 +00:00
|
|
|
|
|
|
|
int xact_count = atoi(argv[1]);
|
|
|
|
int count = atoi(argv[2]);
|
|
|
|
|
2010-05-12 17:51:20 +00:00
|
|
|
int fixed_len = (argc == 4);
|
2005-03-10 20:10:49 +00:00
|
|
|
|
|
|
|
Tinit();
|
2010-05-12 17:51:20 +00:00
|
|
|
|
|
|
|
int xid = Tbegin();
|
|
|
|
|
|
|
|
recordid hash;
|
|
|
|
if(fixed_len) {
|
|
|
|
hash = ThashCreate(xid, sizeof(int), sizeof(int));
|
|
|
|
} else {
|
|
|
|
hash = ThashCreate(xid, VARIABLE_LENGTH, VARIABLE_LENGTH);
|
|
|
|
}
|
|
|
|
|
|
|
|
Tcommit(xid);
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
for(int k = 0; k < xact_count; k++) {
|
|
|
|
|
|
|
|
xid = Tbegin();
|
|
|
|
|
|
|
|
for(;i < count *(k+1) ; i++) {
|
|
|
|
ThashInsert(xid, hash, (byte*)&i, sizeof(int), (byte*)&i, sizeof(int));
|
|
|
|
}
|
|
|
|
|
|
|
|
Tcommit(xid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Tdeinit();
|
2005-03-10 20:10:49 +00:00
|
|
|
|
|
|
|
}
|