Fixed statistics reporting.
This commit is contained in:
parent
75cbb20e6d
commit
3a88e43e9b
3 changed files with 52 additions and 29 deletions
|
@ -41,13 +41,31 @@ namespace rose {
|
|||
static const long INSERTS = 1000000;
|
||||
long int count = INSERTS / 20;
|
||||
|
||||
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;
|
||||
|
||||
for(long int i = 0; i < INSERTS; i++) {
|
||||
t.set0(&i);
|
||||
TlsmTableInsert(h,t);
|
||||
count --;
|
||||
if(!count) {
|
||||
count = INSERTS / 20;
|
||||
printf("%d pct complete\n", (i * 100) / INSERTS);
|
||||
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;
|
||||
}
|
||||
}
|
||||
TlsmTableStop<PAGELAYOUT>(h);
|
||||
|
@ -59,11 +77,12 @@ namespace rose {
|
|||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
typedef rose::StaticTuple<4,int64_t,int32_t,int16_t,int8_t> tup;
|
||||
// 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;
|
||||
// XXX multicolumn is deprecated; want static dispatch!
|
||||
return rose::main
|
||||
<rose::SingleColumnTypePageLayout
|
||||
<rose::Multicolumn<tup>,rose::For<val_t> > >
|
||||
<rose::Multicolumn<tup>,rose::For<int64_t> > >
|
||||
(argc,argv);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -115,9 +115,11 @@ namespace rose {
|
|||
|
||||
Tcommit(xid);
|
||||
// loop around here to produce multiple batches for merge.
|
||||
|
||||
gettimeofday(&start_tv,0);
|
||||
|
||||
while(1) {
|
||||
|
||||
gettimeofday(&start_tv,0);
|
||||
|
||||
pthread_mutex_lock(a->block_ready_mut);
|
||||
|
||||
|
@ -183,6 +185,23 @@ namespace rose {
|
|||
// TlsmFree(wait_queue[0]) /// XXX Need to implement (de)allocation!
|
||||
// TlsmFree(wait_queue[1])
|
||||
|
||||
merge_count++;
|
||||
|
||||
double wait_elapsed = tv_to_double(wait_tv) - tv_to_double(start_tv);
|
||||
double work_elapsed = tv_to_double(stop_tv) - tv_to_double(wait_tv);
|
||||
double total_elapsed = wait_elapsed + work_elapsed;
|
||||
double ratio = ((double)(insertedTuples * (uint64_t)PAGELAYOUT::FMT::TUP::sizeofBytes()))
|
||||
/ (double)(PAGE_SIZE * mergedPages);
|
||||
double throughput = ((double)(insertedTuples * (uint64_t)PAGELAYOUT::FMT::TUP::sizeofBytes()))
|
||||
/ (1024.0 * 1024.0 * total_elapsed);
|
||||
|
||||
printf("merge # %-6d: comp ratio: %-9.3f waited %6.1f sec "
|
||||
"worked %6.1f sec inserts %-12ld (%9.3f mb/s) %6d pages\n", merge_count, ratio,
|
||||
wait_elapsed, work_elapsed, (unsigned long)insertedTuples, throughput, mergedPages);
|
||||
|
||||
|
||||
gettimeofday(&start_tv,0);
|
||||
|
||||
pthread_mutex_lock(a->block_ready_mut);
|
||||
|
||||
static int threshold_calc = 1000; // XXX REALLY NEED TO FIX THIS!
|
||||
|
@ -213,20 +232,6 @@ namespace rose {
|
|||
|
||||
pthread_mutex_unlock(a->block_ready_mut);
|
||||
|
||||
merge_count++;
|
||||
|
||||
double wait_elapsed = tv_to_double(wait_tv) - tv_to_double(start_tv);
|
||||
double work_elapsed = tv_to_double(stop_tv) - tv_to_double(wait_tv);
|
||||
double total_elapsed = wait_elapsed + work_elapsed;
|
||||
double ratio = ((double)(insertedTuples * (uint64_t)PAGELAYOUT::FMT::TUP::sizeofBytes()))
|
||||
/ (double)(PAGE_SIZE * mergedPages);
|
||||
double throughput = ((double)(insertedTuples * (uint64_t)PAGELAYOUT::FMT::TUP::sizeofBytes()))
|
||||
/ (1024.0 * 1024.0 * total_elapsed);
|
||||
|
||||
printf("merge # %-6d: comp ratio: %-9.3f waited %6.1f sec "
|
||||
"worked %6.1f sec inserts %-12ld (%9.3f mb/s) %6d pages\n", merge_count, ratio,
|
||||
wait_elapsed, work_elapsed, (unsigned long)insertedTuples, throughput, mergedPages);
|
||||
|
||||
Tcommit(xid);
|
||||
|
||||
}
|
||||
|
|
|
@ -37,17 +37,16 @@ namespace rose {
|
|||
|
||||
static inline byte_off_t sizeofBytes() {
|
||||
return sizeof(flag_t) + sizeof(epoch_t) +
|
||||
(0 < N) ? sizeof(TYPE0) : 0 +
|
||||
(1 < N) ? sizeof(TYPE1) : 0 +
|
||||
(2 < N) ? sizeof(TYPE2) : 0 +
|
||||
(3 < N) ? sizeof(TYPE3) : 0 +
|
||||
(4 < N) ? sizeof(TYPE4) : 0 +
|
||||
(5 < N) ? sizeof(TYPE5) : 0 +
|
||||
(6 < N) ? sizeof(TYPE6) : 0 +
|
||||
(7 < N) ? sizeof(TYPE7) : 0 +
|
||||
(8 < N) ? sizeof(TYPE8) : 0 +
|
||||
(9 < N) ? sizeof(TYPE9) : 0 ;
|
||||
|
||||
((0 < N) ? sizeof(TYPE0) : 0) +
|
||||
((1 < N) ? sizeof(TYPE1) : 0) +
|
||||
((2 < N) ? sizeof(TYPE2) : 0) +
|
||||
((3 < N) ? sizeof(TYPE3) : 0) +
|
||||
((4 < N) ? sizeof(TYPE4) : 0) +
|
||||
((5 < N) ? sizeof(TYPE5) : 0) +
|
||||
((6 < N) ? sizeof(TYPE6) : 0) +
|
||||
((7 < N) ? sizeof(TYPE7) : 0) +
|
||||
((8 < N) ? sizeof(TYPE8) : 0) +
|
||||
((9 < N) ? sizeof(TYPE9) : 0) ;
|
||||
}
|
||||
|
||||
inline void* set(column_number_t col, void* val) {
|
||||
|
|
Loading…
Reference in a new issue