Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1344843

[PATCH 07/19] perf report: Show message for percent limit on stdio

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 07/19] perf report: Show message for percent limit on stdio
Date 2016-02-27 00:30 +0100
Message-ID <r6zZE-2as-35@gated-at.bofh.it> (permalink)
References <r6zPY-26L-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Namhyung Kim <namhyung@kernel.org>

When the hierarchy mode is used, some entries might be omiited due to a
percent limit or filter.  In this case the output hierarchy is different
than other entries.  Add an informative message to users about this.

For example, when 4% of percent limit is applied:

Before:
  #       Overhead  Command / Shared Object / Symbol
  # ..............  ..........................................
  #
      49.09%        swapper
         48.67%        [kernel.vmlinux]
            34.42%        [k] intel_idle
      11.51%        firefox
          8.87%        libpthread-2.22.so
             6.60%        [.] __GI___libc_recvmsg
      10.49%        gnome-shell
          4.74%        libc-2.22.so
      10.08%        Xorg
          6.11%        libc-2.22.so
             5.27%        [.] __memcpy_sse2_unaligned
       6.15%        perf

Note that, gnome-shell/libc has no symbols and perf has no dso/symbols.
With that patch the output will look like below:

After:

  #       Overhead  Command / Shared Object / Symbol
  # ..............  ..........................................
  #
      49.09%        swapper
         48.67%        [kernel.vmlinux]
            34.42%        [k] intel_idle
      11.51%        firefox
          8.87%        libpthread-2.22.so
             6.60%        [.] __GI___libc_recvmsg
      10.49%        gnome-shell
          4.74%        libc-2.22.so
                          no entry >= 4.00%
      10.08%        Xorg
          6.11%        libc-2.22.so
             5.27%        [.] __memcpy_sse2_unaligned
       6.15%        perf
                       no entry >= 4.00%

Suggested-and-Tested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456488800-28124-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/stdio/hist.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 435eaaaf2f1d..b3bdfcb245f9 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -628,6 +628,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
 	bool first = true;
 	size_t linesz;
 	char *line = NULL;
+	unsigned indent;
 
 	init_rem_hits();
 
@@ -704,6 +705,8 @@ print_entries:
 		goto out;
 	}
 
+	indent = hists__overhead_width(hists) + 4;
+
 	for (nd = rb_first(&hists->entries); nd; nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD)) {
 		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
 		float percent;
@@ -720,6 +723,20 @@ print_entries:
 		if (max_rows && ++nr_rows >= max_rows)
 			break;
 
+		/*
+		 * If all children are filtered out or percent-limited,
+		 * display "no entry >= x.xx%" message.
+		 */
+		if (!h->leaf && !hist_entry__has_hierarchy_children(h, min_pcnt)) {
+			int nr_sort = hists->hpp_list->nr_sort_keys;
+
+			print_hierarchy_indent(sep, nr_sort + h->depth + 1, spaces, fp);
+			fprintf(fp, "%*sno entry >= %.2f%%\n", indent, "", min_pcnt);
+
+			if (max_rows && ++nr_rows >= max_rows)
+				break;
+		}
+
 		if (h->ms.map == NULL && verbose > 1) {
 			__map_groups__fprintf_maps(h->thread->mg,
 						   MAP__FUNCTION, fp);
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100
  [PATCH 04/19] perf script: Exception handling when the print fmt is empty Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100
  [PATCH 13/19] perf report: Left align dynamic entries in hierarchy Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100
  [PATCH 11/19] perf hists: Fix comparing of dynamic entries Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100
  [PATCH 15/19] perf report: Update column width of dynamic entries Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 10/19] perf report: Show message for percent limit on gtk Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 06/19] perf hists: Add more helper functions for the hierarchy mode Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 18/19] perf trace: Call bpf__apply_obj_config in 'perf trace' Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 14/19] perf hists: Fix dynamic entry display in hierarchy Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 03/19] perf tools: Fix parsing of pmu events with empty list of modifiers Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 16/19] perf config: Bring perf_default_config to the very beginning at main() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 08/19] perf hists browser: Cleanup hist_browser__update_percent_limit() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 01/19] perf tools: Use asprintf() for simple string formatting/allocation Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 02/19] perf jvmti: improve error message in Makefile Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 19/19] perf trace: Print content of bpf-output event Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 09/19] perf hists browser: Show message for percent limit Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 05/19] perf script: Remove duplicated code and needless script_spec__findnew() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 07/19] perf report: Show message for percent limit on stdio Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  Re: [GIT PULL 00/19] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-02-27 10:40 +0100

csiph-web