diff options
author | hobbs <hobbs> | 2001-11-21 02:36:18 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2001-11-21 02:36:18 (GMT) |
commit | cff9c3309b2e3c096c301a94bff0d9804be13520 (patch) | |
tree | d6c9734d5b8944f4d96bc77057fc560b661f57c4 /generic/tclTest.c | |
parent | f59ffab94e11d0dc9efd7189ec5c64e904cdfedd (diff) | |
download | tcl-cff9c3309b2e3c096c301a94bff0d9804be13520.zip tcl-cff9c3309b2e3c096c301a94bff0d9804be13520.tar.gz tcl-cff9c3309b2e3c096c301a94bff0d9804be13520.tar.bz2 |
added TIP#73 patch #483500 from Kevin Kenny.
This deprecates TclpGetTime in favor of new Tcl_GetTime.
Diffstat (limited to 'generic/tclTest.c')
-rw-r--r-- | generic/tclTest.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c index 995ed27..ca41034 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTest.c,v 1.32 2001/09/28 01:21:53 dgp Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.33 2001/11/21 02:36:20 hobbs Exp $ */ #define TCL_TEST @@ -3627,54 +3627,54 @@ GetTimesCmd(unused, interp, argc, argv) /* alloc & free 100000 times */ fprintf(stderr, "alloc & free 100000 6 word items\n"); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { objPtr = (Tcl_Obj *) ckalloc(sizeof(Tcl_Obj)); ckfree((char *) objPtr); } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per alloc+free\n", timePer/100000); /* alloc 5000 times */ fprintf(stderr, "alloc 5000 6 word items\n"); objv = (Tcl_Obj **) ckalloc(5000 * sizeof(Tcl_Obj *)); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 5000; i++) { objv[i] = (Tcl_Obj *) ckalloc(sizeof(Tcl_Obj)); } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per alloc\n", timePer/5000); /* free 5000 times */ fprintf(stderr, "free 5000 6 word items\n"); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 5000; i++) { ckfree((char *) objv[i]); } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per free\n", timePer/5000); /* Tcl_NewObj 5000 times */ fprintf(stderr, "Tcl_NewObj 5000 times\n"); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 5000; i++) { objv[i] = Tcl_NewObj(); } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per Tcl_NewObj\n", timePer/5000); /* Tcl_DecrRefCount 5000 times */ fprintf(stderr, "Tcl_DecrRefCount 5000 times\n"); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 5000; i++) { objPtr = objv[i]; Tcl_DecrRefCount(objPtr); } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per Tcl_DecrRefCount\n", timePer/5000); ckfree((char *) objv); @@ -3682,24 +3682,24 @@ GetTimesCmd(unused, interp, argc, argv) /* TclGetString 100000 times */ fprintf(stderr, "TclGetStringFromObj of \"12345\" 100000 times\n"); objPtr = Tcl_NewStringObj("12345", -1); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { (void) TclGetString(objPtr); } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per TclGetStringFromObj of \"12345\"\n", timePer/100000); /* Tcl_GetIntFromObj 100000 times */ fprintf(stderr, "Tcl_GetIntFromObj of \"12345\" 100000 times\n"); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { if (Tcl_GetIntFromObj(interp, objPtr, &n) != TCL_OK) { return TCL_ERROR; } } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per Tcl_GetIntFromObj of \"12345\"\n", timePer/100000); @@ -3707,63 +3707,63 @@ GetTimesCmd(unused, interp, argc, argv) /* Tcl_GetInt 100000 times */ fprintf(stderr, "Tcl_GetInt of \"12345\" 100000 times\n"); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { if (Tcl_GetInt(interp, "12345", &n) != TCL_OK) { return TCL_ERROR; } } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per Tcl_GetInt of \"12345\"\n", timePer/100000); /* sprintf 100000 times */ fprintf(stderr, "sprintf of 12345 100000 times\n"); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { sprintf(newString, "%d", 12345); } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per sprintf of 12345\n", timePer/100000); /* hashtable lookup 100000 times */ fprintf(stderr, "hashtable lookup of \"gettimes\" 100000 times\n"); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { (void) Tcl_FindHashEntry(&iPtr->globalNsPtr->cmdTable, "gettimes"); } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per hashtable lookup of \"gettimes\"\n", timePer/100000); /* Tcl_SetVar 100000 times */ fprintf(stderr, "Tcl_SetVar of \"12345\" 100000 times\n"); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { s = Tcl_SetVar(interp, "a", "12345", TCL_LEAVE_ERR_MSG); if (s == NULL) { return TCL_ERROR; } } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per Tcl_SetVar of a to \"12345\"\n", timePer/100000); /* Tcl_GetVar 100000 times */ fprintf(stderr, "Tcl_GetVar of a==\"12345\" 100000 times\n"); - TclpGetTime(&start); + Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { s = Tcl_GetVar(interp, "a", TCL_LEAVE_ERR_MSG); if (s == NULL) { return TCL_ERROR; } } - TclpGetTime(&stop); + Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); fprintf(stderr, " %.3f usec per Tcl_GetVar of a==\"12345\"\n", timePer/100000); |