aboutsummaryrefslogtreecommitdiffstats
path: root/syz-manager
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-07-24 11:32:41 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-07-24 14:39:45 +0000
commit1f032c27c8158e44723253179928104813d45cdc (patch)
tree80845c1da6b2c62ccec9118ab68f5d75766f8485 /syz-manager
parentbea049d0b7d151ad71617c10191fbd954decb300 (diff)
pkg/stats: rename Create to New
New is more idiomatic name and is shorter (lines where stats.Create is used are usually long, so making them a bit shorter is good).
Diffstat (limited to 'syz-manager')
-rw-r--r--syz-manager/hub.go14
-rw-r--r--syz-manager/manager.go2
-rw-r--r--syz-manager/repro.go4
-rw-r--r--syz-manager/stats.go22
4 files changed, 21 insertions, 21 deletions
diff --git a/syz-manager/hub.go b/syz-manager/hub.go
index 34d061a83..216927a98 100644
--- a/syz-manager/hub.go
+++ b/syz-manager/hub.go
@@ -50,13 +50,13 @@ func (mgr *Manager) hubSyncLoop(keyGet keyGetter) {
hubReproQueue: mgr.externalReproQueue,
keyGet: keyGet,
- statSendProgAdd: stats.Create("hub send prog add", "", stats.Graph("hub progs")),
- statSendProgDel: stats.Create("hub send prog del", "", stats.Graph("hub progs")),
- statRecvProg: stats.Create("hub recv prog", "", stats.Graph("hub progs")),
- statRecvProgDrop: stats.Create("hub recv prog drop", "", stats.NoGraph),
- statSendRepro: stats.Create("hub send repro", "", stats.Graph("hub repros")),
- statRecvRepro: stats.Create("hub recv repro", "", stats.Graph("hub repros")),
- statRecvReproDrop: stats.Create("hub recv repro drop", "", stats.NoGraph),
+ statSendProgAdd: stats.New("hub send prog add", "", stats.Graph("hub progs")),
+ statSendProgDel: stats.New("hub send prog del", "", stats.Graph("hub progs")),
+ statRecvProg: stats.New("hub recv prog", "", stats.Graph("hub progs")),
+ statRecvProgDrop: stats.New("hub recv prog drop", "", stats.NoGraph),
+ statSendRepro: stats.New("hub send repro", "", stats.Graph("hub repros")),
+ statRecvRepro: stats.New("hub recv repro", "", stats.Graph("hub repros")),
+ statRecvReproDrop: stats.New("hub recv repro drop", "", stats.NoGraph),
}
if mgr.cfg.Reproduce && mgr.dash != nil {
// Request reproducers from hub only if there is nothing else to reproduce.
diff --git a/syz-manager/manager.go b/syz-manager/manager.go
index d3e2261e9..5bb17b58d 100644
--- a/syz-manager/manager.go
+++ b/syz-manager/manager.go
@@ -1329,7 +1329,7 @@ func (mgr *Manager) MachineChecked(features flatrpc.Feature, enabledSyscalls map
mgr.enabledFeatures = features
mgr.targetEnabledSyscalls = enabledSyscalls
mgr.firstConnect.Store(time.Now().Unix())
- statSyscalls := stats.Create("syscalls", "Number of enabled syscalls",
+ statSyscalls := stats.New("syscalls", "Number of enabled syscalls",
stats.Simple, stats.NoGraph, stats.Link("/syscalls"))
statSyscalls.Add(len(enabledSyscalls))
corpus := mgr.loadCorpus()
diff --git a/syz-manager/repro.go b/syz-manager/repro.go
index 3e2b2a315..e03eaeb73 100644
--- a/syz-manager/repro.go
+++ b/syz-manager/repro.go
@@ -49,13 +49,13 @@ func newReproManager(mgr reproManagerView, reproVMs int, onlyOnce bool) *reproMa
pingQueue: make(chan struct{}, 1),
attempted: map[string]bool{},
}
- ret.statNumReproducing = stats.Create("reproducing", "Number of crashes being reproduced",
+ ret.statNumReproducing = stats.New("reproducing", "Number of crashes being reproduced",
stats.Console, stats.NoGraph, func() int {
ret.mu.Lock()
defer ret.mu.Unlock()
return len(ret.reproducing)
})
- ret.statPending = stats.Create("pending", "Number of pending repro tasks",
+ ret.statPending = stats.New("pending", "Number of pending repro tasks",
stats.Console, stats.NoGraph, func() int {
ret.mu.Lock()
defer ret.mu.Unlock()
diff --git a/syz-manager/stats.go b/syz-manager/stats.go
index dced8fc87..4fbc7d657 100644
--- a/syz-manager/stats.go
+++ b/syz-manager/stats.go
@@ -23,15 +23,15 @@ type Stats struct {
}
func (mgr *Manager) initStats() {
- mgr.statCrashes = stats.Create("crashes", "Total number of VM crashes",
+ mgr.statCrashes = stats.New("crashes", "Total number of VM crashes",
stats.Simple, stats.Prometheus("syz_crash_total"))
- mgr.statCrashTypes = stats.Create("crash types", "Number of unique crashes types",
+ mgr.statCrashTypes = stats.New("crash types", "Number of unique crashes types",
stats.Simple, stats.NoGraph)
- mgr.statSuppressed = stats.Create("suppressed", "Total number of suppressed VM crashes",
+ mgr.statSuppressed = stats.New("suppressed", "Total number of suppressed VM crashes",
stats.Simple, stats.Graph("crashes"))
- mgr.statFuzzingTime = stats.Create("fuzzing", "Total fuzzing time in all VMs (seconds)",
+ mgr.statFuzzingTime = stats.New("fuzzing", "Total fuzzing time in all VMs (seconds)",
stats.NoGraph, func(v int, period time.Duration) string { return fmt.Sprintf("%v sec", v/1e9) })
- mgr.statUptime = stats.Create("uptime", "Total uptime (seconds)", stats.Simple, stats.NoGraph,
+ mgr.statUptime = stats.New("uptime", "Total uptime (seconds)", stats.Simple, stats.NoGraph,
func() int {
firstConnect := mgr.firstConnect.Load()
if firstConnect == 0 {
@@ -41,7 +41,7 @@ func (mgr *Manager) initStats() {
}, func(v int, period time.Duration) string {
return fmt.Sprintf("%v sec", v)
})
- mgr.statAvgBootTime = stats.Create("instance restart", "Average VM restart time (sec)",
+ mgr.statAvgBootTime = stats.New("instance restart", "Average VM restart time (sec)",
stats.NoGraph,
func() int {
return int(mgr.bootTime.Value().Seconds())
@@ -50,7 +50,7 @@ func (mgr *Manager) initStats() {
return fmt.Sprintf("%v sec", v)
})
- stats.Create("heap", "Process heap size (bytes)", stats.Graph("memory"),
+ stats.New("heap", "Process heap size (bytes)", stats.Graph("memory"),
func() int {
var ms runtime.MemStats
runtime.ReadMemStats(&ms)
@@ -58,7 +58,7 @@ func (mgr *Manager) initStats() {
}, func(v int, period time.Duration) string {
return fmt.Sprintf("%v MB", v>>20)
})
- stats.Create("VM", "Process VM size (bytes)", stats.Graph("memory"),
+ stats.New("VM", "Process VM size (bytes)", stats.Graph("memory"),
func() int {
var ms runtime.MemStats
runtime.ReadMemStats(&ms)
@@ -66,15 +66,15 @@ func (mgr *Manager) initStats() {
}, func(v int, period time.Duration) string {
return fmt.Sprintf("%v MB", v>>20)
})
- stats.Create("images memory", "Uncompressed images memory (bytes)", stats.Graph("memory"),
+ stats.New("images memory", "Uncompressed images memory (bytes)", stats.Graph("memory"),
func() int {
return int(image.StatMemory.Load())
}, func(v int, period time.Duration) string {
return fmt.Sprintf("%v MB", v>>20)
})
- stats.Create("uncompressed images", "Total number of uncompressed images in memory",
+ stats.New("uncompressed images", "Total number of uncompressed images in memory",
func() int {
return int(image.StatImages.Load())
})
- mgr.statCoverFiltered = stats.Create("filtered coverage", "", stats.NoGraph)
+ mgr.statCoverFiltered = stats.New("filtered coverage", "", stats.NoGraph)
}