2007-11-01 20:09:55 +00:00
|
|
|
#include <stdio.h>
|
2007-11-04 21:25:08 +00:00
|
|
|
#include <stdlib.h>
|
2007-11-01 20:09:55 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include "stasis/operations/lsmTable.h"
|
|
|
|
|
|
|
|
#include "stasis/transactional.h"
|
|
|
|
|
|
|
|
#include "stasis/page/compression/multicolumn-impl.h"
|
2007-11-04 21:25:08 +00:00
|
|
|
#include "stasis/page/compression/staticMulticolumn.h"
|
2007-11-01 20:09:55 +00:00
|
|
|
#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"
|
|
|
|
|
|
|
|
namespace rose {
|
2007-11-06 02:27:04 +00:00
|
|
|
template<class PAGELAYOUT>
|
|
|
|
void getTuple(long int i, typename PAGELAYOUT::FMT::TUP & t) {
|
|
|
|
typename PAGELAYOUT::FMT::TUP::TYP0 m = i;
|
|
|
|
typename PAGELAYOUT::FMT::TUP::TYP1 j = i / 65536;
|
|
|
|
typename PAGELAYOUT::FMT::TUP::TYP2 k = i / 12514500;
|
|
|
|
typename PAGELAYOUT::FMT::TUP::TYP3 l = i / 10000000;
|
|
|
|
|
|
|
|
t.set0(&m);
|
|
|
|
t.set1(&j);
|
|
|
|
t.set2(&k);
|
|
|
|
t.set3(&l);
|
|
|
|
t.set4(&j);
|
|
|
|
t.set5(&k);
|
|
|
|
t.set6(&l);
|
|
|
|
t.set7(&j);
|
|
|
|
t.set8(&k);
|
|
|
|
t.set9(&l);
|
|
|
|
}
|
|
|
|
|
2007-11-01 20:09:55 +00:00
|
|
|
template<class PAGELAYOUT>
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
unlink("storefile.txt");
|
|
|
|
unlink("logfile.txt");
|
|
|
|
|
|
|
|
sync();
|
2007-11-06 02:27:04 +00:00
|
|
|
|
|
|
|
PAGELAYOUT::initPageLayout();
|
|
|
|
|
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;
|
2007-11-06 02:27:04 +00:00
|
|
|
typename PAGELAYOUT::FMT::TUP s;
|
2007-11-02 21:20:30 +00:00
|
|
|
|
2007-11-04 21:25:08 +00:00
|
|
|
long INSERTS;
|
|
|
|
if(argc == 2) {
|
|
|
|
INSERTS = atoll(argv[1]);
|
|
|
|
} else {
|
|
|
|
INSERTS = 10 * 1000 * 1000;
|
|
|
|
}
|
2007-11-04 01:51:37 +00:00
|
|
|
static const long COUNT = INSERTS / 100;
|
|
|
|
long int count = COUNT;
|
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-06 02:27:04 +00:00
|
|
|
printf("tuple 'size'%d ; %ld\n", PAGELAYOUT::FMT::TUP::sizeofBytes(), sizeof(typename PAGELAYOUT::FMT::TUP));
|
2007-11-04 01:51:37 +00:00
|
|
|
|
2007-11-02 21:20:30 +00:00
|
|
|
for(long int i = 0; i < INSERTS; i++) {
|
2007-11-06 02:27:04 +00:00
|
|
|
getTuple<PAGELAYOUT>(i,t);
|
2007-11-02 21:20:30 +00:00
|
|
|
TlsmTableInsert(h,t);
|
2007-11-12 00:49:00 +00:00
|
|
|
// getTuple<PAGELAYOUT>(i,t);
|
|
|
|
// assert(TlsmTableFind(xid,h,t,s));
|
2007-11-02 21:20:30 +00:00
|
|
|
count --;
|
|
|
|
if(!count) {
|
2007-11-04 01:51:37 +00:00
|
|
|
count = COUNT;
|
2007-11-02 21:56:17 +00:00
|
|
|
gettimeofday(&now_tv,0);
|
|
|
|
now = tv_to_double(now_tv);
|
2007-11-06 02:27:04 +00:00
|
|
|
printf("%3ld%% write "
|
|
|
|
"%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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("insertions done.\n"); fflush(stdout);
|
|
|
|
count = COUNT;
|
|
|
|
|
|
|
|
gettimeofday(&start_tv,0);
|
|
|
|
start = rose::tv_to_double(start_tv);
|
|
|
|
last_start = start;
|
|
|
|
|
|
|
|
for(long int i = 0; i < INSERTS; i++) {
|
|
|
|
|
|
|
|
getTuple<PAGELAYOUT>(i,t);
|
|
|
|
|
|
|
|
typename PAGELAYOUT::FMT::TUP const * const sp = TlsmTableFind(xid,h,t,s);
|
|
|
|
assert(sp);
|
|
|
|
assert(*sp == s);
|
|
|
|
count--;
|
|
|
|
if(!count) {
|
|
|
|
count = COUNT;
|
|
|
|
gettimeofday(&now_tv,0);
|
|
|
|
now = tv_to_double(now_tv);
|
|
|
|
printf("%3ld%% read "
|
2007-11-02 21:56:17 +00:00
|
|
|
"%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
|
|
|
}
|
2007-11-06 02:27:04 +00:00
|
|
|
|
2007-11-02 21:20:30 +00:00
|
|
|
}
|
2007-11-06 02:27:04 +00:00
|
|
|
|
2007-11-02 21:20:30 +00:00
|
|
|
TlsmTableStop<PAGELAYOUT>(h);
|
2007-11-01 20:09:55 +00:00
|
|
|
|
|
|
|
Tdeinit();
|
|
|
|
|
|
|
|
printf("test\n");
|
2007-11-06 02:27:04 +00:00
|
|
|
return 0;
|
2007-11-01 20:09:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2007-11-04 21:25:08 +00:00
|
|
|
|
|
|
|
typedef int64_t typ0;
|
|
|
|
typedef int64_t typ1;
|
|
|
|
typedef int64_t typ2;
|
|
|
|
typedef int64_t typ3;
|
|
|
|
typedef int64_t typ4;
|
|
|
|
typedef int64_t typ5;
|
|
|
|
typedef int64_t typ6;
|
|
|
|
typedef int64_t typ7;
|
|
|
|
typedef int64_t typ8;
|
|
|
|
typedef int64_t typ9;
|
|
|
|
|
|
|
|
#define COLS 10
|
|
|
|
|
|
|
|
typedef rose::StaticTuple<COLS,typ0,typ1,typ2,typ3,typ4,typ5,typ6,typ7,typ8,typ9> tup;
|
|
|
|
using rose::For;
|
|
|
|
using rose::Rle;
|
|
|
|
|
|
|
|
// multicolumn is deprecated; want static dispatch!
|
|
|
|
|
|
|
|
/* return rose::main
|
2007-11-01 20:09:55 +00:00
|
|
|
<rose::SingleColumnTypePageLayout
|
2007-11-02 21:56:17 +00:00
|
|
|
<rose::Multicolumn<tup>,rose::For<int64_t> > >
|
2007-11-04 21:25:08 +00:00
|
|
|
(argc,argv); */
|
|
|
|
|
|
|
|
return rose::main
|
|
|
|
<rose::MultiColumnTypePageLayout
|
|
|
|
<COLS,
|
|
|
|
rose::StaticMulticolumn<COLS,tup,
|
|
|
|
For<typ0>,Rle<typ1>,
|
|
|
|
Rle<typ2>,Rle<typ3>,
|
|
|
|
Rle<typ4>,Rle<typ5>,
|
|
|
|
Rle<typ6>,Rle<typ7>,
|
2007-11-06 02:27:04 +00:00
|
|
|
Rle<typ8>,For<typ9> >
|
2007-11-04 21:25:08 +00:00
|
|
|
>
|
|
|
|
>
|
2007-11-01 20:09:55 +00:00
|
|
|
(argc,argv);
|
2007-11-04 21:25:08 +00:00
|
|
|
|
2007-11-02 21:20:30 +00:00
|
|
|
return 0;
|
2007-11-01 20:09:55 +00:00
|
|
|
}
|