Skip to contentSkip to conversation

perf tool: add hists__init for perf diff

PATCH In review [email protected] 3 participants 3 messages Oct 22, 2014 – Oct 24, 2014 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tool: add hists__init for perf diff

From: Kan Liang <[email protected]>

perf diff also uses hists/hist_entries, hists__init() should be called before creating any evsels.

---
 tools/perf/builtin-diff.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/builtin-diff.c +5 -0
index 8c5c11c..25114c9 100644
@@ -1142,6 +1142,11 @@ static int data_init(int argc, const char **argv)
 
 int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
 {
+	int ret = hists__init();
+
+	if (ret < 0)
+		return ret;
+
 	perf_config(perf_default_config, NULL);
 
 	argc = parse_options(argc, argv, options, diff_usage, 0);
Signature · 1 line
1.8.3.2
#1 lore raw

Em Wed, Oct 22, 2014 at 03:02:41PM -0400, [email protected] escreveu:

Quoted 4 lines

From: Kan Liang <[email protected]>

perf diff also uses hists/hist_entries, hists__init() should be called before creating any evsels.

Thanks, this one merits perf/urgent :-\

- Arnaldo

Quoted 23 lines
---
 tools/perf/builtin-diff.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/builtin-diff.c +5 -0
index 8c5c11c..25114c9 100644
@@ -1142,6 +1142,11 @@ static int data_init(int argc, const char **argv)
 
 int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
 {
+	int ret = hists__init();
+
+	if (ret < 0)
+		return ret;
+
 	perf_config(perf_default_config, NULL);
 
 	argc = parse_options(argc, argv, options, diff_usage, 0);
Signature · 1 line
1.8.3.2
#2 lore raw

[tip:perf/urgent] perf diff: Add missing hists__init() call at tool start

In reply to [email protected]
perf diff: Add missing hists__init() call at tool start
Commit-ID:  9ab1f50876dbb8b962db058259be7aae920d4c25
Gitweb:     http://git.kernel.org/tip/9ab1f50876dbb8b962db058259be7aae920d4c25
Author:     Kan Liang <[email protected]>
AuthorDate: Wed, 22 Oct 2014 15:02:41 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 22 Oct 2014 16:31:06 -0300

perf diff: Add missing hists__init() call at tool start

It also uses hists/hist_entries, hists__init() should be called before creating any evsels.

Otherwise no extra space will be allocated per perf_evsel nor this space will be initialized when allocating a new perf_evsel instance, resulting in reads/writes to non allocated space, oops. Fix it.

---
 tools/perf/builtin-diff.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/builtin-diff.c +5 -0
index 8c5c11c..25114c9 100644
@@ -1142,6 +1142,11 @@ static int data_init(int argc, const char **argv)
 
 int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
 {
+	int ret = hists__init();
+
+	if (ret < 0)
+		return ret;
+
 	perf_config(perf_default_config, NULL);
 
 	argc = parse_options(argc, argv, options, diff_usage, 0);