From 2db4e4554b9e0e541685aa204113afb84ce0289a Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 5 Aug 2016 19:42:24 +0200 Subject: 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. --- syz-manager/html.go | 8 ++++---- syz-manager/manager.go | 17 +++++++++++++++++ 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 @@ -186,6 +186,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) @@ -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 -- cgit mrf-deployment