From eab506949dbd5aa67b03846483b28520c0c5c46a Mon Sep 17 00:00:00 2001 From: gmega Date: Mon, 6 Nov 2023 18:42:43 -0300 Subject: [PATCH] guard metrics dump with chronosFuturesInstrumentation flag --- codex.nim | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/codex.nim b/codex.nim index 4224be31..c190592e 100644 --- a/codex.nim +++ b/codex.nim @@ -109,17 +109,17 @@ when isMainModule: notice "Stopping Codex" - let metrics = getFutureSummaryMetrics() - for (k,v) in metrics.pairs(): - let count = v.count - if count > 0: - echo "" - echo "metric: ", $k - echo "count: ", count - echo "avg execTime:\t", v.totalExecTime div count, "\ttotal: ", v.totalExecTime - echo "avg wallTime:\t", v.totalWallTime div count, "\ttotal: ", v.totalWallTime - echo "avg runTime:\t", v.totalRunTime div count, "\ttotal: ", v.totalRunTime - + when defined(chronosFuturesInstrumentation): + let metrics = getFutureSummaryMetrics() + for (k,v) in metrics.pairs(): + let count = v.count + if count > 0: + echo "" + echo "metric: ", $k + echo "count: ", count + echo "avg execTime:\t", v.totalExecTime div count, "\ttotal: ", v.totalExecTime + echo "avg wallTime:\t", v.totalWallTime div count, "\ttotal: ", v.totalWallTime + echo "avg runTime:\t", v.totalRunTime div count, "\ttotal: ", v.totalRunTime try: setControlCHook(controlCHandler)