Index: generic/nsf.c =================================================================== diff -u -N -rab19dafcfc3d8496be14080b8803b374ef46c8fc -rdc4e227d31df104be7df072ee78f2779ff387b9e --- generic/nsf.c (.../nsf.c) (revision ab19dafcfc3d8496be14080b8803b374ef46c8fc) +++ generic/nsf.c (.../nsf.c) (revision dc4e227d31df104be7df072ee78f2779ff387b9e) @@ -16476,11 +16476,11 @@ * *---------------------------------------------------------------------- */ -static int InvokeShadowedProc(Tcl_Interp *interp, Tcl_Obj *procNameObj, Tcl_Command cmd, ParseContext *pcPtr, struct timeval *trtPtr) +static int InvokeShadowedProc(Tcl_Interp *interp, Tcl_Obj *procNameObj, Tcl_Command cmd, ParseContext *pcPtr, struct Tcl_Time *trtPtr) nonnull(1) nonnull(2) nonnull(4) nonnull(3) nonnull(4); static int -InvokeShadowedProc(Tcl_Interp *interp, Tcl_Obj *procNameObj, Tcl_Command cmd, ParseContext *pcPtr, struct timeval *trtPtr) { +InvokeShadowedProc(Tcl_Interp *interp, Tcl_Obj *procNameObj, Tcl_Command cmd, ParseContext *pcPtr, struct Tcl_Time *trtPtr) { Tcl_Obj *CONST *objv; int objc, result; const char *fullMethodName; @@ -16556,8 +16556,8 @@ Tcl_NRAddCallback(interp, ProcDispatchFinalize, (ClientData)fullMethodName, pcPtr, # if defined(NSF_PROFILE) - (ClientData)(unsigned long)trtPtr->tv_usec, - (ClientData)(unsigned long)trtPtr->tv_sec + (ClientData)(unsigned long)trtPtr->usec, + (ClientData)(unsigned long)trtPtr->sec # else NULL, NULL @@ -16570,8 +16570,8 @@ (ClientData)fullMethodName, pcPtr, # if defined(NSF_PROFILE) - (ClientData)(unsigned long)trtPtr->tv_usec, - (ClientData)(unsigned long)trtPtr->tv_sec + (ClientData)(unsigned long)trtPtr->usec, + (ClientData)(unsigned long)trtPtr->sec # else NULL, NULL @@ -16645,14 +16645,14 @@ if (likely(result == TCL_OK)) { Tcl_Command cmd = tcd->wrapperCmd; int cmdFlags; - struct timeval trt; + struct Tcl_Time trt; assert(cmd != NULL); cmdFlags = Tcl_Command_flags(cmd); #if defined(NSF_PROFILE) - gettimeofday(&trt, NULL); + Tcl_GetTime(&trt); if (RUNTIME_STATE(interp)->doTrace) { NsfProfileTraceCallAppend(interp, ObjStr(objv[0])); @@ -16662,12 +16662,12 @@ } #else if ((cmdFlags & NSF_CMD_DEBUG_METHOD) != 0) { - gettimeofday(&trt, NULL); + Tcl_GetTime(&trt); NsfProfileDebugCall(interp, NULL, NULL, ObjStr(objv[0]), objc-1, (Tcl_Obj **)objv+1); } else { - trt.tv_sec = 0; - trt.tv_usec = 0; + trt.sec = 0; + trt.usec = 0; } #endif if ((cmdFlags & NSF_CMD_DEPRECATED_METHOD) != 0) { @@ -16677,7 +16677,7 @@ result = InvokeShadowedProc(interp, tcd->procName, tcd->cmd, pcPtr, &trt); if ((cmdFlags & NSF_CMD_DEBUG_METHOD) != 0) { - NsfProfileDebugExit(interp, NULL, NULL, ObjStr(objv[0]), trt.tv_sec, trt.tv_usec); + NsfProfileDebugExit(interp, NULL, NULL, ObjStr(objv[0]), trt.sec, trt.usec); } } else { Index: generic/nsfInt.h =================================================================== diff -u -N -r433266d82cf2bb865b6294006d815b7608e78465 -rdc4e227d31df104be7df072ee78f2779ff387b9e --- generic/nsfInt.h (.../nsfInt.h) (revision 433266d82cf2bb865b6294006d815b7608e78465) +++ generic/nsfInt.h (.../nsfInt.h) (revision dc4e227d31df104be7df072ee78f2779ff387b9e) @@ -77,8 +77,6 @@ # include #endif -#include - #if __GNUC_PREREQ(2, 95) /* Use gcc branch prediction hint to minimize cost of e.g. DTrace * ENABLED checks. @@ -888,9 +886,9 @@ NsfShadowTclCommandInfo *shadowedTi; } NsfProfile; -# define NSF_PROFILE_TIME_DATA struct timeval profile_trt +# define NSF_PROFILE_TIME_DATA struct Tcl_Time profile_trt # define NSF_PROFILE_CALL(interp, object, methodName) \ - gettimeofday(&profile_trt, NULL); \ + Tcl_GetTime(&profile_trt); \ NsfProfileTraceCall(interp, object, NULL, methodName) # define NSF_PROFILE_EXIT(interp, object, methodName) \ NsfProfileTraceExit(interp, object, NULL, methodName, &profile_trt) @@ -1048,7 +1046,7 @@ EXTERN void NsfProfileTraceCall(Tcl_Interp *interp, NsfObject *object, NsfClass *cl, const char *methodName) nonnull(1) nonnull(2) nonnull(4); -EXTERN void NsfProfileTraceExit(Tcl_Interp *interp, NsfObject *object, NsfClass *cl, const char *methodName, struct timeval *trt) +EXTERN void NsfProfileTraceExit(Tcl_Interp *interp, NsfObject *object, NsfClass *cl, const char *methodName, struct Tcl_Time *trt) nonnull(1) nonnull(2) nonnull(4) nonnull(5); EXTERN void NsfProfileTraceCallAppend(Tcl_Interp *interp, const char *label) nonnull(1) nonnull(2); Index: generic/nsfProfile.c =================================================================== diff -u -N -r67efaa622731c55726f20c509a775303bb99f4ff -rdc4e227d31df104be7df072ee78f2779ff387b9e --- generic/nsfProfile.c (.../nsfProfile.c) (revision 67efaa622731c55726f20c509a775303bb99f4ff) +++ generic/nsfProfile.c (.../nsfProfile.c) (revision dc4e227d31df104be7df072ee78f2779ff387b9e) @@ -197,10 +197,10 @@ Tcl_DStringAppendElement(dsPtr, ObjStr(Tcl_GetObjResult(interp))); if (startSec != 0 || startUsec != 0) { - struct timeval trt; + struct Tcl_Time trt; - gettimeofday(&trt, NULL); - Nsf_DStringPrintf(dsPtr, " %ld ", (trt.tv_sec - startSec) * 1000000 + (trt.tv_usec - startUsec)); + Tcl_GetTime(&trt); + Nsf_DStringPrintf(dsPtr, " %ld ", (trt.sec - startSec) * 1000000 + (trt.usec - startUsec)); } else { Tcl_DStringAppend(dsPtr, " {}", 4); } @@ -313,7 +313,7 @@ Nsf_ProfileFilterObjCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { NsfShadowTclCommandInfo *ti; int result; - struct timeval start; + struct Tcl_Time start; const char *fullMethodName, *label; Tcl_DString ds; @@ -342,9 +342,9 @@ NsfProfileTraceCallAppend(interp, label); - gettimeofday(&start, NULL); + Tcl_GetTime(&start); result = Tcl_NRCallObjProc(interp, ti->proc, ti->clientData, objc, objv); - NsfProfileRecordProcData(interp, label, start.tv_sec, start.tv_usec); + NsfProfileRecordProcData(interp, label, start.sec, start.usec); if (label != fullMethodName) { Tcl_DStringFree(&ds); @@ -616,16 +616,16 @@ void NsfProfileTraceExit(Tcl_Interp *interp, NsfObject *object, NsfClass *cl, const char *methodName, - struct timeval *callTime) { + struct Tcl_Time *callTime) { NsfRuntimeState *rst = RUNTIME_STATE(interp); if (rst->doTrace) { Tcl_DString ds, traceLabel; double totalMicroSec; - struct timeval trt; + struct Tcl_Time trt; - gettimeofday(&trt, NULL); - totalMicroSec = (trt.tv_sec - callTime->tv_sec) * 1000000 + (trt.tv_usec - callTime->tv_usec); + Tcl_GetTime(&trt); + totalMicroSec = (trt.sec - callTime->sec) * 1000000 + (trt.usec - callTime->usec); Tcl_DStringInit(&ds); NsfProfileObjectLabel(&ds, object); @@ -670,16 +670,16 @@ NsfClass *cl; Tcl_DString methodKey, objectKey, methodInfo; NsfProfile *profilePtr; - struct timeval trt; + struct Tcl_Time trt; nonnull_assert(interp != NULL); nonnull_assert(cscPtr != NULL); - gettimeofday(&trt, NULL); + Tcl_GetTime(&trt); rst = RUNTIME_STATE(interp); profilePtr = &rst->profile; - totalMicroSec = (trt.tv_sec - cscPtr->startSec) * 1000000 + (trt.tv_usec - cscPtr->startUsec); + totalMicroSec = (trt.sec - cscPtr->startSec) * 1000000 + (trt.usec - cscPtr->startUsec); profilePtr->overallTime += totalMicroSec; obj = cscPtr->self; @@ -759,14 +759,14 @@ NsfRuntimeState *rst = RUNTIME_STATE(interp); NsfProfile *profilePtr = &rst->profile; double totalMicroSec; - struct timeval trt; + struct Tcl_Time trt; nonnull_assert(interp != NULL); nonnull_assert(methodName != NULL); - gettimeofday(&trt, NULL); + Tcl_GetTime(&trt); - totalMicroSec = (trt.tv_sec - startSec) * 1000000 + (trt.tv_usec - startUsec); + totalMicroSec = (trt.sec - startSec) * 1000000 + (trt.usec - startUsec); profilePtr->overallTime += totalMicroSec; if (rst->doTrace) { @@ -828,17 +828,17 @@ void NsfProfileClearData(Tcl_Interp *interp) { NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; - struct timeval trt; + struct Tcl_Time trt; nonnull_assert(interp != NULL); NsfProfileClearTable(&profilePtr->objectData); NsfProfileClearTable(&profilePtr->methodData); NsfProfileClearTable(&profilePtr->procData); - gettimeofday(&trt, NULL); - profilePtr->startSec = trt.tv_sec; - profilePtr->startUSec = trt.tv_usec; + Tcl_GetTime(&trt); + profilePtr->startSec = trt.sec; + profilePtr->startUSec = trt.usec; profilePtr->overallTime = 0; profilePtr->depth = 0; @@ -905,15 +905,15 @@ void NsfProfileGetData(Tcl_Interp *interp) { - Tcl_Obj *list = Tcl_NewListObj(0, NULL); - NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; - long totalMicroSec; - struct timeval trt; + Tcl_Obj *list = Tcl_NewListObj(0, NULL); + NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; + long totalMicroSec; + struct Tcl_Time trt; nonnull_assert(interp != NULL); - gettimeofday(&trt, NULL); - totalMicroSec = (trt.tv_sec - profilePtr->startSec) * 1000000 + (trt.tv_usec - profilePtr->startUSec); + Tcl_GetTime(&trt); + totalMicroSec = (trt.sec - profilePtr->startSec) * 1000000 + (trt.usec - profilePtr->startUSec); Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj(totalMicroSec)); Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj(profilePtr->overallTime)); @@ -944,17 +944,17 @@ void NsfProfileInit(Tcl_Interp *interp) { NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; - struct timeval trt; + struct Tcl_Time trt; nonnull_assert(interp != NULL); Tcl_InitHashTable(&profilePtr->objectData, TCL_STRING_KEYS); Tcl_InitHashTable(&profilePtr->methodData, TCL_STRING_KEYS); Tcl_InitHashTable(&profilePtr->procData, TCL_STRING_KEYS); - gettimeofday(&trt, NULL); - profilePtr->startSec = trt.tv_sec; - profilePtr->startUSec = trt.tv_usec; + Tcl_GetTime(&trt); + profilePtr->startSec = trt.sec; + profilePtr->startUSec = trt.usec; profilePtr->overallTime = 0; profilePtr->depth = 0; Tcl_DStringInit(&profilePtr->traceDs); Index: generic/nsfStack.c =================================================================== diff -u -N -r4fa580aed7f0c54c8e09ec6bb1fc1b46789334ed -rdc4e227d31df104be7df072ee78f2779ff387b9e --- generic/nsfStack.c (.../nsfStack.c) (revision 4fa580aed7f0c54c8e09ec6bb1fc1b46789334ed) +++ generic/nsfStack.c (.../nsfStack.c) (revision dc4e227d31df104be7df072ee78f2779ff387b9e) @@ -1126,17 +1126,17 @@ CscInit_(/*@notnull@*/ NsfCallStackContent *cscPtr, NsfObject *object, NsfClass *cl, Tcl_Command cmd, int frameType, unsigned int flags) { #if defined(NSF_PROFILE) - struct timeval trt; + struct Tcl_Time trt; #endif nonnull_assert(cscPtr != NULL); nonnull_assert(object != NULL); #if defined(NSF_PROFILE) - gettimeofday(&trt, NULL); + Tcl_GetTime(&trt); - cscPtr->startUsec = trt.tv_usec; - cscPtr->startSec = trt.tv_sec; + cscPtr->startUsec = trt.usec; + cscPtr->startSec = trt.sec; #endif /*