From 470c52c9cc7999550295a5c7dad65efed6f38eea Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Mon, 27 Oct 2008 23:27:48 +0000 Subject: [PATCH] add compile time PACK_STATS option that displays statistics about the number of bytes used per column --- stasis/page/compression/staticMulticolumn.h | 36 +++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/stasis/page/compression/staticMulticolumn.h b/stasis/page/compression/staticMulticolumn.h index e3eecd3..fd0439b 100644 --- a/stasis/page/compression/staticMulticolumn.h +++ b/stasis/page/compression/staticMulticolumn.h @@ -62,6 +62,13 @@ */ namespace rose { + //#define PACK_STATS +#ifdef PACK_STATS + static unsigned long long pack_exceptionBytes = 0; + static unsigned long long pack_colBytes[20]; + static unsigned long long pack_pageCount = 0; + static int pack_first = 1; +#endif /** * A "pageLoaded()" callback function for Stasis' buffer manager. @@ -430,16 +437,42 @@ class StaticMulticolumn { return 0; } } + inline void pack() { +#ifdef PACK_STATS + if(pack_first) { + pack_exceptionBytes = 0; + pack_pageCount = 0; + for(int i = 0; i < N; i++) { + pack_colBytes[i] = 0; + } + pack_first = 0; + } +#define updateColStats(i, comp) \ + pack_colBytes[i] += comp->bytes_used() +#else +#define updateColStats(i, comp) +#endif byte_off_t first_free = 0; byte_off_t last_free = (intptr_t)(first_header_byte_ptr() - p_->memAddr); if(unpacked_) { *exceptions_len_ptr() = last_free - first_exception_byte_; last_free -= *exceptions_len_ptr(); *exceptions_offset_ptr() = last_free; - +#ifdef PACK_STATS + pack_pageCount++; + pack_exceptionBytes += *exceptions_len_ptr(); + if(0 == ((pack_pageCount+1) % 1000)) { + printf("%lld pages; %lld exception bytes cols: {", pack_pageCount, pack_exceptionBytes); + for(int i = 0; i < N; i++) { + printf("%lld, ", pack_colBytes[i]); + } + printf("}\n"); + } +#endif #define STATIC_MC_PACK(i,comp) \ if(i < N) { \ + updateColStats(i,comp); \ *column_offset_ptr(i) = first_free; \ byte_off_t bytes_used = comp->bytes_used(); \ memcpy(column_base_ptr(i), columns_[i], bytes_used); \ @@ -671,5 +704,4 @@ page_impl StaticMulticolumn