aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-08-05 19:42:24 +0200
committerDmitry Vyukov <dvyukov@google.com>2016-08-05 19:42:24 +0200
commit2db4e4554b9e0e541685aa204113afb84ce0289a (patch)
treedbf565da632601fc2acc8f2da57ed3a491d9fa11
parentdf1fcfd5aadba856afeee67e0216cf00b38047f9 (diff)
manager: print keep alive to stdout
Print a message with total number of programs executed every 10 seconds. Helps to understand if this thing is working or not.
-rw-r--r--syz-manager/html.go8
-rw-r--r--syz-manager/manager.go17
2 files changed, 21 insertions, 4 deletions
diff --git a/syz-manager/html.go b/syz-manager/html.go
index 5b74911f1..f53791f2b 100644
--- a/syz-manager/html.go
+++ b/syz-manager/html.go
@@ -59,14 +59,14 @@ func (mgr *Manager) httpInfo(w http.ResponseWriter, r *http.Request) {
secs := uint64(uptime) / 1e9
for k, v := range mgr.stats {
- val := ""
+ val := fmt.Sprintf("%v", v)
if x := v / secs; x >= 10 {
- val = fmt.Sprintf("%v/sec", x)
+ val += fmt.Sprintf(" (%v/sec)", x)
} else if x := v * 60 / secs; x >= 10 {
- val = fmt.Sprintf("%v/min", x)
+ val += fmt.Sprintf(" (%v/min)", x)
} else {
x := v * 60 * 60 / secs
- val = fmt.Sprintf("%v/hour", x)
+ val += fmt.Sprintf(" (%v/hour)", x)
}
data.Stats = append(data.Stats, UIStat{Name: k, Value: val})
}
diff --git a/syz-manager/manager.go b/syz-manager/manager.go
index 25fa5f73e..2005ed7b7 100644
--- a/syz-manager/manager.go
+++ b/syz-manager/manager.go
@@ -187,6 +187,17 @@ func RunManager(cfg *config.Config, syscalls map[int]bool, suppressions []*regex
}
go func() {
+ for {
+ time.Sleep(10 * time.Second)
+ mgr.mu.Lock()
+ executed := mgr.stats["exec total"]
+ crashes := mgr.stats["crashes"]
+ mgr.mu.Unlock()
+ logf(0, "executed programs: %v, crashes: %v", executed, crashes)
+ }
+ }()
+
+ go func() {
c := make(chan os.Signal, 2)
signal.Notify(c, syscall.SIGINT)
<-c
@@ -256,6 +267,9 @@ func (mgr *Manager) runInstance(vmCfg *vm.Config, first bool) bool {
for _, re := range mgr.suppressions {
if re.Match(output) {
logf(1, "%v: suppressing '%v' with '%v'", vmCfg.Name, what, re.String())
+ mgr.mu.Lock()
+ mgr.stats["suppressed"]++
+ mgr.mu.Unlock()
return
}
}
@@ -275,6 +289,9 @@ func (mgr *Manager) runInstance(vmCfg *vm.Config, first bool) bool {
filename := fmt.Sprintf("crash-%v-%v", vmCfg.Name, time.Now().UnixNano())
logf(0, "%v: saving crash '%v' to %v", vmCfg.Name, what, filename)
ioutil.WriteFile(filepath.Join(mgr.crashdir, filename), output, 0660)
+ mgr.mu.Lock()
+ mgr.stats["crashes"]++
+ mgr.mu.Unlock()
}
var output []byte