Changed nimprof.hook() to handle uninitialized t0
It's unlikely, but possible for the conversion to nanoseconds to overflow if QueryPerformanceCounter() returns a large enough timestamp. This change avoids that, at the cost of always taking a sample the first time through when t0 == 0.
This commit is contained in:
parent
2abf3b717a
commit
c41e0bdbe3
1 changed files with 1 additions and 1 deletions
|
|
@ -132,7 +132,7 @@ else:
|
||||||
proc hook(st: TStackTrace) {.nimcall.} =
|
proc hook(st: TStackTrace) {.nimcall.} =
|
||||||
if interval == 0:
|
if interval == 0:
|
||||||
hookAux(st, 1)
|
hookAux(st, 1)
|
||||||
elif getTicks() - t0 > interval:
|
elif int64(t0) == 0 or getTicks() - t0 > interval:
|
||||||
hookAux(st, 1)
|
hookAux(st, 1)
|
||||||
t0 = getTicks()
|
t0 = getTicks()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue