Skip to content

Commit 5f69e73

Browse files
committed
runtime: adjust traceTickDiv for non-x86 architectures
Fixes #10554. Fixes #10623. Change-Id: I90fbaa34e3d55c8758178f8d2e7fa41ff1194a1b Signed-off-by: Shenghou Ma <[email protected]> Reviewed-on: https://go-review.googlesource.com/9247 Reviewed-by: Dmitry Vyukov <[email protected]> Reviewed-by: Dave Cheney <[email protected]>
1 parent ffd3344 commit 5f69e73

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/runtime/trace.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,13 @@ const (
6060
// Timestamps in trace are cputicks/traceTickDiv.
6161
// This makes absolute values of timestamp diffs smaller,
6262
// and so they are encoded in less number of bytes.
63-
// 64 is somewhat arbitrary (one tick is ~20ns on a 3GHz machine).
64-
traceTickDiv = 64
63+
// 64 on x86 is somewhat arbitrary (one tick is ~20ns on a 3GHz machine).
64+
// The suggested increment frequency for PowerPC's time base register is
65+
// 512 MHz according to Power ISA v2.07 section 6.2, so we use 16 on ppc64
66+
// and ppc64le.
67+
// Tracing won't work reliably for architectures where cputicks is emulated
68+
// by nanotime, so the value doesn't matter for those architectures.
69+
traceTickDiv = 16 + 48*(goarch_386|goarch_amd64|goarch_amd64p32)
6570
// Maximum number of PCs in a single stack trace.
6671
// Since events contain only stack id rather than whole stack trace,
6772
// we can allow quite large values here.

0 commit comments

Comments
 (0)