Skip to content

Commit 42883e0

Browse files
committed
timerate: append estimated net execution time (in nett-ms) to output (without estimated time of whole overhead)
1 parent d6d3cb9 commit 42883e0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

generic/tclCmdMZ.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4278,6 +4278,7 @@ Tcl_TimeRateObjCmd(
42784278
if (!calibrate) {
42794279
/* minimize influence of measurement overhead */
42804280
if (overhead > 0) {
4281+
/* estimate the time of overhead (microsecs) */
42814282
Tcl_WideInt curOverhead = overhead * count;
42824283
if (middle > curOverhead) {
42834284
middle -= curOverhead;
@@ -4291,7 +4292,7 @@ Tcl_TimeRateObjCmd(
42914292
measureOverhead = (double)middle / count;
42924293
}
42934294
objs[0] = Tcl_NewDoubleObj(measureOverhead);
4294-
TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#-overhead,"); /* mics */
4295+
TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#-overhead"); /* mics */
42954296
objs += 2;
42964297
}
42974298

@@ -4325,15 +4326,21 @@ Tcl_TimeRateObjCmd(
43254326
objs[4] = Tcl_NewWideIntObj((count / middle) * 1000000);
43264327
}
43274328

4329+
/* estimated net execution time (in millisecs) */
4330+
if (!calibrate) {
4331+
objs[6] = Tcl_ObjPrintf("%.3f", (double)middle / 1000);
4332+
TclNewLiteralStringObj(objs[7], "nett-ms");
4333+
}
4334+
43284335
/*
43294336
* Construct the result as a list because many programs have always parsed
43304337
* as such (extracting the first element, typically).
43314338
*/
43324339

4333-
TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#,"); /* mics/# */
4334-
TclNewLiteralStringObj(objs[3], "#,");
4340+
TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#"); /* mics/# */
4341+
TclNewLiteralStringObj(objs[3], "#");
43354342
TclNewLiteralStringObj(objs[5], "#/sec");
4336-
Tcl_SetObjResult(interp, Tcl_NewListObj((!calibrate) ? 6 : 8, objarr));
4343+
Tcl_SetObjResult(interp, Tcl_NewListObj(8, objarr));
43374344
}
43384345

43394346
done:

0 commit comments

Comments
 (0)