Index: generic/nsfProfile.c =================================================================== diff -u -rcaba76f5ac2943f5a3dfd33550cb578132f40c80 -r92ab630ebd3c1b907e3d0fdf97cc07914245c028 --- generic/nsfProfile.c (.../nsfProfile.c) (revision caba76f5ac2943f5a3dfd33550cb578132f40c80) +++ generic/nsfProfile.c (.../nsfProfile.c) (revision 92ab630ebd3c1b907e3d0fdf97cc07914245c028) @@ -49,12 +49,17 @@ * *---------------------------------------------------------------------- */ +static void NsfProfileFillTable(Tcl_HashTable *table, char *keyStr, double totalMicroSec) nonnull(1) nonnull(2); + static void NsfProfileFillTable(Tcl_HashTable *table, char *keyStr, double totalMicroSec) { NsfProfileData *value; Tcl_HashEntry *hPtr; int isNew; + assert(table); + assert(keyStr); + hPtr = Tcl_CreateHashEntry(table, keyStr, &isNew); if (isNew) { value = (NsfProfileData *)ckalloc(sizeof(NsfProfileData)); @@ -95,6 +100,9 @@ NsfProfile *profile = &RUNTIME_STATE(interp)->profile; struct timeval trt; + assert(interp); + assert(cscPtr); + gettimeofday(&trt, NULL); totalMicroSec = (trt.tv_sec - cscPtr->startSec) * 1000000 + (trt.tv_usec - cscPtr->startUsec); @@ -168,6 +176,9 @@ double totalMicroSec; struct timeval trt; + assert(interp); + assert(methodName); + gettimeofday(&trt, NULL); totalMicroSec = (trt.tv_sec - startSec) * 1000000 + (trt.tv_usec - startUsec); @@ -191,12 +202,16 @@ *---------------------------------------------------------------------- */ + +static void NsfProfileClearTable(Tcl_HashTable *table) nonnull(1); + static void NsfProfileClearTable(Tcl_HashTable *table) { Tcl_HashSearch hSrch; Tcl_HashEntry *hPtr; assert(table); + for (hPtr = Tcl_FirstHashEntry(table, &hSrch); hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { NsfProfileData *value = (NsfProfileData *) Tcl_GetHashValue(hPtr); @@ -220,11 +235,14 @@ * *---------------------------------------------------------------------- */ + void NsfProfileClearData(Tcl_Interp *interp) { NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; struct timeval trt; + assert(interp); + NsfProfileClearTable(&profilePtr->objectData); NsfProfileClearTable(&profilePtr->methodData); NsfProfileClearTable(&profilePtr->procData); @@ -250,13 +268,17 @@ * *---------------------------------------------------------------------- */ +static Tcl_Obj* NsfProfileGetTable(Tcl_Interp *interp, Tcl_HashTable *table) nonnull(1) nonnull(2); + static Tcl_Obj* NsfProfileGetTable(Tcl_Interp *interp, Tcl_HashTable *table) { Tcl_Obj *list = Tcl_NewListObj(0, NULL); Tcl_HashSearch hSrch; Tcl_HashEntry *hPtr; + assert(interp); assert(table); + for (hPtr = Tcl_FirstHashEntry(table, &hSrch); hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { NsfProfileData *value = (NsfProfileData *) Tcl_GetHashValue(hPtr); @@ -288,13 +310,16 @@ * *---------------------------------------------------------------------- */ + void NsfProfileGetData(Tcl_Interp *interp) { Tcl_Obj *list = Tcl_NewListObj(0, NULL); NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; long totalMicroSec; struct timeval trt; + assert(interp); + gettimeofday(&trt, NULL); totalMicroSec = (trt.tv_sec - profilePtr->startSec) * 1000000 + (trt.tv_usec - profilePtr->startUSec); @@ -328,6 +353,8 @@ NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; struct timeval trt; + assert(interp); + Tcl_InitHashTable(&profilePtr->objectData, TCL_STRING_KEYS); Tcl_InitHashTable(&profilePtr->methodData, TCL_STRING_KEYS); Tcl_InitHashTable(&profilePtr->procData, TCL_STRING_KEYS); @@ -357,6 +384,8 @@ NsfProfileFree(Tcl_Interp *interp) { NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; + assert(interp); + NsfProfileClearData(interp); Tcl_DeleteHashTable(&profilePtr->objectData); Tcl_DeleteHashTable(&profilePtr->methodData);