From: Gonzalo A. <ga...@us...> - 2006-09-13 15:00:06
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv27640/src Modified Files: Profiling.cpp Log Message: * Added the 'self' column, removed 'overflows' and 'depth' columns. Index: Profiling.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Profiling.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Profiling.cpp 13 Sep 2006 13:09:48 -0000 1.2 --- Profiling.cpp 13 Sep 2006 14:59:50 -0000 1.3 *************** *** 5,30 **** ProfileFunction* ProfileFunction::_head = NULL; ProfileFunction::ProfileFunction(const char* name, const char* file, int line) { ! spec.accum = 0; ! spec.ncalls = 0; ! spec.overflows = spec.depth = 0; ! spec.name = name; ! spec.file = file; ! spec.line = line; ! _next = _head; ! _prev = NULL; ! if (_next) ! _next->_prev = this; ! _head = this; } ProfileFunction::~ProfileFunction() { ! if (_next) ! _next->_prev = _prev; ! if (_prev) ! _prev->_next = _next; ! else ! _head = _next; } --- 5,40 ---- ProfileFunction* ProfileFunction::_head = NULL; + int ProfileRun::depth = 0; + ProfileFunction* ProfileRun::call_stack[MAX_DEPTH] = { NULL, }; + + ProfileRun::~ProfileRun() { + hrtime_t diff = get_tick() - _started; + _f->spec.accum += diff; + _f->spec.self += diff; + if (depth) + call_stack[--depth]->spec.self -= diff; + ++_f->spec.ncalls; + } ProfileFunction::ProfileFunction(const char* name, const char* file, int line) { ! spec.accum = 0; ! spec.ncalls = 0; ! spec.name = name; ! spec.file = file; ! spec.line = line; ! _next = _head; ! _prev = NULL; ! if (_next) ! _next->_prev = this; ! _head = this; } ProfileFunction::~ProfileFunction() { ! if (_next) ! _next->_prev = _prev; ! if (_prev) ! _prev->_next = _next; ! else ! _head = _next; } |