--- parser3/src/include/pa_pool.h 2001/10/29 13:04:46 1.68 +++ parser3/src/include/pa_pool.h 2001/12/14 12:53:47 1.72 @@ -3,9 +3,9 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) + Author: Alexander Petrosyan (http://paf.design.ru) - $Id: pa_pool.h,v 1.68 2001/10/29 13:04:46 paf Exp $ + $Id: pa_pool.h,v 1.72 2001/12/14 12:53:47 paf Exp $ */ #ifndef PA_POOL_H @@ -37,12 +37,14 @@ public: Pool(void *astorage); ~Pool(); + ///{@ statistics + size_t total_allocated() { return ftotal_allocated; } + unsigned int total_times() { return ftotal_times; } + ///}@ + void set_context(void *acontext) { fcontext=acontext; } void *get_context() { return fcontext; } - void set_tag(void *atag) { ftag=atag; } - void *tag() { return ftag; } - /// allocates some bytes on pool void *malloc(size_t size, int place=0) { return check(real_malloc(size, place), size); @@ -67,7 +69,6 @@ private: void *fstorage; void *fcontext; - void *ftag; const String *charset; private: @@ -83,8 +84,11 @@ private: /// checks whether mem allocated OK. throws exception otherwise void *check(void *ptr, size_t size) { - if(ptr) + if(ptr) { + ftotal_allocated+=size; + ftotal_times++; return ptr; + } fail_alloc(size); @@ -111,7 +115,6 @@ public: private: - void set_charset(const char *new_scharset); void update_transcoder(); private: @@ -120,6 +123,11 @@ private: #endif +private: // statistics + + size_t ftotal_allocated; + unsigned int ftotal_times; + private: //disabled Pool(const Pool&);