From: Gonzalo A. <ga...@us...> - 2006-09-13 14:59:56
|
Update of /cvsroot/mod-c/ehtml/include In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv27640/include Modified Files: Profiling.h Log Message: * Added the 'self' column, removed 'overflows' and 'depth' columns. Index: Profiling.h =================================================================== RCS file: /cvsroot/mod-c/ehtml/include/Profiling.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Profiling.h 13 Sep 2006 13:57:06 -0000 1.5 --- Profiling.h 13 Sep 2006 14:59:50 -0000 1.6 *************** *** 5,15 **** #include <stdint.h> typedef int64_t hrtime_t; struct runspec { hrtime_t accum; int64_t ncalls; - int overflows; - int depth; const char* name; const char* file; --- 5,16 ---- #include <stdint.h> + #define MAX_DEPTH 512 + typedef int64_t hrtime_t; struct runspec { hrtime_t accum; + hrtime_t self; int64_t ncalls; const char* name; const char* file; *************** *** 57,71 **** hrtime_t _started; ProfileFunction* _f; public: ! ProfileRun(ProfileFunction* f): _started(get_tick()), _f(f) { ; } ! ~ProfileRun() { ! hrtime_t now = get_tick(); ! if (now < _started) { ! ++_f->spec.overflows; ! return; ! } ! _f->spec.accum += now - _started; ! ++_f->spec.ncalls; } }; --- 58,68 ---- hrtime_t _started; ProfileFunction* _f; + static int depth; + static ProfileFunction* call_stack[MAX_DEPTH]; public: ! ProfileRun(ProfileFunction* f): _started(get_tick()), _f(f) { ! call_stack[depth++] = f; } + ~ProfileRun(); }; *************** *** 97,102 **** * struct runspec spec; * while (profile_tick(&cb, &spec), cb != NULL) { ! * printf("%20llu %20lld %11d %11d %s/%s:%d\n", ! * spec.accum, spec.ncalls, spec.overflows, spec.depth, * spec.name, spec.file, spec.line); * } --- 94,99 ---- * struct runspec spec; * while (profile_tick(&cb, &spec), cb != NULL) { ! * printf("%20llu %20lld %s/%s:%d\n", ! * spec.accum, spec.ncalls, * spec.name, spec.file, spec.line); * } |