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


Groups > linux.kernel > #1338565

[PATCH 22/22] perf report: Check error during report__collapse_hists()

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 22/22] perf report: Check error during report__collapse_hists()
Date 2016-02-19 23:50 +0100
Message-ID <r4227-3Wq-49@gated-at.bofh.it> (permalink)
References <r4226-3Wq-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Namhyung Kim <namhyung@kernel.org>

If it returns an error, warn user and bail out instead of silently
ignoring it.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1455631723-17345-9-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1eab50ac1ef6..760e886ca9d9 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -469,10 +469,11 @@ static int report__browse_hists(struct report *rep)
 	return ret;
 }
 
-static void report__collapse_hists(struct report *rep)
+static int report__collapse_hists(struct report *rep)
 {
 	struct ui_progress prog;
 	struct perf_evsel *pos;
+	int ret = 0;
 
 	ui_progress__init(&prog, rep->nr_entries, "Merging related events...");
 
@@ -484,7 +485,9 @@ static void report__collapse_hists(struct report *rep)
 
 		hists->socket_filter = rep->socket_filter;
 
-		hists__collapse_resort(hists, &prog);
+		ret = hists__collapse_resort(hists, &prog);
+		if (ret < 0)
+			break;
 
 		/* Non-group events are considered as leader */
 		if (symbol_conf.event_group &&
@@ -497,6 +500,7 @@ static void report__collapse_hists(struct report *rep)
 	}
 
 	ui_progress__finish();
+	return ret;
 }
 
 static void report__output_resort(struct report *rep)
@@ -564,7 +568,11 @@ static int __cmd_report(struct report *rep)
 		}
 	}
 
-	report__collapse_hists(rep);
+	ret = report__collapse_hists(rep);
+	if (ret) {
+		ui__error("failed to process hist entry\n");
+		return ret;
+	}
 
 	if (session_done())
 		return 0;
-- 
2.5.0

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


Thread

[GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 09/22] perf tools: Create config_term_names array Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 11/22] perf tools: Rename and move pmu_event_name to get_config_name Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 18/22] perf callchain: Add enum match_result for match_chain() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 03/22] perf evlist: Handle -EINVAL for sample_freq > max_sample_rate in strerror_open() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 16/22] perf callchain: Check return value of add_child() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 05/22] perf test: Reduce the sample_freq for the 'object code reading' test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 13/22] perf tools: Enable config raw and numeric events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 17/22] perf callchain: Check return value of fill_node() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 12/22] perf tools: Introduce opt_event_config nonterminal Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 01/22] perf evlist: Reference count the cpu and thread maps at set_maps() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 04/22] perf tests: Use perf_evlist__strerror_open() to provide hints about max_freq Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 21/22] perf hists: Return error from hists__collapse_resort() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 19/22] perf callchain: Check return value of split_add_child() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 06/22] perf stat: Handled scaled == -1 case for counters Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 02/22] perf record: Add --all-user/--all-kernel options Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 22/22] perf report: Check error during report__collapse_hists() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 08/22] perf tools: Fix checking asprintf return value Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 07/22] perf bpf: Rename bpf_prog_priv__clear() to clear_prog_priv() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 20/22] perf callchain: Check return value of append_chain_children() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 15/22] perf hists browser: Fix percentage update on key press Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  [PATCH 14/22] perf tools: Enable config and setting names for legacy cache events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-19 23:50 +0100
  Re: [GIT PULL 00/22] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-02-20 12:00 +0100

csiph-web