Skip to contentSkip to conversation

perf report TUI: Remove needless 'dummy' event from menu

PATCH Namhyung Kim 2 participants 3 messages Jul 3, 2020 – Jul 6, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Arnaldo,

Quoted 58 lines · Arnaldo Carvalho de Melo

Please Ack,

- Arnaldo

----

Fixing the common case of:

perf record
perf report

And getting just the cycles events.

We now have a 'dummy' event to get perf metadata events that take place while we synthesize metadata records for pre-existing processes by traversing procfs, so we always have this extra 'dummy' evsel, but we don't have to offer it as there will be no samples on it, remove this distraction.

Cc Adrian Hunter <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/ui/browsers/hists.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +17 -0
index 4cd556c1276f..be9c4c0549bc 100644
@@ -3603,6 +3603,23 @@ static int __perf_evlist__tui_browse_hists(struct evlist *evlist,
                                    hbt, warn_lost_event);
 }
 
+static bool perf_evlist__single_entry(struct evlist *evlist)
+{
+       int nr_entries = evlist->core.nr_entries;
+
+       if (nr_entries == 1)
+              return true;
+
+       if (nr_entries == 2) {
+               struct evsel *last = evlist__last(evlist);
+
+               if (evsel__is_dummy_event(last))
+                       return true;
+       }
+
+       return false;
+}
+
 int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help,
                                  struct hist_browser_timer *hbt,
                                  float min_pcnt,

tools/perf/ui/browsers/hists.c int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help, · line 3633

Quoted 5 lines
tools/perf/ui/browsers/hists.c +1 -1
@@ -3613,7 +3630,7 @@ int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help,
        int nr_entries = evlist->core.nr_entries;
 
 single_entry:
-       if (nr_entries == 1) {
+       if (perf_evlist__single_entry(evlist)) {

But I think it cannot cover the event group case below..

Thanks
Namhyung

Quoted 6 lines
tools/perf/ui/browsers/hists.c +0 -1
                struct evsel *first = evlist__first(evlist);
 
                return perf_evsel__hists_browse(first, nr_entries, help,
--

2.21.3

#2 lore raw

Em Fri, Jul 03, 2020 at 10:44:28PM +0900, Namhyung Kim escreveu:

Quoted 63 lines

Hi Arnaldo,

Quoted 60 lines · Arnaldo Carvalho de Melo

Please Ack,

- Arnaldo

----

Fixing the common case of:

perf record
perf report

And getting just the cycles events.

We now have a 'dummy' event to get perf metadata events that take place while we synthesize metadata records for pre-existing processes by traversing procfs, so we always have this extra 'dummy' evsel, but we don't have to offer it as there will be no samples on it, remove this distraction.

Cc Adrian Hunter <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/ui/browsers/hists.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +17 -0
index 4cd556c1276f..be9c4c0549bc 100644
@@ -3603,6 +3603,23 @@ static int __perf_evlist__tui_browse_hists(struct evlist *evlist,
                                    hbt, warn_lost_event);
 }
 
+static bool perf_evlist__single_entry(struct evlist *evlist)
+{
+       int nr_entries = evlist->core.nr_entries;
+
+       if (nr_entries == 1)
+              return true;
+
+       if (nr_entries == 2) {
+               struct evsel *last = evlist__last(evlist);
+
+               if (evsel__is_dummy_event(last))
+                       return true;
+       }
+
+       return false;
+}
+
 int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help,
                                  struct hist_browser_timer *hbt,
                                  float min_pcnt,
@@ -3613,7 +3630,7 @@ int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help,
        int nr_entries = evlist->core.nr_entries;
 
Quoted 5 lines

tools/perf/ui/browsers/hists.c int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help, · line 3633

Quoted 3 lines
tools/perf/ui/browsers/hists.c +1 -1
 single_entry:
-       if (nr_entries == 1) {
+       if (perf_evlist__single_entry(evlist)) {

But I think it cannot cover the event group case below..

Right, we can fix that later, I think, my worry at this point was that the simplest case, which is:

   # perf record
   ^C
   # perf report

Would get that annoyance :-)

- Arnaldo

Quoted 10 lines

Thanks
Namhyung

Quoted 6 lines
tools/perf/ui/browsers/hists.c +0 -1
                struct evsel *first = evlist__first(evlist);
 
                return perf_evsel__hists_browse(first, nr_entries, help,
--

2.21.3

author Acked-by
#3 lore raw
Quoted 11 lines · Arnaldo Carvalho de Melo

Em Fri, Jul 03, 2020 at 10:44:28PM +0900, Namhyung Kim escreveu:

Quoted 8 lines

Review int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help, · line 3633

Quoted 6 lines
(quoted diff) +1 -1
@@ -3613,7 +3630,7 @@ int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help,
        int nr_entries = evlist->core.nr_entries;
 
 single_entry:
-       if (nr_entries == 1) {
+       if (perf_evlist__single_entry(evlist)) {

But I think it cannot cover the event group case below..

Quoted 8 lines

Right, we can fix that later, I think, my worry at this point was that the simplest case, which is:

   # perf record
   ^C
   # perf report

Would get that annoyance :-)

Right, then I suggest moving the 'single_entry' label to inside of the if statement.
With that applied,

Thanks
Namhyung