lin
2025-08-14 dae8bad597b6607a449b32bf76c523423f7720ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2018 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 main
 
import (
   "sync/atomic"
)
 
type Stat uint64
 
type Stats struct {
   crashes          Stat
   crashTypes       Stat
   crashSuppressed  Stat
   vmRestarts       Stat
   newInputs        Stat
   execTotal        Stat
   hubSendProgAdd   Stat
   hubSendProgDel   Stat
   hubSendRepro     Stat
   hubRecvProg      Stat
   hubRecvProgDrop  Stat
   hubRecvRepro     Stat
   hubRecvReproDrop Stat
}
 
func (stats *Stats) all() map[string]uint64 {
   return map[string]uint64{
       "crashes":              stats.crashes.get(),
       "crash types":          stats.crashTypes.get(),
       "suppressed":           stats.crashSuppressed.get(),
       "vm restarts":          stats.vmRestarts.get(),
       "manager new inputs":   stats.newInputs.get(),
       "exec total":           stats.execTotal.get(),
       "hub: send prog add":   stats.hubSendProgAdd.get(),
       "hub: send prog del":   stats.hubSendProgDel.get(),
       "hub: send repro":      stats.hubSendRepro.get(),
       "hub: recv prog":       stats.hubRecvProg.get(),
       "hub: recv prog drop":  stats.hubRecvProgDrop.get(),
       "hub: recv repro":      stats.hubRecvRepro.get(),
       "hub: recv repro drop": stats.hubRecvReproDrop.get(),
   }
}
 
func (s *Stat) get() uint64 {
   return atomic.LoadUint64((*uint64)(s))
}
 
func (s *Stat) inc() {
   s.add(1)
}
 
func (s *Stat) add(v int) {
   atomic.AddUint64((*uint64)(s), uint64(v))
}