Skip to contentSkip to conversation

perf tools: Prevent condition that all sort keys are elided

PATCH In review Namhyung Kim 3 participants 4 messages Nov 8, 2013 – Nov 12, 2013 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf tools: Prevent condition that all sort keys are elided

From: Namhyung Kim <[email protected]>

If given sort keys are all elided there'll be no output except for the overhead column - actually the TUI shows a noisy output. In this case it'd be better to show up the sort keys rather than elide.

Before:

  $ perf report -s comm -c perf
  (...)
  # Overhead
  # ........
  #
     100.00%

After:

  $ perf report -s comm -c perf
  (...)
  # Overhead  Command
  # ........  .......
  #
     100.00%     perf
---
 tools/perf/util/sort.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
tools/perf/util/sort.c +12 -0
index 3c1b75c8b9a6..fb7d556ad721 100644
@@ -1137,6 +1137,8 @@ static void sort_entry__setup_elide(struct sort_entry *se,
 
 void sort__setup_elide(FILE *output)
 {
+	struct sort_entry *se;
+
 	sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list,
 				"dso", output);
 	sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list,
@@ -1172,4 +1174,14 @@ void sort__setup_elide(FILE *output)
 					"snoop", output);
 	}
 
+	/*
+	 * It makes no sense to elide all of sort entries.
+	 * Just revert them to show up again.
+	 */
+	list_for_each_entry(se, &hist_entry__sort_list, list)
+		if (!se->elide)
+			return;
+
+	list_for_each_entry(se, &hist_entry__sort_list, list)
+		se->elide = false;
 }
Signature · 1 line
1.7.11.7
Acked-by on v1 1/1
#1 lore raw
Quoted 43 lines · Namhyung Kim

From: Namhyung Kim <[email protected]>

If given sort keys are all elided there'll be no output except for the overhead column - actually the TUI shows a noisy output. In this case it'd be better to show up the sort keys rather than elide.

Before:

  $ perf report -s comm -c perf
  (...)
  # Overhead
  # ........
  #
     100.00%

After:

  $ perf report -s comm -c perf
  (...)
  # Overhead  Command
  # ........  .......
  #
     100.00%     perf
---
 tools/perf/util/sort.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
tools/perf/util/sort.c +2 -0
index 3c1b75c8b9a6..fb7d556ad721 100644
@@ -1137,6 +1137,8 @@ static void sort_entry__setup_elide(struct sort_entry *se,
 
 void sort__setup_elide(FILE *output)
 {
+	struct sort_entry *se;
+
 	sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list,
 				"dso", output);
 	sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list,

tools/perf/util/sort.c void sort__setup_elide(FILE *output) · line 1183

Quoted 10 lines
tools/perf/util/sort.c +7 -0
@@ -1172,4 +1174,14 @@ void sort__setup_elide(FILE *output)
 					"snoop", output);
 	}
 
+	/*
+	 * It makes no sense to elide all of sort entries.
+	 * Just revert them to show up again.
+	 */
+	list_for_each_entry(se, &hist_entry__sort_list, list)
+		if (!se->elide)
+			return;

(Nit: please use curly braces around multi-line statements.)

tools/perf/util/sort.c void sort__setup_elide(FILE *output) · line 1186

Quoted 3 lines
tools/perf/util/sort.c +3 -0
+
+	list_for_each_entry(se, &hist_entry__sort_list, list)
+		se->elide = false;

Looks good otherwise - this is the first step in the sort/key behavior improvements that we talked about a few days ago, right?

Thanks,

Ingo

author maintainer
#2 lore raw

Hi Ingo,

Quoted 10 lines · Ingo Molnar

tools/perf/util/sort.c void sort__setup_elide(FILE *output) · line 1183

Quoted 7 lines · Namhyung Kim
tools/perf/util/sort.c +7 -0
+	/*
+	 * It makes no sense to elide all of sort entries.
+	 * Just revert them to show up again.
+	 */
+	list_for_each_entry(se, &hist_entry__sort_list, list)
+		if (!se->elide)
+			return;

(Nit: please use curly braces around multi-line statements.)

Ah, okay.

Quoted 7 lines

tools/perf/util/sort.c void sort__setup_elide(FILE *output) · line 1186

Quoted 4 lines
tools/perf/util/sort.c +3 -0
+
+	list_for_each_entry(se, &hist_entry__sort_list, list)
+		se->elide = false;

Looks good otherwise - this is the first step in the sort/key behavior improvements that we talked about a few days ago, right?

Right. And I'd like to wait bit more to hear other's opinion on this.

Quoted 2 lines

Thanks,
Namhyung

#3 lore raw
In reply to Namhyung Kim
perf tools: Prevent condition that all sort keys are elided
Commit-ID:  7524f63b997cc02a80aa073558728ae3ee242cf8
Gitweb:     http://git.kernel.org/tip/7524f63b997cc02a80aa073558728ae3ee242cf8
Author:     Namhyung Kim <[email protected]>
AuthorDate: Fri, 8 Nov 2013 17:53:42 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 11 Nov 2013 15:56:40 -0300

perf tools: Prevent condition that all sort keys are elided

If given sort keys are all elided there'll be no output except for the overhead column - actually the TUI shows a noisy output. In this case it'd be better to show up the sort keys rather than elide.

Before:

  $ perf report -s comm -c perf
  (...)
  # Overhead
  # ........
  #
     100.00%

After:

  $ perf report -s comm -c perf
  (...)
  # Overhead  Command
  # ........  .......
  #
     100.00%     perf
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
[ Us curly braces around multi-line statements, as requested by Ingo Molnar ]
---
 tools/perf/util/sort.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
tools/perf/util/sort.c +13 -0
index 3c1b75c..8b0bb1f 100644
@@ -1137,6 +1137,8 @@ static void sort_entry__setup_elide(struct sort_entry *se,
 
 void sort__setup_elide(FILE *output)
 {
+	struct sort_entry *se;
+
 	sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list,
 				"dso", output);
 	sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list,
@@ -1172,4 +1174,15 @@ void sort__setup_elide(FILE *output)
 					"snoop", output);
 	}
 
+	/*
+	 * It makes no sense to elide all of sort entries.
+	 * Just revert them to show up again.
+	 */
+	list_for_each_entry(se, &hist_entry__sort_list, list) {
+		if (!se->elide)
+			return;
+	}
+
+	list_for_each_entry(se, &hist_entry__sort_list, list)
+		se->elide = false;
 }