diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-04-16 08:51:45 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-04-16 14:20:36 +0000 |
| commit | 18f6e127bf6e515fc3eee0936bde2415e676e160 (patch) | |
| tree | ddc872de4dd5b0bf468e6195e231ce8fe4dfeea7 /pkg | |
| parent | 68911a35911bfdeb62bef87d9e844b1c19f86580 (diff) | |
pkg/ipc: include executor freshness into execution result
Instead of counting exeutor restarts add executor freshness
(number of tests executed in the same process before this one)
into execution result.
This removes all program-related metrics from syz-fuzzer,
and concentrates all of them in the manager.
The freshness of the concrete test may also be useful
for some analysis later.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/ipc/ipc.go | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go index 417f27c24..16840f6a2 100644 --- a/pkg/ipc/ipc.go +++ b/pkg/ipc/ipc.go @@ -12,7 +12,6 @@ import ( "reflect" "strings" "sync" - "sync/atomic" "time" "unsafe" @@ -97,9 +96,10 @@ type CallInfo struct { } type ProgInfo struct { - Calls []CallInfo - Extra CallInfo // stores Signal and Cover collected from background threads - Elapsed time.Duration // total execution time of the program + Calls []CallInfo + Extra CallInfo // stores Signal and Cover collected from background threads + Elapsed time.Duration // total execution time of the program + Freshness int // number of programs executed in the same process before this one } type Env struct { @@ -113,9 +113,6 @@ type Env struct { linkedBin string pid int config *Config - - StatExecs uint64 - StatRestarts uint64 } const ( @@ -270,7 +267,6 @@ func (env *Env) ExecProg(opts *ExecOpts, progData []byte) (output []byte, info * env.out[i] = 0 } - atomic.AddUint64(&env.StatExecs, 1) err0 = env.RestartIfNeeded() if err0 != nil { return @@ -288,7 +284,9 @@ func (env *Env) ExecProg(opts *ExecOpts, progData []byte) (output []byte, info * info, err0 = env.parseOutput(opts, ncalls) if info != nil { info.Elapsed = elapsed + info.Freshness = env.cmd.freshness } + env.cmd.freshness++ if !env.config.UseForkServer { env.cmd.close() env.cmd = nil @@ -324,7 +322,6 @@ func (env *Env) RestartIfNeeded() error { <-rateLimiter } tmpDirPath := "./" - atomic.AddUint64(&env.StatRestarts, 1) var err error env.cmd, err = makeCommand(env.pid, env.bin, env.config, env.inFile, env.outFile, env.out, tmpDirPath) return err @@ -499,16 +496,17 @@ func readUint32Array(outp *[]byte, size uint32) ([]uint32, bool) { } type command struct { - pid int - config *Config - timeout time.Duration - cmd *exec.Cmd - dir string - readDone chan []byte - exited chan error - inrp *os.File - outwp *os.File - outmem []byte + pid int + config *Config + timeout time.Duration + cmd *exec.Cmd + dir string + readDone chan []byte + exited chan error + inrp *os.File + outwp *os.File + outmem []byte + freshness int } const ( |
