]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: adjust traceTickDiv for non-x86 architectures
authorShenghou Ma <minux@golang.org>
Thu, 23 Apr 2015 06:43:10 +0000 (02:43 -0400)
committerMinux Ma <minux@golang.org>
Fri, 1 May 2015 07:25:49 +0000 (07:25 +0000)
Fixes #10554.
Fixes #10623.

Change-Id: I90fbaa34e3d55c8758178f8d2e7fa41ff1194a1b
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/9247
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
src/runtime/trace.go

index e0eb7d82cef3127b55816ed50b99b7321fc63c84..3b7501b9b43e44b95b933fd6b6f596dcd4332399 100644 (file)
@@ -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.