Update of /cvsroot/mod-c/ehtml/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv12035/src
Modified Files:
Makefile.am
Added Files:
Profiling.cpp
Log Message:
* Code reordering & added C function for accessing profile statistics.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/mod-c/ehtml/src/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Makefile.am 8 Sep 2006 21:00:46 -0000 1.7
--- Makefile.am 13 Sep 2006 00:11:22 -0000 1.8
***************
*** 27,30 ****
--- 27,31 ----
EHTML_SOURCES += Page.cpp
EHTML_SOURCES += PageWriter.cpp
+ EHTML_SOURCES += Profiling.cpp
EHTML_SOURCES += Request.cpp
EHTML_SOURCES += Response.cpp
--- NEW FILE: Profiling.cpp ---
#include "Profiling.h"
#include <string.h>
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;
}
void profile_tick(void** cbdata, struct runspec* spec) {
ProfileFunction* pf = (ProfileFunction*)cbdata;
if (*cbdata != NULL) {
pf = pf->Next();
} else {
pf = ProfileFunction::Head();
}
if (pf != NULL)
memcpy(spec, pf->Spec(), sizeof(*spec));
*cbdata = pf;
}
|