diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2019-03-11 19:22:49 -0700 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2019-05-08 22:58:10 +0000 |
commit | 0047353c53cd5c5524f8978c855e982cb4ca4533 (patch) | |
tree | 63824a65a5ebf59127c8e11da3944b1adce801d6 /src/cmd/compile/internal/ssa/func.go | |
parent | 591454c44c4157af1b05ef98607b23f17b3a0bc3 (diff) | |
download | go-0047353c53cd5c5524f8978c855e982cb4ca4533.tar.gz go-0047353c53cd5c5524f8978c855e982cb4ca4533.zip |
cmd/compile: add countRule rewrite rule helper
noteRule is useful when you're trying to debug
a particular rule, or get a general sense for
how often a rule fires overall.
It is less useful if you're trying to figure
out which functions might be useful to benchmark
to ascertain the impact of a newly added rule.
Enter countRule. You use it like noteRule,
except that you get per-function summaries.
Sample output:
# runtime
(*mspan).sweep: idx1=1
evacuate_faststr: idx1=1
evacuate_fast32: idx1=1
evacuate: idx1=2
evacuate_fast64: idx1=1
sweepone: idx1=1
purgecachedstats: idx1=1
mProf_Free: idx1=1
This suggests that the map benchmarks
might be good to run for this added rule.
Change-Id: Id471c3231f1736165f2020f6979ff01c29677808
Reviewed-on: https://go-review.googlesource.com/c/go/+/167088
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/func.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/func.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/ssa/func.go b/src/cmd/compile/internal/ssa/func.go index 4f6dbff208..df8df64dd5 100644 --- a/src/cmd/compile/internal/ssa/func.go +++ b/src/cmd/compile/internal/ssa/func.go @@ -38,9 +38,10 @@ type Func struct { // Given an environment variable used for debug hash match, // what file (if any) receives the yes/no logging? logfiles map[string]writeSyncer - HTMLWriter *HTMLWriter // html writer, for debugging - DebugTest bool // default true unless $GOSSAHASH != ""; as a debugging aid, make new code conditional on this and use GOSSAHASH to binary search for failing cases - PrintOrHtmlSSA bool // true if GOSSAFUNC matches, true even if fe.Log() (spew phase results to stdout) is false. + HTMLWriter *HTMLWriter // html writer, for debugging + DebugTest bool // default true unless $GOSSAHASH != ""; as a debugging aid, make new code conditional on this and use GOSSAHASH to binary search for failing cases + PrintOrHtmlSSA bool // true if GOSSAFUNC matches, true even if fe.Log() (spew phase results to stdout) is false. + ruleMatches map[string]int // number of times countRule was called during compilation for any given string scheduled bool // Values in Blocks are in final order laidout bool // Blocks are ordered |