From: Shenghou Ma Date: Thu, 23 Apr 2015 06:43:10 +0000 (-0400) Subject: runtime: adjust traceTickDiv for non-x86 architectures X-Git-Tag: go1.5beta1~794 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5f69e739d3b01e657e27547641e8db74d2c2a862;p=gostls13.git runtime: adjust traceTickDiv for non-x86 architectures Fixes #10554. Fixes #10623. Change-Id: I90fbaa34e3d55c8758178f8d2e7fa41ff1194a1b Signed-off-by: Shenghou Ma Reviewed-on: https://go-review.googlesource.com/9247 Reviewed-by: Dmitry Vyukov Reviewed-by: Dave Cheney --- diff --git a/src/runtime/trace.go b/src/runtime/trace.go index e0eb7d82ce..3b7501b9b4 100644 --- a/src/runtime/trace.go +++ b/src/runtime/trace.go @@ -60,8 +60,13 @@ const ( // Timestamps in trace are cputicks/traceTickDiv. // This makes absolute values of timestamp diffs smaller, // and so they are encoded in less number of bytes. - // 64 is somewhat arbitrary (one tick is ~20ns on a 3GHz machine). - traceTickDiv = 64 + // 64 on x86 is somewhat arbitrary (one tick is ~20ns on a 3GHz machine). + // The suggested increment frequency for PowerPC's time base register is + // 512 MHz according to Power ISA v2.07 section 6.2, so we use 16 on ppc64 + // and ppc64le. + // Tracing won't work reliably for architectures where cputicks is emulated + // by nanotime, so the value doesn't matter for those architectures. + traceTickDiv = 16 + 48*(goarch_386|goarch_amd64|goarch_amd64p32) // Maximum number of PCs in a single stack trace. // Since events contain only stack id rather than whole stack trace, // we can allow quite large values here.