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 | |
| 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
| -rw-r--r-- | dashboard/app/stats.go | 2 | ||||
| -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 | ||||
| -rw-r--r-- | syz-manager/http.go | 10 | ||||
| -rw-r--r-- | syz-manager/hub.go | 30 | ||||
| -rw-r--r-- | syz-manager/manager.go | 12 | ||||
| -rw-r--r-- | syz-manager/repro.go | 14 | ||||
| -rw-r--r-- | syz-manager/stats.go | 48 | ||||
| -rw-r--r-- | tools/syz-testbed/stats.go | 2 | ||||
| -rw-r--r-- | tools/syz-testbed/table.go | 2 | ||||
| -rw-r--r-- | tools/syz-testbed/table_test.go | 2 | ||||
| -rw-r--r-- | vm/vm.go | 8 |
25 files changed, 171 insertions, 171 deletions
diff --git a/dashboard/app/stats.go b/dashboard/app/stats.go index d8123933e..467270439 100644 --- a/dashboard/app/stats.go +++ b/dashboard/app/stats.go @@ -10,7 +10,7 @@ import ( "time" "github.com/google/syzkaller/dashboard/dashapi" - "github.com/google/syzkaller/pkg/stats/syzbotstats" + "github.com/google/syzkaller/pkg/stat/syzbotstats" "google.golang.org/appengine/v2" db "google.golang.org/appengine/v2/datastore" ) 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 diff --git a/syz-manager/http.go b/syz-manager/http.go index f51014667..60be016ac 100644 --- a/syz-manager/http.go +++ b/syz-manager/http.go @@ -24,7 +24,7 @@ import ( "github.com/google/syzkaller/pkg/html/pages" "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/pkg/vcs" "github.com/google/syzkaller/prog" "github.com/google/syzkaller/vm/dispatcher" @@ -84,11 +84,11 @@ func (mgr *Manager) httpSummary(w http.ResponseWriter, r *http.Request) { Log: log.CachedLogOutput(), } - level := stats.Simple + level := stat.Simple if mgr.expertMode { - level = stats.All + level = stat.All } - for _, stat := range stats.Collect(level) { + for _, stat := range stat.Collect(level) { data.Stats = append(data.Stats, UIStat{ Name: stat.Name, Value: stat.Value, @@ -157,7 +157,7 @@ func (mgr *Manager) httpSyscalls(w http.ResponseWriter, r *http.Request) { } func (mgr *Manager) httpStats(w http.ResponseWriter, r *http.Request) { - data, err := stats.RenderHTML() + data, err := stat.RenderHTML() if err != nil { log.Logf(0, "failed to execute template: %v", err) http.Error(w, err.Error(), http.StatusInternalServerError) diff --git a/syz-manager/hub.go b/syz-manager/hub.go index 216927a98..2b8d21be5 100644 --- a/syz-manager/hub.go +++ b/syz-manager/hub.go @@ -18,7 +18,7 @@ import ( "github.com/google/syzkaller/pkg/report" "github.com/google/syzkaller/pkg/report/crash" "github.com/google/syzkaller/pkg/rpctype" - "github.com/google/syzkaller/pkg/stats" + "github.com/google/syzkaller/pkg/stat" "github.com/google/syzkaller/prog" ) @@ -50,13 +50,13 @@ func (mgr *Manager) hubSyncLoop(keyGet keyGetter) { hubReproQueue: mgr.externalReproQueue, keyGet: keyGet, - 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), + statSendProgAdd: stat.New("hub send prog add", "", stat.Graph("hub progs")), + statSendProgDel: stat.New("hub send prog del", "", stat.Graph("hub progs")), + statRecvProg: stat.New("hub recv prog", "", stat.Graph("hub progs")), + statRecvProgDrop: stat.New("hub recv prog drop", "", stat.NoGraph), + statSendRepro: stat.New("hub send repro", "", stat.Graph("hub repros")), + statRecvRepro: stat.New("hub recv repro", "", stat.Graph("hub repros")), + statRecvReproDrop: stat.New("hub recv repro drop", "", stat.NoGraph), } if mgr.cfg.Reproduce && mgr.dash != nil { // Request reproducers from hub only if there is nothing else to reproduce. @@ -79,13 +79,13 @@ type HubConnector struct { needMoreRepros func() bool keyGet keyGetter - statSendProgAdd *stats.Val - statSendProgDel *stats.Val - statRecvProg *stats.Val - statRecvProgDrop *stats.Val - statSendRepro *stats.Val - statRecvRepro *stats.Val - statRecvReproDrop *stats.Val + statSendProgAdd *stat.Val + statSendProgDel *stat.Val + statRecvProg *stat.Val + statRecvProgDrop *stat.Val + statSendRepro *stat.Val + statRecvRepro *stat.Val + statRecvReproDrop *stat.Val } // HubManagerView restricts interface between HubConnector and Manager. diff --git a/syz-manager/manager.go b/syz-manager/manager.go index 5bb17b58d..367ade170 100644 --- a/syz-manager/manager.go +++ b/syz-manager/manager.go @@ -41,7 +41,7 @@ import ( "github.com/google/syzkaller/pkg/rpcserver" "github.com/google/syzkaller/pkg/runtest" "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" @@ -116,7 +116,7 @@ type Manager struct { assetStorage *asset.Storage - bootTime stats.AverageValue[time.Duration] + bootTime stat.AverageValue[time.Duration] reproMgr *reproManager @@ -338,7 +338,7 @@ func (mgr *Manager) heartbeatLoop() { } mgr.statFuzzingTime.Add(diff * mgr.serv.StatNumFuzzing.Val()) buf := new(bytes.Buffer) - for _, stat := range stats.Collect(stats.Console) { + for _, stat := range stat.Collect(stat.Console) { fmt.Fprintf(buf, "%v=%v ", stat.Name, stat.Value) } log.Logf(0, "%s", buf.String()) @@ -365,7 +365,7 @@ func (mgr *Manager) writeBench() { mgr.benchMu.Lock() defer mgr.benchMu.Unlock() vals := make(map[string]int) - for _, stat := range stats.Collect(stats.All) { + for _, stat := range stat.Collect(stat.All) { vals[stat.Name] = stat.V } data, err := json.MarshalIndent(vals, "", " ") @@ -1329,8 +1329,8 @@ func (mgr *Manager) MachineChecked(features flatrpc.Feature, enabledSyscalls map mgr.enabledFeatures = features mgr.targetEnabledSyscalls = enabledSyscalls mgr.firstConnect.Store(time.Now().Unix()) - statSyscalls := stats.New("syscalls", "Number of enabled syscalls", - stats.Simple, stats.NoGraph, stats.Link("/syscalls")) + statSyscalls := stat.New("syscalls", "Number of enabled syscalls", + stat.Simple, stat.NoGraph, stat.Link("/syscalls")) statSyscalls.Add(len(enabledSyscalls)) corpus := mgr.loadCorpus() mgr.phase = phaseLoadedCorpus diff --git a/syz-manager/repro.go b/syz-manager/repro.go index e03eaeb73..11812b83b 100644 --- a/syz-manager/repro.go +++ b/syz-manager/repro.go @@ -10,7 +10,7 @@ import ( "sync" "github.com/google/syzkaller/pkg/log" - "github.com/google/syzkaller/pkg/stats" + "github.com/google/syzkaller/pkg/stat" ) type reproManagerView interface { @@ -22,8 +22,8 @@ type reproManagerView interface { type reproManager struct { Done chan *ReproResult - statNumReproducing *stats.Val - statPending *stats.Val + statNumReproducing *stat.Val + statPending *stat.Val onlyOnce bool mgr reproManagerView @@ -49,14 +49,14 @@ func newReproManager(mgr reproManagerView, reproVMs int, onlyOnce bool) *reproMa pingQueue: make(chan struct{}, 1), attempted: map[string]bool{}, } - ret.statNumReproducing = stats.New("reproducing", "Number of crashes being reproduced", - stats.Console, stats.NoGraph, func() int { + ret.statNumReproducing = stat.New("reproducing", "Number of crashes being reproduced", + stat.Console, stat.NoGraph, func() int { ret.mu.Lock() defer ret.mu.Unlock() return len(ret.reproducing) }) - ret.statPending = stats.New("pending", "Number of pending repro tasks", - stats.Console, stats.NoGraph, func() int { + ret.statPending = stat.New("pending", "Number of pending repro tasks", + stat.Console, stat.NoGraph, func() int { ret.mu.Lock() defer ret.mu.Unlock() return len(ret.queue) diff --git a/syz-manager/stats.go b/syz-manager/stats.go index 4fbc7d657..f096e4423 100644 --- a/syz-manager/stats.go +++ b/syz-manager/stats.go @@ -9,29 +9,29 @@ import ( "time" "github.com/google/syzkaller/pkg/image" - "github.com/google/syzkaller/pkg/stats" + "github.com/google/syzkaller/pkg/stat" ) type Stats struct { - statCrashes *stats.Val - statCrashTypes *stats.Val - statSuppressed *stats.Val - statUptime *stats.Val - statFuzzingTime *stats.Val - statAvgBootTime *stats.Val - statCoverFiltered *stats.Val + statCrashes *stat.Val + statCrashTypes *stat.Val + statSuppressed *stat.Val + statUptime *stat.Val + statFuzzingTime *stat.Val + statAvgBootTime *stat.Val + statCoverFiltered *stat.Val } func (mgr *Manager) initStats() { - mgr.statCrashes = stats.New("crashes", "Total number of VM crashes", - stats.Simple, stats.Prometheus("syz_crash_total")) - mgr.statCrashTypes = stats.New("crash types", "Number of unique crashes types", - stats.Simple, stats.NoGraph) - mgr.statSuppressed = stats.New("suppressed", "Total number of suppressed VM crashes", - stats.Simple, stats.Graph("crashes")) - 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.New("uptime", "Total uptime (seconds)", stats.Simple, stats.NoGraph, + mgr.statCrashes = stat.New("crashes", "Total number of VM crashes", + stat.Simple, stat.Prometheus("syz_crash_total")) + mgr.statCrashTypes = stat.New("crash types", "Number of unique crashes types", + stat.Simple, stat.NoGraph) + mgr.statSuppressed = stat.New("suppressed", "Total number of suppressed VM crashes", + stat.Simple, stat.Graph("crashes")) + mgr.statFuzzingTime = stat.New("fuzzing", "Total fuzzing time in all VMs (seconds)", + stat.NoGraph, func(v int, period time.Duration) string { return fmt.Sprintf("%v sec", v/1e9) }) + mgr.statUptime = stat.New("uptime", "Total uptime (seconds)", stat.Simple, stat.NoGraph, func() int { firstConnect := mgr.firstConnect.Load() if firstConnect == 0 { @@ -41,8 +41,8 @@ func (mgr *Manager) initStats() { }, func(v int, period time.Duration) string { return fmt.Sprintf("%v sec", v) }) - mgr.statAvgBootTime = stats.New("instance restart", "Average VM restart time (sec)", - stats.NoGraph, + mgr.statAvgBootTime = stat.New("instance restart", "Average VM restart time (sec)", + stat.NoGraph, func() int { return int(mgr.bootTime.Value().Seconds()) }, @@ -50,7 +50,7 @@ func (mgr *Manager) initStats() { return fmt.Sprintf("%v sec", v) }) - stats.New("heap", "Process heap size (bytes)", stats.Graph("memory"), + stat.New("heap", "Process heap size (bytes)", stat.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.New("VM", "Process VM size (bytes)", stats.Graph("memory"), + stat.New("VM", "Process VM size (bytes)", stat.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.New("images memory", "Uncompressed images memory (bytes)", stats.Graph("memory"), + stat.New("images memory", "Uncompressed images memory (bytes)", stat.Graph("memory"), func() int { return int(image.StatMemory.Load()) }, func(v int, period time.Duration) string { return fmt.Sprintf("%v MB", v>>20) }) - stats.New("uncompressed images", "Total number of uncompressed images in memory", + stat.New("uncompressed images", "Total number of uncompressed images in memory", func() int { return int(image.StatImages.Load()) }) - mgr.statCoverFiltered = stats.New("filtered coverage", "", stats.NoGraph) + mgr.statCoverFiltered = stat.New("filtered coverage", "", stat.NoGraph) } diff --git a/tools/syz-testbed/stats.go b/tools/syz-testbed/stats.go index 108c25ed1..185156a5d 100644 --- a/tools/syz-testbed/stats.go +++ b/tools/syz-testbed/stats.go @@ -12,7 +12,7 @@ import ( "time" "github.com/google/syzkaller/pkg/osutil" - "github.com/google/syzkaller/pkg/stats/sample" + "github.com/google/syzkaller/pkg/stat/sample" ) type BugInfo struct { diff --git a/tools/syz-testbed/table.go b/tools/syz-testbed/table.go index fae3e2279..a4bdd98af 100644 --- a/tools/syz-testbed/table.go +++ b/tools/syz-testbed/table.go @@ -10,7 +10,7 @@ import ( "os" "sort" - "github.com/google/syzkaller/pkg/stats/sample" + "github.com/google/syzkaller/pkg/stat/sample" ) type Cell = interface{} diff --git a/tools/syz-testbed/table_test.go b/tools/syz-testbed/table_test.go index 313802819..9726537f5 100644 --- a/tools/syz-testbed/table_test.go +++ b/tools/syz-testbed/table_test.go @@ -6,7 +6,7 @@ package main import ( "testing" - "github.com/google/syzkaller/pkg/stats/sample" + "github.com/google/syzkaller/pkg/stat/sample" "github.com/stretchr/testify/assert" ) @@ -22,7 +22,7 @@ import ( "github.com/google/syzkaller/pkg/mgrconfig" "github.com/google/syzkaller/pkg/osutil" "github.com/google/syzkaller/pkg/report" - "github.com/google/syzkaller/pkg/stats" + "github.com/google/syzkaller/pkg/stat" "github.com/google/syzkaller/sys/targets" "github.com/google/syzkaller/vm/dispatcher" "github.com/google/syzkaller/vm/vmimpl" @@ -49,7 +49,7 @@ type Pool struct { timeouts targets.Timeouts activeCount int32 hostFuzzer bool - statOutputReceived *stats.Val + statOutputReceived *stat.Val } type Instance struct { @@ -134,8 +134,8 @@ func Create(cfg *mgrconfig.Config, debug bool) (*Pool, error) { template: cfg.WorkdirTemplate, timeouts: cfg.Timeouts, hostFuzzer: cfg.SysTarget.HostFuzzer, - statOutputReceived: stats.New("vm output", "Bytes of VM console output received", - stats.Graph("traffic"), stats.Rate{}, stats.FormatMB), + statOutputReceived: stat.New("vm output", "Bytes of VM console output received", + stat.Graph("traffic"), stat.Rate{}, stat.FormatMB), }, nil } |
