From 49e6369fe732c0f81e5b03b36e345afbf3c79a15 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 24 Jul 2024 12:08:49 +0200 Subject: pkg/stat: rename package name to singular form Go package names should generally be singular form: https://go.dev/blog/package-names https://rakyll.org/style-packages https://groups.google.com/g/golang-nuts/c/buBwLar1gNw --- pkg/fuzzer/cover.go | 6 +-- pkg/fuzzer/fuzzer.go | 4 +- pkg/fuzzer/queue/queue.go | 4 +- pkg/fuzzer/stats.go | 104 +++++++++++++++++++++++----------------------- 4 files changed, 59 insertions(+), 59 deletions(-) (limited to 'pkg/fuzzer') diff --git a/pkg/fuzzer/cover.go b/pkg/fuzzer/cover.go index 876d2f4dc..442b4707a 100644 --- a/pkg/fuzzer/cover.go +++ b/pkg/fuzzer/cover.go @@ -7,7 +7,7 @@ import ( "sync" "github.com/google/syzkaller/pkg/signal" - "github.com/google/syzkaller/pkg/stats" + "github.com/google/syzkaller/pkg/stat" ) // Cover keeps track of the signal known to the fuzzer. @@ -19,8 +19,8 @@ type Cover struct { func newCover() *Cover { cover := new(Cover) - stats.New("max signal", "Maximum fuzzing signal (including flakes)", - stats.Graph("signal"), stats.LenOf(&cover.maxSignal, &cover.mu)) + stat.New("max signal", "Maximum fuzzing signal (including flakes)", + stat.Graph("signal"), stat.LenOf(&cover.maxSignal, &cover.mu)) return cover } diff --git a/pkg/fuzzer/fuzzer.go b/pkg/fuzzer/fuzzer.go index 7ac8cba3e..0b7af3c98 100644 --- a/pkg/fuzzer/fuzzer.go +++ b/pkg/fuzzer/fuzzer.go @@ -15,7 +15,7 @@ import ( "github.com/google/syzkaller/pkg/flatrpc" "github.com/google/syzkaller/pkg/fuzzer/queue" "github.com/google/syzkaller/pkg/signal" - "github.com/google/syzkaller/pkg/stats" + "github.com/google/syzkaller/pkg/stat" "github.com/google/syzkaller/prog" ) @@ -240,7 +240,7 @@ func (fuzzer *Fuzzer) genFuzz() *queue.Request { return req } -func (fuzzer *Fuzzer) startJob(stat *stats.Val, newJob job) { +func (fuzzer *Fuzzer) startJob(stat *stat.Val, newJob job) { fuzzer.Logf(2, "started %T", newJob) go func() { stat.Add(1) diff --git a/pkg/fuzzer/queue/queue.go b/pkg/fuzzer/queue/queue.go index 051f7205e..aadbaade8 100644 --- a/pkg/fuzzer/queue/queue.go +++ b/pkg/fuzzer/queue/queue.go @@ -14,7 +14,7 @@ import ( "github.com/google/syzkaller/pkg/flatrpc" "github.com/google/syzkaller/pkg/hash" "github.com/google/syzkaller/pkg/signal" - "github.com/google/syzkaller/pkg/stats" + "github.com/google/syzkaller/pkg/stat" "github.com/google/syzkaller/prog" ) @@ -33,7 +33,7 @@ type Request struct { ReturnOutput bool // This stat will be incremented on request completion. - Stat *stats.Val + Stat *stat.Val // Options needed by runtest. BinaryFile string // If set, it's executed instead of Prog. diff --git a/pkg/fuzzer/stats.go b/pkg/fuzzer/stats.go index 11f98f2a6..073afab29 100644 --- a/pkg/fuzzer/stats.go +++ b/pkg/fuzzer/stats.go @@ -3,63 +3,63 @@ package fuzzer -import "github.com/google/syzkaller/pkg/stats" +import "github.com/google/syzkaller/pkg/stat" type Stats struct { - statCandidates *stats.Val - statNewInputs *stats.Val - statJobs *stats.Val - statJobsTriage *stats.Val - statJobsTriageCandidate *stats.Val - statJobsSmash *stats.Val - statJobsFaultInjection *stats.Val - statJobsHints *stats.Val - statExecTime *stats.Val - statExecGenerate *stats.Val - statExecFuzz *stats.Val - statExecCandidate *stats.Val - statExecTriage *stats.Val - statExecMinimize *stats.Val - statExecSmash *stats.Val - statExecFaultInject *stats.Val - statExecHint *stats.Val - statExecSeed *stats.Val - statExecCollide *stats.Val + statCandidates *stat.Val + statNewInputs *stat.Val + statJobs *stat.Val + statJobsTriage *stat.Val + statJobsTriageCandidate *stat.Val + statJobsSmash *stat.Val + statJobsFaultInjection *stat.Val + statJobsHints *stat.Val + statExecTime *stat.Val + statExecGenerate *stat.Val + statExecFuzz *stat.Val + statExecCandidate *stat.Val + statExecTriage *stat.Val + statExecMinimize *stat.Val + statExecSmash *stat.Val + statExecFaultInject *stat.Val + statExecHint *stat.Val + statExecSeed *stat.Val + statExecCollide *stat.Val } func newStats() Stats { return Stats{ - statCandidates: stats.New("candidates", "Number of candidate programs in triage queue", - stats.Console, stats.Graph("corpus")), - statNewInputs: stats.New("new inputs", "Potential untriaged corpus candidates", - stats.Graph("corpus")), - 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.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.New("exec fuzz", "Executions of mutated programs", - stats.Rate{}, stats.StackedGraph("exec")), - statExecCandidate: stats.New("exec candidate", "Executions of candidate programs", - stats.Rate{}, stats.StackedGraph("exec")), - statExecTriage: stats.New("exec triage", "Executions of corpus triage programs", - stats.Rate{}, stats.StackedGraph("exec")), - statExecMinimize: stats.New("exec minimize", "Executions of programs during minimization", - stats.Rate{}, stats.StackedGraph("exec")), - statExecSmash: stats.New("exec smash", "Executions of smashed programs", - stats.Rate{}, stats.StackedGraph("exec")), - statExecFaultInject: stats.New("exec inject", "Executions of fault injection", - stats.Rate{}, stats.StackedGraph("exec")), - statExecHint: stats.New("exec hints", "Executions of programs generated using hints", - stats.Rate{}, stats.StackedGraph("exec")), - statExecSeed: stats.New("exec seeds", "Executions of programs for hints extraction", - stats.Rate{}, stats.StackedGraph("exec")), - statExecCollide: stats.New("exec collide", "Executions of programs in collide mode", - stats.Rate{}, stats.StackedGraph("exec")), + statCandidates: stat.New("candidates", "Number of candidate programs in triage queue", + stat.Console, stat.Graph("corpus")), + statNewInputs: stat.New("new inputs", "Potential untriaged corpus candidates", + stat.Graph("corpus")), + statJobs: stat.New("fuzzer jobs", "Total running fuzzer jobs", stat.NoGraph), + statJobsTriage: stat.New("triage jobs", "Running triage jobs", stat.StackedGraph("jobs")), + statJobsTriageCandidate: stat.New("candidate triage jobs", "Running candidate triage jobs", + stat.StackedGraph("jobs")), + statJobsSmash: stat.New("smash jobs", "Running smash jobs", stat.StackedGraph("jobs")), + statJobsFaultInjection: stat.New("fault jobs", "Running fault injection jobs", stat.StackedGraph("jobs")), + statJobsHints: stat.New("hints jobs", "Running hints jobs", stat.StackedGraph("jobs")), + statExecTime: stat.New("prog exec time", "Test program execution time (ms)", stat.Distribution{}), + statExecGenerate: stat.New("exec gen", "Executions of generated programs", stat.Rate{}, + stat.StackedGraph("exec")), + statExecFuzz: stat.New("exec fuzz", "Executions of mutated programs", + stat.Rate{}, stat.StackedGraph("exec")), + statExecCandidate: stat.New("exec candidate", "Executions of candidate programs", + stat.Rate{}, stat.StackedGraph("exec")), + statExecTriage: stat.New("exec triage", "Executions of corpus triage programs", + stat.Rate{}, stat.StackedGraph("exec")), + statExecMinimize: stat.New("exec minimize", "Executions of programs during minimization", + stat.Rate{}, stat.StackedGraph("exec")), + statExecSmash: stat.New("exec smash", "Executions of smashed programs", + stat.Rate{}, stat.StackedGraph("exec")), + statExecFaultInject: stat.New("exec inject", "Executions of fault injection", + stat.Rate{}, stat.StackedGraph("exec")), + statExecHint: stat.New("exec hints", "Executions of programs generated using hints", + stat.Rate{}, stat.StackedGraph("exec")), + statExecSeed: stat.New("exec seeds", "Executions of programs for hints extraction", + stat.Rate{}, stat.StackedGraph("exec")), + statExecCollide: stat.New("exec collide", "Executions of programs in collide mode", + stat.Rate{}, stat.StackedGraph("exec")), } } -- cgit mrf-deployment