diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-07-24 12:08:49 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-07-24 14:39:45 +0000 |
| commit | 49e6369fe732c0f81e5b03b36e345afbf3c79a15 (patch) | |
| tree | 651e322e41a8084abd6f2c80e4f9b7ff50a1dfe9 /pkg | |
| parent | 1f032c27c8158e44723253179928104813d45cdc (diff) | |
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
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/corpus/corpus.go | 20 | ||||
| -rw-r--r-- | pkg/flatrpc/conn.go | 10 | ||||
| -rw-r--r-- | pkg/fuzzer/cover.go | 6 | ||||
| -rw-r--r-- | pkg/fuzzer/fuzzer.go | 4 | ||||
| -rw-r--r-- | pkg/fuzzer/queue/queue.go | 4 | ||||
| -rw-r--r-- | pkg/fuzzer/stats.go | 104 | ||||
| -rw-r--r-- | pkg/rpcserver/rpcserver.go | 40 | ||||
| -rw-r--r-- | pkg/rpcserver/runner.go | 14 | ||||
| -rw-r--r-- | pkg/stat/avg.go (renamed from pkg/stats/avg.go) | 2 | ||||
| -rw-r--r-- | pkg/stat/sample/pvalue.go (renamed from pkg/stats/sample/pvalue.go) | 0 | ||||
| -rw-r--r-- | pkg/stat/sample/sample.go (renamed from pkg/stats/sample/sample.go) | 0 | ||||
| -rw-r--r-- | pkg/stat/sample/sample_test.go (renamed from pkg/stats/sample/sample_test.go) | 0 | ||||
| -rw-r--r-- | pkg/stat/set.go (renamed from pkg/stats/set.go) | 6 | ||||
| -rw-r--r-- | pkg/stat/set_test.go (renamed from pkg/stats/set_test.go) | 2 | ||||
| -rw-r--r-- | pkg/stat/syzbotstats/bug.go (renamed from pkg/stats/syzbotstats/bug.go) | 0 |
15 files changed, 106 insertions, 106 deletions
diff --git a/pkg/corpus/corpus.go b/pkg/corpus/corpus.go index af5754273..8b70b0cfd 100644 --- a/pkg/corpus/corpus.go +++ b/pkg/corpus/corpus.go @@ -10,7 +10,7 @@ import ( "github.com/google/syzkaller/pkg/cover" "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" ) @@ -24,9 +24,9 @@ type Corpus struct { cover cover.Cover // total coverage of all items updates chan<- NewItemEvent *ProgramsList - StatProgs *stats.Val - StatSignal *stats.Val - StatCover *stats.Val + StatProgs *stat.Val + StatSignal *stat.Val + StatCover *stat.Val } func NewCorpus(ctx context.Context) *Corpus { @@ -40,12 +40,12 @@ func NewMonitoredCorpus(ctx context.Context, updates chan<- NewItemEvent) *Corpu updates: updates, ProgramsList: &ProgramsList{}, } - 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.New("signal", "Fuzzing signal in the corpus", - stats.LenOf(&corpus.signal, &corpus.mu)) - 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)) + corpus.StatProgs = stat.New("corpus", "Number of test programs in the corpus", stat.Console, + stat.Link("/corpus"), stat.Graph("corpus"), stat.LenOf(&corpus.progs, &corpus.mu)) + corpus.StatSignal = stat.New("signal", "Fuzzing signal in the corpus", + stat.LenOf(&corpus.signal, &corpus.mu)) + corpus.StatCover = stat.New("coverage", "Source coverage in the corpus", stat.Console, + stat.Link("/cover"), stat.Prometheus("syz_corpus_cover"), stat.LenOf(&corpus.cover, &corpus.mu)) return corpus } diff --git a/pkg/flatrpc/conn.go b/pkg/flatrpc/conn.go index 0658522a0..c5e1cb1a4 100644 --- a/pkg/flatrpc/conn.go +++ b/pkg/flatrpc/conn.go @@ -15,14 +15,14 @@ import ( "github.com/google/flatbuffers/go" "github.com/google/syzkaller/pkg/log" - "github.com/google/syzkaller/pkg/stats" + "github.com/google/syzkaller/pkg/stat" ) var ( - statSent = stats.New("rpc sent", "Outbound RPC traffic", - stats.Graph("traffic"), stats.Rate{}, stats.FormatMB) - statRecv = stats.New("rpc recv", "Inbound RPC traffic", - stats.Graph("traffic"), stats.Rate{}, stats.FormatMB) + statSent = stat.New("rpc sent", "Outbound RPC traffic", + stat.Graph("traffic"), stat.Rate{}, stat.FormatMB) + statRecv = stat.New("rpc recv", "Inbound RPC traffic", + stat.Graph("traffic"), stat.Rate{}, stat.FormatMB) ) type Serv struct { 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")), } } diff --git a/pkg/rpcserver/rpcserver.go b/pkg/rpcserver/rpcserver.go index 0b7d566bb..b371785d4 100644 --- a/pkg/rpcserver/rpcserver.go +++ b/pkg/rpcserver/rpcserver.go @@ -23,7 +23,7 @@ import ( "github.com/google/syzkaller/pkg/log" "github.com/google/syzkaller/pkg/mgrconfig" "github.com/google/syzkaller/pkg/signal" - "github.com/google/syzkaller/pkg/stats" + "github.com/google/syzkaller/pkg/stat" "github.com/google/syzkaller/pkg/vminfo" "github.com/google/syzkaller/prog" "github.com/google/syzkaller/sys/targets" @@ -58,8 +58,8 @@ type Manager interface { type Server struct { Port int - StatExecs *stats.Val - StatNumFuzzing *stats.Val + StatExecs *stat.Val + StatNumFuzzing *stat.Val cfg *Config mgr Manager @@ -81,7 +81,7 @@ type Server struct { runners map[string]*Runner execSource queue.Source triagedCorpus atomic.Bool - statVMRestarts *stats.Val + statVMRestarts *stat.Val *runnerStats } @@ -144,24 +144,24 @@ func newImpl(ctx context.Context, cfg *Config, mgr Manager) (*Server, error) { baseSource: baseSource, execSource: queue.Retry(baseSource), - StatExecs: stats.New("exec total", "Total test program executions", - stats.Console, stats.Rate{}, stats.Prometheus("syz_exec_total")), - StatNumFuzzing: stats.New("fuzzing VMs", "Number of VMs that are currently fuzzing", - stats.Console, stats.Link("/vms")), - statVMRestarts: stats.New("vm restarts", "Total number of VM starts", - stats.Rate{}, stats.NoGraph), + StatExecs: stat.New("exec total", "Total test program executions", + stat.Console, stat.Rate{}, stat.Prometheus("syz_exec_total")), + StatNumFuzzing: stat.New("fuzzing VMs", "Number of VMs that are currently fuzzing", + stat.Console, stat.Link("/vms")), + statVMRestarts: stat.New("vm restarts", "Total number of VM starts", + stat.Rate{}, stat.NoGraph), runnerStats: &runnerStats{ - statExecRetries: stats.New("exec retries", + statExecRetries: stat.New("exec retries", "Number of times a test program was restarted because the first run failed", - stats.Rate{}, stats.Graph("executor")), - statExecutorRestarts: stats.New("executor restarts", - "Number of times executor process was restarted", stats.Rate{}, stats.Graph("executor")), - statExecBufferTooSmall: stats.New("buffer too small", - "Program serialization overflowed exec buffer", stats.NoGraph), - statNoExecRequests: stats.New("no exec requests", - "Number of times fuzzer was stalled with no exec requests", stats.Rate{}), - statNoExecDuration: stats.New("no exec duration", - "Total duration fuzzer was stalled with no exec requests (ns/sec)", stats.Rate{}), + stat.Rate{}, stat.Graph("executor")), + statExecutorRestarts: stat.New("executor restarts", + "Number of times executor process was restarted", stat.Rate{}, stat.Graph("executor")), + statExecBufferTooSmall: stat.New("buffer too small", + "Program serialization overflowed exec buffer", stat.NoGraph), + statNoExecRequests: stat.New("no exec requests", + "Number of times fuzzer was stalled with no exec requests", stat.Rate{}), + statNoExecDuration: stat.New("no exec duration", + "Total duration fuzzer was stalled with no exec requests (ns/sec)", stat.Rate{}), }, } serv.runnerStats.statExecs = serv.StatExecs diff --git a/pkg/rpcserver/runner.go b/pkg/rpcserver/runner.go index 21b270421..a0b519d20 100644 --- a/pkg/rpcserver/runner.go +++ b/pkg/rpcserver/runner.go @@ -18,7 +18,7 @@ import ( "github.com/google/syzkaller/pkg/fuzzer/queue" "github.com/google/syzkaller/pkg/log" "github.com/google/syzkaller/pkg/osutil" - "github.com/google/syzkaller/pkg/stats" + "github.com/google/syzkaller/pkg/stat" "github.com/google/syzkaller/prog" "github.com/google/syzkaller/sys/targets" "github.com/google/syzkaller/vm/dispatcher" @@ -54,12 +54,12 @@ type Runner struct { } type runnerStats struct { - statExecs *stats.Val - statExecRetries *stats.Val - statExecutorRestarts *stats.Val - statExecBufferTooSmall *stats.Val - statNoExecRequests *stats.Val - statNoExecDuration *stats.Val + statExecs *stat.Val + statExecRetries *stat.Val + statExecutorRestarts *stat.Val + statExecBufferTooSmall *stat.Val + statNoExecRequests *stat.Val + statNoExecDuration *stat.Val } type handshakeConfig struct { diff --git a/pkg/stats/avg.go b/pkg/stat/avg.go index 430ff335b..fcfc9f5d5 100644 --- a/pkg/stats/avg.go +++ b/pkg/stat/avg.go @@ -1,7 +1,7 @@ // Copyright 2024 syzkaller project authors. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -package stats +package stat import ( "sync" diff --git a/pkg/stats/sample/pvalue.go b/pkg/stat/sample/pvalue.go index acfff4bc4..acfff4bc4 100644 --- a/pkg/stats/sample/pvalue.go +++ b/pkg/stat/sample/pvalue.go diff --git a/pkg/stats/sample/sample.go b/pkg/stat/sample/sample.go index 740f9aefe..740f9aefe 100644 --- a/pkg/stats/sample/sample.go +++ b/pkg/stat/sample/sample.go diff --git a/pkg/stats/sample/sample_test.go b/pkg/stat/sample/sample_test.go index ac7845ccf..ac7845ccf 100644 --- a/pkg/stats/sample/sample_test.go +++ b/pkg/stat/sample/sample_test.go diff --git a/pkg/stats/set.go b/pkg/stat/set.go index 7e4804280..690d0406a 100644 --- a/pkg/stats/set.go +++ b/pkg/stat/set.go @@ -1,7 +1,7 @@ // Copyright 2024 syzkaller project authors. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -package stats +package stat import ( "bytes" @@ -23,10 +23,10 @@ import ( // // Simple uses of metrics: // -// statFoo := stats.New("metric name", "metric description") +// statFoo := stat.New("metric name", "metric description") // statFoo.Add(1) // -// stats.New("metric name", "metric description", LenOf(mySlice, rwMutex)) +// stat.New("metric name", "metric description", LenOf(mySlice, rwMutex)) // // Metric visualization code uses Collect/RenderHTML functions to obtain values of all registered metrics. diff --git a/pkg/stats/set_test.go b/pkg/stat/set_test.go index 862882fc2..4313db1ef 100644 --- a/pkg/stats/set_test.go +++ b/pkg/stat/set_test.go @@ -1,7 +1,7 @@ // Copyright 2024 syzkaller project authors. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -package stats +package stat import ( "fmt" diff --git a/pkg/stats/syzbotstats/bug.go b/pkg/stat/syzbotstats/bug.go index c11274583..c11274583 100644 --- a/pkg/stats/syzbotstats/bug.go +++ b/pkg/stat/syzbotstats/bug.go |
