[t:4128], change toku_bnc_memory_size to report number of bytes used in buffer

git-svn-id: file:///svn/toku/tokudb@36828 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Zardosht Kasheff 2013-04-16 23:59:55 -04:00 committed by Yoni Fogel
parent ef4a11714a
commit 45a5598389
3 changed files with 8 additions and 2 deletions

View file

@ -494,7 +494,7 @@ long
toku_bnc_memory_size(NONLEAF_CHILDINFO bnc)
{
return (sizeof(*bnc) +
toku_fifo_memory_size(bnc->buffer) +
toku_fifo_memory_size_in_use(bnc->buffer) +
toku_omt_memory_size(bnc->fresh_message_tree) +
toku_omt_memory_size(bnc->stale_message_tree) +
toku_omt_memory_size(bnc->broadcast_list));

View file

@ -204,6 +204,10 @@ void toku_fifo_size_is_stabilized(FIFO fifo) {
}
}
unsigned long toku_fifo_memory_size_in_use(FIFO fifo) {
return sizeof(*fifo)+fifo->memory_start+fifo->memory_used;
}
unsigned long toku_fifo_memory_size(FIFO fifo) {
return sizeof(*fifo)+fifo->memory_size;
}

View file

@ -56,7 +56,9 @@ int toku_fifo_deq(FIFO); // we cannot deq items anymore, since their offsets ar
// THIS ONLY REMAINS FOR TESTING, DO NOT USE IT IN CODE
int toku_fifo_empty(FIFO); // don't deallocate the memory for the fifo
unsigned long toku_fifo_memory_size(FIFO); // return how much memory the fifo uses.
unsigned long toku_fifo_memory_size_in_use(FIFO fifo); // return how much memory the fifo uses.
unsigned long toku_fifo_memory_size(FIFO); // return how much memory fifo has allocated
//These two are problematic, since I don't want to malloc() the bytevecs, but dequeueing the fifo frees the memory.
//int toku_fifo_peek_deq (FIFO, bytevec *key, ITEMLEN *keylen, bytevec *data, ITEMLEN *datalen, u_int32_t *type, TXNID *xid);