diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-11-19 16:10:32 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-11-19 15:23:46 +0000 |
| commit | 7d02db5adbb376babbbd3199f8c530e468292727 (patch) | |
| tree | 5427c6b76fea69736252df7a993f5d9bbf57097d /pkg/manager/http.go | |
| parent | 073d8186258664a3091d63bea349e20c641e7bf4 (diff) | |
pkg/manager: show number of programs that contain each syscall
Currently we show number of programs that are added to the corpus
b/c of a particular syscall. Also show total number of programs
in the corpus that contain each syscall. This is different from
the first thing.
Diffstat (limited to 'pkg/manager/http.go')
| -rw-r--r-- | pkg/manager/http.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/manager/http.go b/pkg/manager/http.go index 65407ec90..81affcf7e 100644 --- a/pkg/manager/http.go +++ b/pkg/manager/http.go @@ -186,6 +186,7 @@ func (serv *HTTPServer) textPage(w http.ResponseWriter, r *http.Request, title s func (serv *HTTPServer) httpSyscalls(w http.ResponseWriter, r *http.Request) { var calls map[string]*corpus.CallCov + total := make(map[string]int) syscallsObj := serv.EnabledSyscalls.Load() corpusObj := serv.Corpus.Load() if corpusObj != nil && syscallsObj != nil { @@ -196,6 +197,17 @@ func (serv *HTTPServer) httpSyscalls(w http.ResponseWriter, r *http.Request) { calls[call.Name] = new(corpus.CallCov) } } + // Count number of programs that include each call. + last := make(map[string]*prog.Prog) + for _, inp := range corpusObj.Items() { + for _, call := range inp.Prog.Calls { + name := call.Meta.Name + if last[name] != inp.Prog { + total[name]++ + } + last[name] = inp.Prog + } + } } data := &UISyscallsData{ UIPageHeader: serv.pageHeader(r, "syscalls"), @@ -209,6 +221,7 @@ func (serv *HTTPServer) httpSyscalls(w http.ResponseWriter, r *http.Request) { Name: c, ID: syscallID, Inputs: cc.Count, + Total: total[c], Cover: len(cc.Cover), }) } @@ -953,6 +966,7 @@ type UICallType struct { Name string ID *int Inputs int + Total int Cover int } |
