aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/corpus/corpus.go6
-rw-r--r--pkg/flatrpc/conn.go4
-rw-r--r--pkg/fuzzer/cover.go2
-rw-r--r--pkg/fuzzer/stats.go38
-rw-r--r--pkg/rpcserver/rpcserver.go16
-rw-r--r--pkg/stats/set.go10
-rw-r--r--pkg/stats/set_test.go24
-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
-rw-r--r--vm/vm.go2
12 files changed, 72 insertions, 72 deletions
diff --git a/pkg/corpus/corpus.go b/pkg/corpus/corpus.go
index 4ad4f6f27..af5754273 100644
--- a/pkg/corpus/corpus.go
+++ b/pkg/corpus/corpus.go
@@ -40,11 +40,11 @@ func NewMonitoredCorpus(ctx context.Context, updates chan<- NewItemEvent) *Corpu
updates: updates,
ProgramsList: &ProgramsList{},
}
- corpus.StatProgs = stats.Create("corpus", "Number of test programs in the corpus", stats.Console,
+ corpus.StatProgs = stats.New("corpus", "Number of test programs in the corpus", stats.Console,
stats.Link("/corpus"), stats.Graph("corpus"), stats.LenOf(&corpus.progs, &corpus.mu))
- corpus.StatSignal = stats.Create("signal", "Fuzzing signal in the corpus",
+ corpus.StatSignal = stats.New("signal", "Fuzzing signal in the corpus",
stats.LenOf(&corpus.signal, &corpus.mu))
- corpus.StatCover = stats.Create("coverage", "Source coverage in the corpus", stats.Console,
+ corpus.StatCover = stats.New("coverage", "Source coverage in the corpus", stats.Console,
stats.Link("/cover"), stats.Prometheus("syz_corpus_cover"), stats.LenOf(&corpus.cover, &corpus.mu))
return corpus
}
diff --git a/pkg/flatrpc/conn.go b/pkg/flatrpc/conn.go
index f3a997e1c..0658522a0 100644
--- a/pkg/flatrpc/conn.go
+++ b/pkg/flatrpc/conn.go
@@ -19,9 +19,9 @@ import (
)
var (
- statSent = stats.Create("rpc sent", "Outbound RPC traffic",
+ statSent = stats.New("rpc sent", "Outbound RPC traffic",
stats.Graph("traffic"), stats.Rate{}, stats.FormatMB)
- statRecv = stats.Create("rpc recv", "Inbound RPC traffic",
+ statRecv = stats.New("rpc recv", "Inbound RPC traffic",
stats.Graph("traffic"), stats.Rate{}, stats.FormatMB)
)
diff --git a/pkg/fuzzer/cover.go b/pkg/fuzzer/cover.go
index 4421693b1..876d2f4dc 100644
--- a/pkg/fuzzer/cover.go
+++ b/pkg/fuzzer/cover.go
@@ -19,7 +19,7 @@ type Cover struct {
func newCover() *Cover {
cover := new(Cover)
- stats.Create("max signal", "Maximum fuzzing signal (including flakes)",
+ stats.New("max signal", "Maximum fuzzing signal (including flakes)",
stats.Graph("signal"), stats.LenOf(&cover.maxSignal, &cover.mu))
return cover
}
diff --git a/pkg/fuzzer/stats.go b/pkg/fuzzer/stats.go
index db2dfd3b3..11f98f2a6 100644
--- a/pkg/fuzzer/stats.go
+++ b/pkg/fuzzer/stats.go
@@ -29,37 +29,37 @@ type Stats struct {
func newStats() Stats {
return Stats{
- statCandidates: stats.Create("candidates", "Number of candidate programs in triage queue",
+ statCandidates: stats.New("candidates", "Number of candidate programs in triage queue",
stats.Console, stats.Graph("corpus")),
- statNewInputs: stats.Create("new inputs", "Potential untriaged corpus candidates",
+ statNewInputs: stats.New("new inputs", "Potential untriaged corpus candidates",
stats.Graph("corpus")),
- statJobs: stats.Create("fuzzer jobs", "Total running fuzzer jobs", stats.NoGraph),
- statJobsTriage: stats.Create("triage jobs", "Running triage jobs", stats.StackedGraph("jobs")),
- statJobsTriageCandidate: stats.Create("candidate triage jobs", "Running candidate triage jobs",
+ statJobs: stats.New("fuzzer jobs", "Total running fuzzer jobs", stats.NoGraph),
+ statJobsTriage: stats.New("triage jobs", "Running triage jobs", stats.StackedGraph("jobs")),
+ statJobsTriageCandidate: stats.New("candidate triage jobs", "Running candidate triage jobs",
stats.StackedGraph("jobs")),
- statJobsSmash: stats.Create("smash jobs", "Running smash jobs", stats.StackedGraph("jobs")),
- statJobsFaultInjection: stats.Create("fault jobs", "Running fault injection jobs", stats.StackedGraph("jobs")),
- statJobsHints: stats.Create("hints jobs", "Running hints jobs", stats.StackedGraph("jobs")),
- statExecTime: stats.Create("prog exec time", "Test program execution time (ms)", stats.Distribution{}),
- statExecGenerate: stats.Create("exec gen", "Executions of generated programs", stats.Rate{},
+ statJobsSmash: stats.New("smash jobs", "Running smash jobs", stats.StackedGraph("jobs")),
+ statJobsFaultInjection: stats.New("fault jobs", "Running fault injection jobs", stats.StackedGraph("jobs")),
+ statJobsHints: stats.New("hints jobs", "Running hints jobs", stats.StackedGraph("jobs")),
+ statExecTime: stats.New("prog exec time", "Test program execution time (ms)", stats.Distribution{}),
+ statExecGenerate: stats.New("exec gen", "Executions of generated programs", stats.Rate{},
stats.StackedGraph("exec")),
- statExecFuzz: stats.Create("exec fuzz", "Executions of mutated programs",
+ statExecFuzz: stats.New("exec fuzz", "Executions of mutated programs",
stats.Rate{}, stats.StackedGraph("exec")),
- statExecCandidate: stats.Create("exec candidate", "Executions of candidate programs",
+ statExecCandidate: stats.New("exec candidate", "Executions of candidate programs",
stats.Rate{}, stats.StackedGraph("exec")),
- statExecTriage: stats.Create("exec triage", "Executions of corpus triage programs",
+ statExecTriage: stats.New("exec triage", "Executions of corpus triage programs",
stats.Rate{}, stats.StackedGraph("exec")),
- statExecMinimize: stats.Create("exec minimize", "Executions of programs during minimization",
+ statExecMinimize: stats.New("exec minimize", "Executions of programs during minimization",
stats.Rate{}, stats.StackedGraph("exec")),
- statExecSmash: stats.Create("exec smash", "Executions of smashed programs",
+ statExecSmash: stats.New("exec smash", "Executions of smashed programs",
stats.Rate{}, stats.StackedGraph("exec")),
- statExecFaultInject: stats.Create("exec inject", "Executions of fault injection",
+ statExecFaultInject: stats.New("exec inject", "Executions of fault injection",
stats.Rate{}, stats.StackedGraph("exec")),
- statExecHint: stats.Create("exec hints", "Executions of programs generated using hints",
+ statExecHint: stats.New("exec hints", "Executions of programs generated using hints",
stats.Rate{}, stats.StackedGraph("exec")),
- statExecSeed: stats.Create("exec seeds", "Executions of programs for hints extraction",
+ statExecSeed: stats.New("exec seeds", "Executions of programs for hints extraction",
stats.Rate{}, stats.StackedGraph("exec")),
- statExecCollide: stats.Create("exec collide", "Executions of programs in collide mode",
+ statExecCollide: stats.New("exec collide", "Executions of programs in collide mode",
stats.Rate{}, stats.StackedGraph("exec")),
}
}
diff --git a/pkg/rpcserver/rpcserver.go b/pkg/rpcserver/rpcserver.go
index 0d50695f6..0b7d566bb 100644
--- a/pkg/rpcserver/rpcserver.go
+++ b/pkg/rpcserver/rpcserver.go
@@ -144,23 +144,23 @@ func newImpl(ctx context.Context, cfg *Config, mgr Manager) (*Server, error) {
baseSource: baseSource,
execSource: queue.Retry(baseSource),
- StatExecs: stats.Create("exec total", "Total test program executions",
+ StatExecs: stats.New("exec total", "Total test program executions",
stats.Console, stats.Rate{}, stats.Prometheus("syz_exec_total")),
- StatNumFuzzing: stats.Create("fuzzing VMs", "Number of VMs that are currently fuzzing",
+ StatNumFuzzing: stats.New("fuzzing VMs", "Number of VMs that are currently fuzzing",
stats.Console, stats.Link("/vms")),
- statVMRestarts: stats.Create("vm restarts", "Total number of VM starts",
+ statVMRestarts: stats.New("vm restarts", "Total number of VM starts",
stats.Rate{}, stats.NoGraph),
runnerStats: &runnerStats{
- statExecRetries: stats.Create("exec retries",
+ statExecRetries: stats.New("exec retries",
"Number of times a test program was restarted because the first run failed",
stats.Rate{}, stats.Graph("executor")),
- statExecutorRestarts: stats.Create("executor restarts",
+ statExecutorRestarts: stats.New("executor restarts",
"Number of times executor process was restarted", stats.Rate{}, stats.Graph("executor")),
- statExecBufferTooSmall: stats.Create("buffer too small",
+ statExecBufferTooSmall: stats.New("buffer too small",
"Program serialization overflowed exec buffer", stats.NoGraph),
- statNoExecRequests: stats.Create("no exec requests",
+ statNoExecRequests: stats.New("no exec requests",
"Number of times fuzzer was stalled with no exec requests", stats.Rate{}),
- statNoExecDuration: stats.Create("no exec duration",
+ statNoExecDuration: stats.New("no exec duration",
"Total duration fuzzer was stalled with no exec requests (ns/sec)", stats.Rate{}),
},
}
diff --git a/pkg/stats/set.go b/pkg/stats/set.go
index b15a8eecb..7e4804280 100644
--- a/pkg/stats/set.go
+++ b/pkg/stats/set.go
@@ -23,10 +23,10 @@ import (
//
// Simple uses of metrics:
//
-// statFoo := stats.Create("metric name", "metric description")
+// statFoo := stats.New("metric name", "metric description")
// statFoo.Add(1)
//
-// stats.Create("metric name", "metric description", LenOf(mySlice, rwMutex))
+// stats.New("metric name", "metric description", LenOf(mySlice, rwMutex))
//
// Metric visualization code uses Collect/RenderHTML functions to obtain values of all registered metrics.
@@ -39,8 +39,8 @@ type UI struct {
V int
}
-func Create(name, desc string, opts ...any) *Val {
- return global.Create(name, desc, opts...)
+func New(name, desc string, opts ...any) *Val {
+ return global.New(name, desc, opts...)
}
func Collect(level Level) []UI {
@@ -182,7 +182,7 @@ func FormatMB(v int, period time.Duration) string {
// Addittionally a custom 'func() int' can be passed to read the metric value from the function.
// and 'func(int, time.Duration) string' can be passed for custom formatting of the metric value.
-func (s *set) Create(name, desc string, opts ...any) *Val {
+func (s *set) New(name, desc string, opts ...any) *Val {
v := &Val{
name: name,
desc: desc,
diff --git a/pkg/stats/set_test.go b/pkg/stats/set_test.go
index 56bac54dd..862882fc2 100644
--- a/pkg/stats/set_test.go
+++ b/pkg/stats/set_test.go
@@ -20,7 +20,7 @@ func TestSet(t *testing.T) {
_, err := set.RenderHTML()
a.NoError(err)
- v0 := set.Create("v0", "desc0")
+ v0 := set.New("v0", "desc0")
a.Equal(v0.Val(), 0)
v0.Add(1)
a.Equal(v0.Val(), 1)
@@ -28,18 +28,18 @@ func TestSet(t *testing.T) {
a.Equal(v0.Val(), 2)
vv1 := 0
- v1 := set.Create("v1", "desc1", Simple, func() int { return vv1 })
+ v1 := set.New("v1", "desc1", Simple, func() int { return vv1 })
a.Equal(v1.Val(), 0)
vv1 = 11
a.Equal(v1.Val(), 11)
a.Panics(func() { v1.Add(1) })
- v2 := set.Create("v2", "desc2", Console, func(v int, period time.Duration) string {
+ v2 := set.New("v2", "desc2", Console, func(v int, period time.Duration) string {
return fmt.Sprintf("v2 %v %v", v, period)
})
v2.Add(100)
- v3 := set.Create("v3", "desc3", Link("/v3"), NoGraph, Distribution{})
+ v3 := set.New("v3", "desc3", Link("/v3"), NoGraph, Distribution{})
a.Equal(v3.Val(), 0)
v3.Add(10)
a.Equal(v3.Val(), 10)
@@ -55,13 +55,13 @@ func TestSet(t *testing.T) {
v3.Add(30)
a.Equal(v3.Val(), 24)
- v4 := set.Create("v4", "desc4", Rate{}, Graph("graph"))
+ v4 := set.New("v4", "desc4", Rate{}, Graph("graph"))
v4.Add(10)
a.Equal(v4.Val(), 10)
v4.Add(10)
a.Equal(v4.Val(), 20)
- a.Panics(func() { set.Create("v0", "desc0", float64(1)) })
+ a.Panics(func() { set.New("v0", "desc0", float64(1)) })
ui := set.Collect(All)
a.Equal(len(ui), 5)
@@ -87,7 +87,7 @@ func TestSet(t *testing.T) {
func TestSetRateFormat(t *testing.T) {
a := assert.New(t)
set := newSet(4, false)
- v := set.Create("v", "desc", Rate{})
+ v := set.New("v", "desc", Rate{})
a.Equal(set.Collect(All)[0].Value, "0 (0/hour)")
v.Add(1)
a.Equal(set.Collect(All)[0].Value, "1 (60/min)")
@@ -98,7 +98,7 @@ func TestSetRateFormat(t *testing.T) {
func TestSetHistoryCounter(t *testing.T) {
a := assert.New(t)
set := newSet(4, false)
- v := set.Create("v0", "desc0")
+ v := set.New("v0", "desc0")
set.tick()
hist := func() []float64 { return set.graphs["v0"].lines["v0"].data[:set.historyPos] }
step := func(n int) []float64 {
@@ -132,7 +132,7 @@ func TestSetHistoryCounter(t *testing.T) {
func TestSetHistoryRate(t *testing.T) {
a := assert.New(t)
set := newSet(4, false)
- v := set.Create("v0", "desc0", Rate{})
+ v := set.New("v0", "desc0", Rate{})
step := func(n int) []float64 {
v.Add(n)
set.tick()
@@ -155,7 +155,7 @@ func TestSetHistoryRate(t *testing.T) {
func TestSetHistoryDistribution(t *testing.T) {
a := assert.New(t)
set := newSet(4, false)
- v := set.Create("v0", "desc0", Distribution{})
+ v := set.New("v0", "desc0", Distribution{})
step := func(n int) [3][]float64 {
v.Add(n)
set.tick()
@@ -194,7 +194,7 @@ func TestSetStress(t *testing.T) {
for _, opt := range []any{Link(""), NoGraph, Rate{}, Distribution{}} {
opt := opt
go func() {
- v := set.Create(fmt.Sprintf("v%v", seq.Add(1)), "desc", opt)
+ v := set.New(fmt.Sprintf("v%v", seq.Add(1)), "desc", opt)
for p1 := 0; p1 < 2; p1++ {
start(func() { v.Val() })
start(func() { v.Add(rand.Intn(10000)) })
@@ -203,7 +203,7 @@ func TestSetStress(t *testing.T) {
}
go func() {
var vv atomic.Uint64
- v := set.Create(fmt.Sprintf("v%v", seq.Add(1)), "desc",
+ v := set.New(fmt.Sprintf("v%v", seq.Add(1)), "desc",
func() int { return int(vv.Load()) })
for p1 := 0; p1 < 2; p1++ {
start(func() { v.Val() })
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)
}
diff --git a/vm/vm.go b/vm/vm.go
index ca22f2be1..20cde4cd4 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -134,7 +134,7 @@ func Create(cfg *mgrconfig.Config, debug bool) (*Pool, error) {
template: cfg.WorkdirTemplate,
timeouts: cfg.Timeouts,
hostFuzzer: cfg.SysTarget.HostFuzzer,
- statOutputReceived: stats.Create("vm output", "Bytes of VM console output received",
+ statOutputReceived: stats.New("vm output", "Bytes of VM console output received",
stats.Graph("traffic"), stats.Rate{}, stats.FormatMB),
}, nil
}