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 | |
| 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')
| -rw-r--r-- | pkg/manager/html/syscalls.html | 4 | ||||
| -rw-r--r-- | pkg/manager/http.go | 14 |
2 files changed, 17 insertions, 1 deletions
diff --git a/pkg/manager/html/syscalls.html b/pkg/manager/html/syscalls.html index cb6991f42..e3edfcabf 100644 --- a/pkg/manager/html/syscalls.html +++ b/pkg/manager/html/syscalls.html @@ -7,7 +7,8 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the <caption>Per-syscall coverage:</caption> <tr> <th><a onclick="return sortTable(this, 'Syscall', textSort)" href="#">Syscall</a></th> - <th><a onclick="return sortTable(this, 'Inputs', numSort)" href="#">Inputs</a></th> + <th><a onclick="return sortTable(this, 'Inputs', numSort)" href="#" title="Number of inputs in the corpus added because of this syscall">Inputs</a></th> + <th><a onclick="return sortTable(this, 'Total', numSort)" href="#" title="Total number of inputs in the corpus that contain this syscall">Total</a></th> <th><a onclick="return sortTable(this, 'Coverage', numSort)" href="#">Coverage</a></th> <th>Prio</th> </tr> @@ -15,6 +16,7 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the <tr> <td>{{$c.Name}}{{if $c.ID }} [{{$c.ID}}]{{end}}</td> <td><a href='/corpus?call={{$c.Name}}'>{{$c.Inputs}}</a></td> + <td>{{$c.Total}}</td> <td><a href='/cover?call={{$c.Name}}'>{{$c.Cover}}</a></td> <td><a href='/prio?call={{$c.Name}}'>prio</a></td> </tr> 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 } |
