From 7d02db5adbb376babbbd3199f8c530e468292727 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 19 Nov 2024 16:10:32 +0100 Subject: 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. --- pkg/manager/http.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pkg/manager/http.go') 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 } -- cgit mrf-deployment