-
Notifications
You must be signed in to change notification settings - Fork 16
/
nostatistics.go
47 lines (35 loc) · 1.18 KB
/
nostatistics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//go:build !antlr.stats
package antlr
// This file is compiled when the build configuration antlr.stats is not enabled.
// which then allows the compiler to optimize out all the code that is not used.
const collectStats = false
// goRunStats is a dummy struct used when build configuration antlr.stats is not enabled.
type goRunStats struct {
}
var Statistics = &goRunStats{}
func (s *goRunStats) AddJStatRec(_ *JStatRec) {
// Do nothing - compiler will optimize this out (hopefully)
}
func (s *goRunStats) CollectionAnomalies() {
// Do nothing - compiler will optimize this out (hopefully)
}
func (s *goRunStats) Reset() {
// Do nothing - compiler will optimize this out (hopefully)
}
func (s *goRunStats) Report(dir string, prefix string) error {
// Do nothing - compiler will optimize this out (hopefully)
return nil
}
func (s *goRunStats) Analyze() {
// Do nothing - compiler will optimize this out (hopefully)
}
type statsOption func(*goRunStats) error
func (s *goRunStats) Configure(options ...statsOption) error {
// Do nothing - compiler will optimize this out (hopefully)
return nil
}
func WithTopN(topN int) statsOption {
return func(s *goRunStats) error {
return nil
}
}