aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/trace.go
diff options
context:
space:
mode:
authorShenghou Ma <minux@golang.org>2015-04-23 02:43:10 -0400
committerMinux Ma <minux@golang.org>2015-05-01 07:25:49 +0000
commit5f69e739d3b01e657e27547641e8db74d2c2a862 (patch)
tree4bb111ddb126e987e1c967b8d56cca02a0a1f2fc /src/runtime/trace.go
parentffd334493c69bb39bf12ec639f33f8718bff998b (diff)
downloadgo-5f69e739d3b01e657e27547641e8db74d2c2a862.tar.xz
runtime: adjust traceTickDiv for non-x86 architectures
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>
Diffstat (limited to 'src/runtime/trace.go')
-rw-r--r--src/runtime/trace.go9
1 files changed, 7 insertions, 2 deletions
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.