mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
internal/trace: fix int overflow in timestamps
Fixes #15102 Change-Id: I7fdb6464afd0b7af9b6652051416f0fddd34dc9a Reviewed-on: https://go-review.googlesource.com/21730 Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
b6cd6d7d32
commit
944a0859b9
2 changed files with 55 additions and 1 deletions
|
|
@ -372,8 +372,10 @@ func parseEvents(ver int, rawEvents []rawEvent, strings map[uint64]string) (even
|
|||
return
|
||||
}
|
||||
minTs := events[0].Ts
|
||||
// Use floating point to avoid integer overflows.
|
||||
freq := 1e9 / float64(ticksPerSec)
|
||||
for _, ev := range events {
|
||||
ev.Ts = (ev.Ts - minTs) * 1e9 / ticksPerSec
|
||||
ev.Ts = int64(float64(ev.Ts-minTs) * freq)
|
||||
// Move timers and syscalls to separate fake Ps.
|
||||
if timerGoid != 0 && ev.G == timerGoid && ev.Type == EvGoUnblock {
|
||||
ev.P = TimerP
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue