Skip to contentSkip to conversation

perf tools: Update on filtered entries' percentage output

PATCH In review Namhyung Kim 3 participants 11 messages Jan 14, 2014 – Jan 16, 2014 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

cover perf tools: Update on filtered entries' percentage output

Hello,

I added --percentage option to perf report to control display of percentage of filtered entries.

usage: perf report [<options>]

--percentage <relative|absolute>
how to display percentage of filtered entries

"relative" means it's relative to filtered entries only so that the sum of shown entries will be always 100%. "absolute" means it retains original value before and after the filter applied. In patch 5, I made the "absolute" as default since it makes more sense IMHO.

      $ perf report -s comm
      # Overhead       Command
      # ........  ............
      #
          74.19%           cc1
           7.61%           gcc
           6.11%            as
           4.35%            sh
           4.14%          make
           1.13%        fixdep
      ...
      $ perf report -s comm -c cc1,gcc --percentage absolute
      # Overhead       Command
      # ........  ............
      #
          74.19%           cc1
           7.61%           gcc
      $ perf report -s comm -c cc1,gcc --percentage relative
      # Overhead       Command
      # ........  ............
      #
          90.69%           cc1
           9.31%           gcc

Note that it has zero effect if no filter was applied.

I only added the option to perf report for now. If it looks good to you I'll add it to perf top too.

Any comments are welcome, thanks
Namhyung

Namhyung Kim (5):
perf tools: Count filtered entries to total period also perf ui/tui: Add support for showing relative percentage perf report: Add --percentage option
perf report: Add report.percentage config option perf tools: Show absolute percentage by default

 tools/perf/Documentation/perf-report.txt |  6 ++++++
 tools/perf/builtin-report.c              | 28 +++++++++++++++++++++++++++-
 tools/perf/util/event.c                  | 18 ++++++++----------
 tools/perf/util/hist.c                   | 27 ++++++++++++++-------------
 tools/perf/util/hist.h                   |  7 +++++++
 tools/perf/util/symbol.h                 |  5 +++--
 6 files changed, 65 insertions(+), 26 deletions(-)
Signature · 1 line
1.7.11.7
author maintainer
#1 lore raw

PATCH 1/5 perf tools: Count filtered entries to total period also

Currently if a sample was filtered by command line option, it just dropped. But this affects final output in that the percentage can be different since the filtered entries were not included to the total.

But user might want to see the original percentages when filter applied so change the behavior depends on a new symbol_conf.filter_ relative value in order to be controlled by user later.

---
 tools/perf/builtin-report.c |  2 +-
 tools/perf/util/event.c     | 18 ++++++++----------
 tools/perf/util/hist.c      | 12 +++---------
 tools/perf/util/hist.h      |  7 +++++++
 tools/perf/util/symbol.c    |  1 +
 tools/perf/util/symbol.h    |  5 +++--
 6 files changed, 23 insertions(+), 22 deletions(-)
tools/perf/builtin-report.c +1 -1
index 46864dd7eb83..664a3dcdf0e0 100644
@@ -247,7 +247,7 @@ static int process_sample_event(struct perf_tool *tool,
 		return -1;
 	}
 
-	if (al.filtered || (rep->hide_unresolved && al.sym == NULL))
+	if (rep->hide_unresolved && al.sym == NULL)
 		return 0;
 
 	if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap))
tools/perf/util/event.c +8 -10
index 1fc1c2f04772..f5a0bcd6be64 100644
@@ -3,6 +3,7 @@
 #include "debug.h"
 #include "machine.h"
 #include "sort.h"
+#include "hist.h"
 #include "string.h"
 #include "strlist.h"
 #include "thread.h"
@@ -663,7 +664,7 @@ void thread__find_addr_map(struct thread *thread,
 	al->thread = thread;
 	al->addr = addr;
 	al->cpumode = cpumode;
-	al->filtered = false;
+	al->filtered = 0;
 
 	if (machine == NULL) {
 		al->map = NULL;
@@ -750,9 +751,6 @@ int perf_event__preprocess_sample(const union perf_event *event,
 	if (thread == NULL)
 		return -1;
 
-	if (thread__is_filtered(thread))
-		goto out_filtered;
-
 	dump_printf(" ... thread: %s:%d\n", thread__comm_str(thread), thread->tid);
 	/*
 	 * Have we already created the kernel maps for this machine?
@@ -767,6 +765,10 @@ int perf_event__preprocess_sample(const union perf_event *event,
 
 	thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
 			      sample->ip, al);
+
+	if (thread__is_filtered(thread))
+		al->filtered |= (1 << HIST_FILTER__THREAD);
+
 	dump_printf(" ...... dso: %s\n",
 		    al->map ? al->map->dso->long_name :
 			al->level == 'H' ? "[hypervisor]" : "<not found>");
@@ -782,7 +784,7 @@ int perf_event__preprocess_sample(const union perf_event *event,
 			       (dso->short_name != dso->long_name &&
 				strlist__has_entry(symbol_conf.dso_list,
 						   dso->long_name)))))
-			goto out_filtered;
+			al->filtered |= (1 << HIST_FILTER__DSO);
 
 		al->sym = map__find_symbol(al->map, al->addr,
 					   machine->symbol_filter);
@@ -791,11 +793,7 @@ int perf_event__preprocess_sample(const union perf_event *event,
 	if (symbol_conf.sym_list &&
 		(!al->sym || !strlist__has_entry(symbol_conf.sym_list,
 						al->sym->name)))
-		goto out_filtered;
-
-	return 0;
+		al->filtered |= (1 << HIST_FILTER__SYMBOL);
 
-out_filtered:
-	al->filtered = true;
 	return 0;
 }
tools/perf/util/hist.c +3 -9
index 4ed3e883240d..2d81f3aefad0 100644
@@ -13,13 +13,6 @@ static bool hists__filter_entry_by_thread(struct hists *hists,
 static bool hists__filter_entry_by_symbol(struct hists *hists,
 					  struct hist_entry *he);
 
-enum hist_filter {
-	HIST_FILTER__DSO,
-	HIST_FILTER__THREAD,
-	HIST_FILTER__PARENT,
-	HIST_FILTER__SYMBOL,
-};
-
 struct callchain_param	callchain_param = {
 	.mode	= CHAIN_GRAPH_REL,
 	.min_percent = 0.5,
@@ -329,8 +322,9 @@ void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h)
 	if (!h->filtered) {
 		hists__calc_col_len(hists, h);
 		++hists->nr_entries;
-		hists->stats.total_period += h->stat.period;
 	}
+	if (!h->filtered || !symbol_conf.filter_relative)
+		hists->stats.total_period += h->stat.period;
 }
 
 static u8 symbol__parent_filter(const struct symbol *parent)
@@ -429,7 +423,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists,
 			.weight = weight,
 		},
 		.parent = sym_parent,
-		.filtered = symbol__parent_filter(sym_parent),
+		.filtered = symbol__parent_filter(sym_parent) | al->filtered,
 		.hists	= hists,
 		.branch_info = bi,
 		.mem_info = mi,
tools/perf/util/hist.h +7 -0
index a59743fa3ef7..7d1d973d9a39 100644
@@ -14,6 +14,13 @@ struct hist_entry;
 struct addr_location;
 struct symbol;
 
+enum hist_filter {
+	HIST_FILTER__DSO,
+	HIST_FILTER__THREAD,
+	HIST_FILTER__PARENT,
+	HIST_FILTER__SYMBOL,
+};
+
 /*
  * The kernel collects the number of events it couldn't send in a stretch and
  * when possible sends this number in a PERF_RECORD_LOST event. The number of
tools/perf/util/symbol.c +1 -0
index 39ce9adbaaf0..ac3d9748993c 100644
@@ -33,6 +33,7 @@ struct symbol_conf symbol_conf = {
 	.try_vmlinux_path = true,
 	.annotate_src	  = true,
 	.demangle	  = true,
+	.filter_relative  = true,
 	.symfs            = "",
 };
 
tools/perf/util/symbol.h +3 -2
index cbd680361806..4ccc5c4b3a65 100644
@@ -99,7 +99,8 @@ struct symbol_conf {
 			annotate_asm_raw,
 			annotate_src,
 			event_group,
-			demangle;
+			demangle,
+			filter_relative;
 	const char	*vmlinux_name,
 			*kallsyms_name,
 			*source_prefix,
@@ -170,7 +171,7 @@ struct addr_location {
 	struct symbol *sym;
 	u64	      addr;
 	char	      level;
-	bool	      filtered;
+	u8	      filtered;
 	u8	      cpumode;
 	s32	      cpu;
 };
Signature · 1 line
1.7.11.7
author maintainer
#2 lore raw

PATCH 2/5 perf ui/tui: Add support for showing relative percentage

In reply to Namhyung Kim

When filtering by thread, dso or symbol on TUI it also update total period so that the output shows different result than no filter - the percentage changed to relative to filtered entries only. Sometimes (always?) this is not desired since users might expect same results with filter.

So change this behavior depends on symbol_conf.filter_relative value.

---
 tools/perf/util/hist.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
tools/perf/util/hist.c +11 -4
index 2d81f3aefad0..58c799d9b689 100644
@@ -696,10 +696,11 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h
 		return;
 
 	++hists->nr_entries;
+	if (symbol_conf.filter_relative)
+		hists->stats.total_period += h->stat.period;
 	if (h->ms.unfolded)
 		hists->nr_entries += h->nr_rows;
 	h->row_offset = 0;
-	hists->stats.total_period += h->stat.period;
 	hists->stats.nr_events[PERF_RECORD_SAMPLE] += h->stat.nr_events;
 
 	hists__calc_col_len(hists, h);
@@ -722,7 +723,9 @@ void hists__filter_by_dso(struct hists *hists)
 {
 	struct rb_node *nd;
 
-	hists->nr_entries = hists->stats.total_period = 0;
+	hists->nr_entries = 0;
+	if (symbol_conf.filter_relative)
+		hists->stats.total_period = 0;
 	hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
 	hists__reset_col_len(hists);
 
@@ -755,7 +758,9 @@ void hists__filter_by_thread(struct hists *hists)
 {
 	struct rb_node *nd;
 
-	hists->nr_entries = hists->stats.total_period = 0;
+	hists->nr_entries = 0;
+	if (symbol_conf.filter_relative)
+		hists->stats.total_period = 0;
 	hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
 	hists__reset_col_len(hists);
 
@@ -786,7 +791,9 @@ void hists__filter_by_symbol(struct hists *hists)
 {
 	struct rb_node *nd;
 
-	hists->nr_entries = hists->stats.total_period = 0;
+	hists->nr_entries = 0;
+	if (symbol_conf.filter_relative)
+		hists->stats.total_period = 0;
 	hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
 	hists__reset_col_len(hists);
 
Signature · 1 line
1.7.11.7
author maintainer
#3 lore raw

PATCH 3/5 perf report: Add --percentage option

In reply to Namhyung Kim

The --percentage option is for controlling overhead percentage displayed. It can only receive either of "relative" or "absolute".

"relative" means it's relative to filtered entries only so that the sum of shown entries will be always 100%. "absolute" means it retains original value before and after the filter applied.

  $ perf report -s comm
  # Overhead       Command
  # ........  ............
  #
      74.19%           cc1
       7.61%           gcc
       6.11%            as
       4.35%            sh
       4.14%          make
       1.13%        fixdep
  ...
  $ perf report -s comm -c cc1,gcc --percentage absolute
  # Overhead       Command
  # ........  ............
  #
      74.19%           cc1
       7.61%           gcc
  $ perf report -s comm -c cc1,gcc --percentage relative
  # Overhead       Command
  # ........  ............
  #
      90.69%           cc1
       9.31%           gcc

Note that it has zero effect if no filter was applied.

---
 tools/perf/Documentation/perf-report.txt |  6 ++++++
 tools/perf/builtin-report.c              | 16 ++++++++++++++++
 2 files changed, 22 insertions(+)
tools/perf/Documentation/perf-report.txt +6 -0
index 8eab8a4bdeb8..9a67a42356d6 100644
@@ -237,6 +237,12 @@ OPTIONS
 	Do not show entries which have an overhead under that percent.
 	(Default: 0).
 
+--percentage::
+	Determine how to display the overhead percentage of filtered entries.
+	"relative" means it's relative to filtered entries only so that the
+	sum of shown entries will be always 100%.  "absolute" means it retains
+	original value before and after the filter applied.
+
 --header::
 	Show header information in the perf.data file.  This includes
 	various information like hostname, OS and perf version, cpu/mem
tools/perf/builtin-report.c +16 -0
index 664a3dcdf0e0..535bd6745355 100644
@@ -717,6 +717,20 @@ parse_percent_limit(const struct option *opt, const char *str,
 	return 0;
 }
 
+static int
+parse_percentage(const struct option *opt __maybe_unused, const char *str,
+		 int unset __maybe_unused)
+{
+	if (!strcmp(str, "relative"))
+		symbol_conf.filter_relative = true;
+	else if (!strcmp(str, "absolute"))
+		symbol_conf.filter_relative = false;
+	else
+		return -1;
+
+	return 0;
+}
+
 int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	struct perf_session *session;
@@ -839,6 +853,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_BOOLEAN(0, "mem-mode", &report.mem_mode, "mem access profile"),
 	OPT_CALLBACK(0, "percent-limit", &report, "percent",
 		     "Don't show entries under that percent", parse_percent_limit),
+	OPT_CALLBACK(0, "percentage", NULL, "relative|absolute",
+		     "how to display percentage of filtered entries", parse_percentage),
 	OPT_END()
 	};
 	struct perf_data_file file = {
Signature · 1 line
1.7.11.7
#4 lore raw

Re: [PATCH 3/5] perf report: Add --percentage option

Quoted 4 lines · Namhyung Kim

+--percentage::

(quoted diff) +1 -0
+	Determine how to display the overhead percentage of filtered

entries.

This should describe also what a "filtered entry" exactly is. It's not clear even to me.

-Andi

Quoted 4 lines
tools/perf/Documentation/perf-report.txt +4 -0
+	"relative" means it's relative to filtered entries only so that the
+	sum of shown entries will be always 100%.  "absolute" means it retains
+	original value before and after the filter applied.
+
Signature · 1 line
[email protected] -- Speaking for myself only
#5 lore raw

Re: [PATCH 3/5] perf report: Add --percentage option

Em Tue, Jan 14, 2014 at 01:07:00PM -0800, Andi Kleen escreveu:

Quoted 8 lines
Quoted 4 lines · Namhyung Kim

+--percentage::

(quoted diff) +1 -0
+	Determine how to display the overhead percentage of filtered

entries.

This should describe also what a "filtered entry" exactly is. It's not clear even to me.

Yeah, the text should give some context, mentioning the "Zoom" operations that can be done in the TUI (DSO, thread, etc) that allows applying what he is calling "filters".`

Quoted 9 lines

-Andi

Quoted 4 lines
tools/perf/Documentation/perf-report.txt +4 -0
+	"relative" means it's relative to filtered entries only so that the
+	sum of shown entries will be always 100%.  "absolute" means it retains
+	original value before and after the filter applied.
+
Signature · 1 line
[email protected] -- Speaking for myself only
author maintainer
#6 lore raw

Re: [PATCH 3/5] perf report: Add --percentage option

Quoted 10 lines · Arnaldo Carvalho de Melo

Em Tue, Jan 14, 2014 at 01:07:00PM -0800, Andi Kleen escreveu:

Quoted 8 lines
Quoted 4 lines · Namhyung Kim

+--percentage::

(quoted diff) +1 -0
+	Determine how to display the overhead percentage of filtered

entries.

This should describe also what a "filtered entry" exactly is. It's not clear even to me.

Quoted 3 lines

Yeah, the text should give some context, mentioning the "Zoom" operations that can be done in the TUI (DSO, thread, etc) that allows applying what he is calling "filters".`

Ah, okay.

How about this:

-c::
--comms=::
Only consider symbols in these comms. CSV that understands file://filename entries. This option will affect the percentage of overhead column. See --percentage for more info.
-d::
--dsos=::
Only consider symbols in these dsos. CSV that understands file://filename entries. This option will affect the percentage of overhead column. See --percentage for more info.
-S::
--symbols=::
Only consider these symbols. CSV that understands file://filename entries. This option will affect the percentage of overhead column. See --percentage for more info.

--percentage::
Determine how to display the overhead percentage of filtered entries. Filters can be applied by --comms, --dsos and/or --symbols options and Zoom operations on the TUI (thread, dso, etc).

"relative" means it's relative to filtered entries only so that the sum of shown entries will be always 100%. "absolute" means it retains original value before and after the filter applied.

Thanks,
Namhyung

#7 lore raw

Re: [PATCH 3/5] perf report: Add --percentage option

Em Wed, Jan 15, 2014 at 11:18:23AM +0900, Namhyung Kim escreveu:

Quoted 11 lines · Arnaldo Carvalho de Melo
Quoted 10 lines

Em Tue, Jan 14, 2014 at 01:07:00PM -0800, Andi Kleen escreveu:

Quoted 8 lines
Quoted 4 lines · Namhyung Kim

+--percentage::

(quoted diff) +1 -0
+	Determine how to display the overhead percentage of filtered

entries.

This should describe also what a "filtered entry" exactly is. It's not clear even to me.

Quoted 7 lines
Quoted 3 lines

Yeah, the text should give some context, mentioning the "Zoom" operations that can be done in the TUI (DSO, thread, etc) that allows applying what he is calling "filters".`

Ah, okay.

How about this:

Ack, much clearer, minor things below:

Quoted 6 lines

-c::
--comms=::
Only consider symbols in these comms. CSV that understands file://filename entries. This option will affect the percentage of overhead column. See --percentage for more info.

the overhead column. ...

Quoted 5 lines

-d::
--dsos=::
Only consider symbols in these dsos. CSV that understands file://filename entries. This option will affect the percentage of overhead column. See --percentage for more info.

ditto

Quoted 5 lines

-S::
--symbols=::
Only consider these symbols. CSV that understands file://filename entries. This option will affect the percentage of overhead column. See --percentage for more info.

ditto

Quoted 9 lines

--percentage::
Determine how to display the overhead percentage of filtered entries. Filters can be applied by --comms, --dsos and/or --symbols options and Zoom operations on the TUI (thread, dso, etc).

"relative" means it's relative to filtered entries only so that the sum of shown entries will be always 100%. "absolute" means it retains original value before and after the filter applied.

Another missing 'the': "... retains the original value ..." plus a missing 'is' just before 'applied'.

- Arnaldo

author maintainer
#8 lore raw

Re: [PATCH 3/5] perf report: Add --percentage option

Quoted 16 lines · Arnaldo Carvalho de Melo

Em Wed, Jan 15, 2014 at 11:18:23AM +0900, Namhyung Kim escreveu:

Quoted 15 lines · Arnaldo Carvalho de Melo
Quoted 13 lines

Em Tue, Jan 14, 2014 at 01:07:00PM -0800, Andi Kleen escreveu:

Quoted 8 lines
Quoted 4 lines · Namhyung Kim

+--percentage::

(quoted diff) +1 -0
+	Determine how to display the overhead percentage of filtered

entries.

This should describe also what a "filtered entry" exactly is. It's not clear even to me.

Yeah, the text should give some context, mentioning the "Zoom" operations that can be done in the TUI (DSO, thread, etc) that allows applying what he is calling "filters".`

Quoted 5 lines
Quoted 3 lines

Ah, okay.

How about this:

Ack, much clearer, minor things below:

Here goes an update :)

Quoted 1 line

From abd3ee476573087339794730bf8797913cf1a909 Mon Sep 17 00:00:00 2001

From: Namhyung Kim <[email protected]>
Date: Tue, 14 Jan 2014 11:52:48 +0900
Subject: [PATCH] perf report: Add --percentage option

The --percentage option is for controlling overhead percentage displayed. It can only receive either of "relative" or "absolute".

"relative" means it's relative to filtered entries only so that the sum of shown entries will be always 100%. "absolute" means it retains the original value before and after the filter is applied.

  $ perf report -s comm
  # Overhead       Command
  # ........  ............
  #
      74.19%           cc1
       7.61%           gcc
       6.11%            as
       4.35%            sh
       4.14%          make
       1.13%        fixdep
  ...
  $ perf report -s comm -c cc1,gcc --percentage absolute
  # Overhead       Command
  # ........  ............
  #
      74.19%           cc1
       7.61%           gcc
  $ perf report -s comm -c cc1,gcc --percentage relative
  # Overhead       Command
  # ........  ............
  #
      90.69%           cc1
       9.31%           gcc

Note that it has zero effect if no filter was applied.

---
 tools/perf/Documentation/perf-report.txt | 24 ++++++++++++++++++------
 tools/perf/builtin-report.c              | 16 ++++++++++++++++
 2 files changed, 34 insertions(+), 6 deletions(-)
tools/perf/Documentation/perf-report.txt +18 -6
index 8eab8a4bdeb8..09af66298564 100644
@@ -25,10 +25,6 @@ OPTIONS
 --verbose::
         Be more verbose. (show symbol address, etc)
 
--d::
---dsos=::
-	Only consider symbols in these dsos. CSV that understands
-	file://filename entries.
 -n::
 --show-nr-samples::
 	Show the number of samples for each symbol
@@ -42,11 +38,18 @@ OPTIONS
 -c::
 --comms=::
 	Only consider symbols in these comms. CSV that understands
-	file://filename entries.
+	file://filename entries.  This option will affect the percentage of
+	the overhead column.  See --percentage for more info.
+-d::
+--dsos=::
+	Only consider symbols in these dsos. CSV that understands
+	file://filename entries.  This option will affect the percentage of
+	the overhead column.  See --percentage for more info.
 -S::
 --symbols=::
 	Only consider these symbols. CSV that understands
-	file://filename entries.
+	file://filename entries.  This option will affect the percentage of
+	the overhead column.  See --percentage for more info.
 
 --symbol-filter=::
 	Only show symbols that match (partially) with this filter.
@@ -237,6 +240,15 @@ OPTIONS
 	Do not show entries which have an overhead under that percent.
 	(Default: 0).
 
+--percentage::
+	Determine how to display the overhead percentage of filtered entries.
+	Filters can be applied by --comms, --dsos and/or --symbols options and
+	Zoom operations on the TUI (thread, dso, etc).
+
+	"relative" means it's relative to filtered entries only so that the
+	sum of shown entries will be always 100%.  "absolute" means it retains
+	the original value before and after the filter is applied.
+
 --header::
 	Show header information in the perf.data file.  This includes
 	various information like hostname, OS and perf version, cpu/mem
tools/perf/builtin-report.c +16 -0
index dddacb0056e3..cb81d45e514c 100644
@@ -699,6 +699,20 @@ parse_percent_limit(const struct option *opt, const char *str,
 	return 0;
 }
 
+static int
+parse_percentage(const struct option *opt __maybe_unused, const char *str,
+		 int unset __maybe_unused)
+{
+	if (!strcmp(str, "relative"))
+		symbol_conf.filter_relative = true;
+	else if (!strcmp(str, "absolute"))
+		symbol_conf.filter_relative = false;
+	else
+		return -1;
+
+	return 0;
+}
+
 int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	struct perf_session *session;
@@ -821,6 +835,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_BOOLEAN(0, "mem-mode", &report.mem_mode, "mem access profile"),
 	OPT_CALLBACK(0, "percent-limit", &report, "percent",
 		     "Don't show entries under that percent", parse_percent_limit),
+	OPT_CALLBACK(0, "percentage", NULL, "relative|absolute",
+		     "how to display percentage of filtered entries", parse_percentage),
 	OPT_END()
 	};
 	struct perf_data_file file = {
Signature · 1 line
1.7.11.7
author maintainer
#9 lore raw

PATCH 4/5 perf report: Add report.percentage config option

In reply to Namhyung Kim

Add report.percentage option for setting default value of the symbol_conf.filter_relative. It affects the report output only if a filter applied.

An user can write .perfconfig file like below to show absolute percentage of filtered entries by default:

  $ cat ~/.perfconfig
  [report]
  percentage = absolute

And it can be changed through command line:

  $ perf report --percentage relative
---
 tools/perf/builtin-report.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
tools/perf/builtin-report.c +10 -0
index 535bd6745355..1bb9e989c7bd 100644
@@ -71,6 +71,16 @@ static int report__config(const char *var, const char *value, void *cb)
 		rep->min_percent = strtof(value, NULL);
 		return 0;
 	}
+	if (!strcmp(var, "report.percentage")) {
+		if (!strcmp(value, "relative"))
+			symbol_conf.filter_relative = true;
+		else if (!strcmp(value, "absolute"))
+			symbol_conf.filter_relative = false;
+		else
+			return -1;
+
+		return 0;
+	}
 
 	return perf_default_config(var, value, cb);
 }
Signature · 1 line
1.7.11.7
author maintainer
#10 lore raw

PATCH 5/5 perf tools: Show absolute percentage by default

In reply to Namhyung Kim

Now perf report will show absolute percentage on filter entries by default.

---
 tools/perf/util/symbol.c | 1 -
 1 file changed, 1 deletion(-)
tools/perf/util/symbol.c +0 -1
index ac3d9748993c..39ce9adbaaf0 100644
@@ -33,7 +33,6 @@ struct symbol_conf symbol_conf = {
 	.try_vmlinux_path = true,
 	.annotate_src	  = true,
 	.demangle	  = true,
-	.filter_relative  = true,
 	.symfs            = "",
 };
 
Signature · 1 line
1.7.11.7