Skip to content

Commit 6372b98

Browse files
committed
pstats, xstats: print methods, pointer receiver
benchmarks: same timings/allocations
1 parent c3ce9f8 commit 6372b98

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func parseWithOpts(inputs <-chan string, name string, opts []Option) (*Prog, err
100100
prog.disasm()
101101
}
102102
if cf.stats {
103-
printPStats(cf.output, pstats)
103+
pstats.print(cf.output)
104104
}
105105
return prog, err
106106
}
@@ -122,7 +122,7 @@ func Execute(prog *Prog, opts ...Option) (result []Block, binding Binding, err e
122122

123123
result, binding, xstats, err := execute(prog, vmConfig{cf.trace})
124124
if cf.stats {
125-
printXStats(cf.output, xstats)
125+
xstats.print(cf.output)
126126
}
127127
return result, binding, err
128128
}

util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type writers struct {
2020
outw, logw io.Writer
2121
}
2222

23-
func printPStats(w io.Writer, pstats parseStats) {
23+
func (pstats *parseStats) print(w io.Writer) {
2424
fmt.Fprintf(w, "pstats.tokens: %5d\n", pstats.tokens)
2525
fmt.Fprintf(w, "pstats.localMax: %5d\n", pstats.localMax)
2626
fmt.Fprintf(w, "pstats.depthMax: %5d\n", pstats.depthMax)
@@ -29,7 +29,7 @@ func printPStats(w io.Writer, pstats parseStats) {
2929
fmt.Fprintf(w, "pstats.codeBytes: %5d\n", pstats.codeBytes)
3030
}
3131

32-
func printXStats(w io.Writer, xstats execStats) {
32+
func (xstats *execStats) print(w io.Writer) {
3333
fmt.Fprintf(w, "xstats.tosMax: %5d\n", xstats.tosMax)
3434
fmt.Fprintf(w, "xstats.blockTosMax:%5d\n", xstats.blockTosMax)
3535
fmt.Fprintf(w, "xstats.opsRead: %5d\n", xstats.opsRead)

0 commit comments

Comments
 (0)