diff --git a/docker/asyncloop.nim b/docker/asyncloop.nim index 957a266c..71171a03 100644 --- a/docker/asyncloop.nim +++ b/docker/asyncloop.nim @@ -23,6 +23,8 @@ when defined(chronosDurationThreshold): import pkg/metrics declareGauge(chronosCallbackDuration, "chronos callback duration") + declareGauge(chronosConstant, "chronos constant") + declareCounter(chronosCallbackCounter, "chronos callback counter") export Port, SocketFlag export timer @@ -226,9 +228,6 @@ type const chronosDurationThreshold {.intdefine.} = 0 template newAsyncCallback*(cbFunc: CallbackFunc, udataPtr: pointer = nil): AsyncCallback = - # when defined(chronosDurationThreshold): - # AsyncCallback(function: cbFunc, udata: udataPtr, location: getStackTrace()) - # else: AsyncCallback(function: cbFunc, udata: udataPtr) when defined(chronosDurationThreshold): @@ -337,7 +336,10 @@ template processCallbacks(loop: untyped) = durationNs = getMonoTime().ticks - startTime durationUs = durationNs div 1000 - chronosCallbackDuration.set(durationUs.int64) + chronosCallbackDuration.set(durationNs) + chronosConstant.set(123) + chronosCallbackCounter.inc() + if durationUs > chronosDurationThreshold: # callable.location*: array[2, ptr SrcLoc] diff --git a/docker/srcloc.nim b/docker/srcloc.nim index 321c9e7f..6edaefb5 100644 --- a/docker/srcloc.nim +++ b/docker/srcloc.nim @@ -17,7 +17,6 @@ type procedure*: cstring file*: cstring line*: int - trace*: cstring proc `$`*(loc: ptr SrcLoc): string = var res = $loc.file @@ -29,15 +28,12 @@ proc `$`*(loc: ptr SrcLoc): string = res.add("[unspecified]") else: res.add($loc.procedure) - res.add("[") - res.add($loc.trace) - res.add("]") res proc srcLocImpl(procedure: static string, file: static string, line: static int): ptr SrcLoc = var loc {.global.} = SrcLoc( - file: cstring(file), line: line, procedure: procedure, trace: "a" + file: cstring(file), line: line, procedure: procedure ) return addr(loc)