2007-11-01 20:09:55 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include "stasis/operations/lsmTable.h"
|
|
|
|
|
|
|
|
#include "stasis/transactional.h"
|
|
|
|
|
|
|
|
#include "stasis/page/compression/multicolumn-impl.h"
|
|
|
|
#include "stasis/page/compression/for-impl.h"
|
|
|
|
#include "stasis/page/compression/rle-impl.h"
|
|
|
|
#include "stasis/page/compression/staticTuple.h"
|
|
|
|
#include "stasis/page/compression/pageLayout.h"
|
|
|
|
|
|
|
|
typedef int32_t val_t; // XXX want multiple types!
|
|
|
|
|
|
|
|
namespace rose {
|
|
|
|
template<class PAGELAYOUT>
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
static int cmp_num = 1;
|
|
|
|
static int init_num = 1;
|
|
|
|
|
|
|
|
unlink("storefile.txt");
|
|
|
|
unlink("logfile.txt");
|
|
|
|
|
|
|
|
sync();
|
2007-11-02 21:20:30 +00:00
|
|
|
stasis_page_impl_register(Multicolumn<typename PAGELAYOUT::FMT::TUP >::impl());
|
2007-11-01 20:09:55 +00:00
|
|
|
bufferManagerNonBlockingSlowHandleType = IO_HANDLE_PFILE;
|
|
|
|
|
|
|
|
Tinit();
|
|
|
|
|
|
|
|
int xid = Tbegin();
|
|
|
|
|
|
|
|
recordid lsmTable = TlsmTableAlloc<PAGELAYOUT>(xid);
|
|
|
|
|
|
|
|
Tcommit(xid);
|
|
|
|
|
2007-11-02 21:20:30 +00:00
|
|
|
lsmTableHandle<PAGELAYOUT>* h = TlsmTableStart<PAGELAYOUT>(lsmTable);
|
|
|
|
|
|
|
|
typename PAGELAYOUT::FMT::TUP t;
|
|
|
|
|
|
|
|
|
|
|
|
static const long INSERTS = 1000000;
|
|
|
|
long int count = INSERTS / 20;
|
2007-11-01 20:09:55 +00:00
|
|
|
|
2007-11-02 21:56:17 +00:00
|
|
|
struct timeval start_tv, now_tv;
|
|
|
|
double start, now, last_start;
|
|
|
|
|
|
|
|
gettimeofday(&start_tv,0);
|
|
|
|
start = rose::tv_to_double(start_tv);
|
|
|
|
last_start = start;
|
|
|
|
|
2007-11-02 21:20:30 +00:00
|
|
|
for(long int i = 0; i < INSERTS; i++) {
|
|
|
|
t.set0(&i);
|
|
|
|
TlsmTableInsert(h,t);
|
|
|
|
count --;
|
|
|
|
if(!count) {
|
|
|
|
count = INSERTS / 20;
|
2007-11-02 21:56:17 +00:00
|
|
|
gettimeofday(&now_tv,0);
|
|
|
|
now = tv_to_double(now_tv);
|
|
|
|
printf("%3d%% complete "
|
|
|
|
"%9.3f Mtup/sec (avg) %9.3f Mtup/sec (cur) "
|
|
|
|
"%9.3f Mbyte/sec (avg) %9.3f Mbyte/sec (cur)\n",
|
|
|
|
((i+1) * 100) / INSERTS,
|
|
|
|
((double)i/1000000.0)/(now-start),
|
|
|
|
((double)count/1000000.0)/(now-last_start),
|
|
|
|
(((double)PAGELAYOUT::FMT::TUP::sizeofBytes())*(double)i/1000000.0)/(now-start),
|
|
|
|
(((double)PAGELAYOUT::FMT::TUP::sizeofBytes())*(double)count/1000000.0)/(now-last_start)
|
|
|
|
);
|
|
|
|
last_start = now;
|
2007-11-02 21:20:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
TlsmTableStop<PAGELAYOUT>(h);
|
2007-11-01 20:09:55 +00:00
|
|
|
|
|
|
|
Tdeinit();
|
|
|
|
|
|
|
|
printf("test\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2007-11-02 21:56:17 +00:00
|
|
|
// typedef rose::StaticTuple<4,int64_t,int32_t,int16_t,int8_t> tup;
|
|
|
|
typedef rose::StaticTuple<4,int64_t,int64_t,int64_t,int64_t> tup;
|
2007-11-01 20:09:55 +00:00
|
|
|
// XXX multicolumn is deprecated; want static dispatch!
|
|
|
|
return rose::main
|
|
|
|
<rose::SingleColumnTypePageLayout
|
2007-11-02 21:56:17 +00:00
|
|
|
<rose::Multicolumn<tup>,rose::For<int64_t> > >
|
2007-11-01 20:09:55 +00:00
|
|
|
(argc,argv);
|
2007-11-02 21:20:30 +00:00
|
|
|
return 0;
|
2007-11-01 20:09:55 +00:00
|
|
|
}
|