Skip to contentSkip to conversation

perf tools: Parent option related fixies for report

PATCH In review Jiri Olsa 5 participants 13 messages Jun 25, 2013 – Jul 19, 2013 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

cover perf tools: Parent option related fixies for report

hi,
sending fixies for parent option in report command pluhs one unrelated oneliner.

thanks,
jirka

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
Cc Stephane Eranian <[email protected]>

---
Jiri Olsa (5):
perf tools: Remove callchain_cursor_reset call
perf tools: Fix -x/--exclude-other option for report command perf tools: Do not elide parent symbol column
perf tools: Introduce new -P/--parent-deep report option perf tools: Fix perf_session__delete removal for report command

 tools/perf/Documentation/perf-report.txt |  5 +++++
 tools/perf/builtin-diff.c                |  1 -
 tools/perf/builtin-report.c              | 46 ++++++++++++++++++----------------------------
 tools/perf/builtin-top.c                 |  2 --
 tools/perf/util/machine.c                |  6 +++---
 tools/perf/util/symbol.c                 |  1 -
 tools/perf/util/symbol.h                 |  3 ++-
 7 files changed, 28 insertions(+), 36 deletions(-)
author
#1 lore raw

PATCH 1/5 perf tools: Remove callchain_cursor_reset call

Removing callchain_cursor_reset call as it is called in subsequent machine__resolve_callchain_sample function.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/machine.c | 2 --
 1 file changed, 2 deletions(-)
tools/perf/util/machine.c +0 -2
index b2ecad6..93527af 100644
@@ -1242,8 +1242,6 @@ int machine__resolve_callchain(struct machine *machine,
 {
 	int ret;
 
-	callchain_cursor_reset(&callchain_cursor);
-
 	ret = machine__resolve_callchain_sample(machine, thread,
 						sample->callchain, parent);
 	if (ret)
Signature · 1 line
1.7.11.7
Acked-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] perf tools: Remove callchain_cursor_reset call

Quoted 25 lines · Jiri Olsa

Removing callchain_cursor_reset call as it is called in subsequent machine__resolve_callchain_sample function.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
Cc Stephane Eranian <[email protected]>
---
  tools/perf/util/machine.c | 2 --
  1 file changed, 2 deletions(-)
tools/perf/util/machine.c +0 -0
index b2ecad6..93527af 100644

tools/perf/util/machine.c int machine__resolve_callchain(struct machine *machine, · line 1247

Quoted 8 lines
tools/perf/util/machine.c +0 -2
@@ -1242,8 +1242,6 @@ int machine__resolve_callchain(struct machine *machine,
  {
  	int ret;
 
-	callchain_cursor_reset(&callchain_cursor);
-
  	ret = machine__resolve_callchain_sample(machine, thread,
  						sample->callchain, parent);
  	if (ret)

I noticed this duplication as well.

author
#3 lore raw

PATCH 2/5 perf tools: Fix -x/--exclude-other option for report command

In reply to Jiri Olsa

Currently we have symbol_conf.exclude_other being set as true every time so the -x/--exclude-other has nothing to do. Also we have no way to see the data with symbol_conf.exclude_other being false which is useful sometimes.

Fixing it by making symbol_conf.exclude_other false by default.

1) Example without -x option:

  $ perf report -i perf.data.delete -p perf_session__delete -s parent
  +  99.91%  [other]
  +   0.08%  perf_session__delete
  +   0.00%  perf_session__delete_dead_threads
  +   0.00%  perf_session__delete_threads

2) Example with -x option:

  $ ./perf report -i perf.data.delete -p perf_session__delete -s parent -x
  +  96.22%  perf_session__delete
  +   1.89%  perf_session__delete_dead_threads
  +   1.89%  perf_session__delete_threads

In Example 1) we get the sorted out data together with the rest "[other]". This could help us estimate how much time we spent in the sorted data.

In Example 2) the total is just the sorted data.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/builtin-diff.c   | 1 -
 tools/perf/builtin-report.c | 3 +--
 tools/perf/builtin-top.c    | 2 --
 tools/perf/util/symbol.c    | 1 -
 4 files changed, 1 insertion(+), 6 deletions(-)
tools/perf/builtin-diff.c +0 -1
index da8f8eb..0aac5f3 100644
@@ -607,7 +607,6 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
 		input_new = "perf.data.guest";
 	}
 
-	symbol_conf.exclude_other = false;
 	if (symbol__init() < 0)
 		return -1;
 
tools/perf/builtin-report.c +1 -2
index ca98d34..3662047 100644
@@ -939,8 +939,7 @@ repeat:
 		 */
 		if (!strstr(sort_order, "parent"))
 			sort_parent.elide = 1;
-	} else
-		symbol_conf.exclude_other = false;
+	}
 
 	if (argc) {
 		/*
tools/perf/builtin-top.c +0 -2
index b03bb9a..a237059 100644
@@ -1139,8 +1139,6 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 	if (top.evlist == NULL)
 		return -ENOMEM;
 
-	symbol_conf.exclude_other = false;
-
 	argc = parse_options(argc, argv, options, top_usage, 0);
 	if (argc)
 		usage_with_options(top_usage, options);
tools/perf/util/symbol.c +0 -1
index 8cf3b54..d5528e1 100644
@@ -32,7 +32,6 @@ int vmlinux_path__nr_entries;
 char **vmlinux_path;
 
 struct symbol_conf symbol_conf = {
-	.exclude_other	  = true,
 	.use_modules	  = true,
 	.try_vmlinux_path = true,
 	.annotate_src	  = true,
Signature · 1 line
1.7.11.7
#4 lore raw

Re: [PATCH 2/5] perf tools: Fix -x/--exclude-other option for report command

Quoted 4 lines · Jiri Olsa

Currently we have symbol_conf.exclude_other being set as true every time so the -x/--exclude-other has nothing to do. Also we have no way to see the data with symbol_conf.exclude_other being false which is useful sometimes.

I'm fine with the change, but wanted to address the "have no way" comment: --no-exclude-other should set it to false.

David

author
#5 lore raw

PATCH 3/5 perf tools: Do not elide parent symbol column

In reply to Jiri Olsa

I found the parent symbol column data interesting even if there's another sorting enabled. Switching it on.

Previous behaviour:

  $ perf report -i perf.data.delete -p perf_session__delete -x
  +   3.60%  perf  perf               [.] __rb_change_child
  +   1.89%  perf  perf               [.] rb_erase
  +   1.89%  perf  perf               [.] rb_erase
  +   1.83%  perf  perf               [.] free@plt

Current behaviour:

  $ perf report -i perf.data.delete -p perf_session__delete -x
  +   3.60%  perf  perf               [.] __rb_change_child        perf_session__delete
  +   1.89%  perf  perf               [.] rb_erase                 perf_session__delete_dead_threads
  +   1.89%  perf  perf               [.] rb_erase                 perf_session__delete_threads
  +   1.83%  perf  perf               [.] free@plt                 perf_session__delete
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/builtin-report.c | 8 --------
 1 file changed, 8 deletions(-)
tools/perf/builtin-report.c +0 -8
index 3662047..6ab49da 100644
@@ -931,14 +931,6 @@ repeat:
 	if (parent_pattern != default_parent_pattern) {
 		if (sort_dimension__add("parent") < 0)
 			goto error;
-
-		/*
-		 * Only show the parent fields if we explicitly
-		 * sort that way. If we only use parent machinery
-		 * for filtering, we don't want it.
-		 */
-		if (!strstr(sort_order, "parent"))
-			sort_parent.elide = 1;
 	}
 
 	if (argc) {
Signature · 1 line
1.7.11.7
author
#6 lore raw

PATCH 4/5 perf tools: Introduce new -P/--parent-deep report option

In reply to Jiri Olsa

Introducing new -P/--parent-deep report option. It does the same as '-p' but it force the deep search of the callchain and looks for the deepest possible match.

The -p option searches for the first match of the parent pattern in the callchain.

  $ perf report -i perf.data.delete -p perf_session__delete -s parent
  +  99.51%  [other]
  +   0.46%  perf_session__delete_dead_threads
  +   0.03%  perf_session__delete
  +   0.00%  perf_session__delete_threads

so we got multiple 'different' matches instancies, while they all belong under perf_session__delete function:

  $ perf report -i perf.data.delete -P perf_session__delete -s parent

+ 99.51% [other]
+ 0.49% perf_session__delete

NOTE the 'p' vs 'P' difference in above commands above.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Documentation/perf-report.txt |  5 +++++
 tools/perf/builtin-report.c              | 12 ++++++++++++
 tools/perf/util/machine.c                |  4 +++-
 tools/perf/util/symbol.h                 |  3 ++-
 4 files changed, 22 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-report.txt +5 -0
index 66dab74..90d1566 100644
@@ -96,6 +96,11 @@ OPTIONS
 	information recorded. The pattern is in the exteneded regex format and
 	defaults to "\^sys_|^do_page_fault", see '--sort parent'.
 
+-P::
+--parent-deep=<regex>::
+	Same as '-p' but it force the deep search of the callchain
+	and looks for the deepest possible match.
+
 -x::
 --exclude-other::
         Only display entries with parent-match.
tools/perf/builtin-report.c +12 -0
index 6ab49da..8c2c7ce 100644
@@ -714,6 +714,16 @@ parse_percent_limit(const struct option *opt, const char *str,
 	return 0;
 }
 
+static int
+parent_deep(const struct option *opt __maybe_unused,
+	    const char *str,
+	    int unset __maybe_unused)
+{
+	parent_pattern = str;
+	symbol_conf.parent_deep = true;
+	return 0;
+}
+
 int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	struct perf_session *session;
@@ -777,6 +787,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 		    "Show sample percentage for different cpu modes"),
 	OPT_STRING('p', "parent", &parent_pattern, "regex",
 		   "regex filter to identify parent, see: '--sort parent'"),
+	OPT_CALLBACK('P', "parent-deep", NULL, "regex",
+		     "Enables deep callchain search, implies -p", parent_deep),
 	OPT_BOOLEAN('x', "exclude-other", &symbol_conf.exclude_other,
 		    "Only display entries with parent-match"),
 	OPT_CALLBACK_DEFAULT('g', "call-graph", &report, "output_type,min_percent[,print_limit],call_order",
tools/perf/util/machine.c +3 -1
index 93527af..5ec5580 100644
@@ -1210,7 +1210,9 @@ static int machine__resolve_callchain_sample(struct machine *machine,
 		thread__find_addr_location(thread, machine, cpumode,
 					   MAP__FUNCTION, ip, &al, NULL);
 		if (al.sym != NULL) {
-			if (sort__has_parent && !*parent &&
+			bool more = symbol_conf.parent_deep || !*parent;
+
+			if (sort__has_parent && more &&
 			    symbol__match_parent_regex(al.sym))
 				*parent = al.sym;
 			if (!symbol_conf.use_callchain)
tools/perf/util/symbol.h +2 -1
index 5f720dc..6023edb 100644
@@ -98,7 +98,8 @@ struct symbol_conf {
 			annotate_asm_raw,
 			annotate_src,
 			event_group,
-			demangle;
+			demangle,
+			parent_deep;
 	const char	*vmlinux_name,
 			*kallsyms_name,
 			*source_prefix,
Signature · 1 line
1.7.11.7
#7 lore raw

Re: [PATCH 4/5] perf tools: Introduce new -P/--parent-deep report option

Quoted 3 lines · Jiri Olsa

Introducing new -P/--parent-deep report option. It does the same as '-p' but it force the deep search of the callchain and looks for the deepest possible match.

This doesn't make sense to me as an option.

If it's a more correct callgraph it should be default, not an option.

A option like "give me correct data" doesn't make sense.

-Andi

author
#8 lore raw

Re: [PATCH 4/5] perf tools: Introduce new -P/--parent-deep report option

Quoted 11 lines · Andi Kleen
Quoted 3 lines · Jiri Olsa

Introducing new -P/--parent-deep report option. It does the same as '-p' but it force the deep search of the callchain and looks for the deepest possible match.

This doesn't make sense to me as an option.

If it's a more correct callgraph it should be default, not an option.

A option like "give me correct data" doesn't make sense.

I thought the '-p' behaviour was for a reason not a bug, but I can change it to do the deep search and dont add '-P'

jirka

maintainer
#9 lore raw

Re: [PATCH 4/5] perf tools: Introduce new -P/--parent-deep report option

In reply to Jiri Olsa

Hi Jiri,

Quoted 17 lines · Jiri Olsa

Introducing new -P/--parent-deep report option. It does the same as '-p' but it force the deep search of the callchain and looks for the deepest possible match.

The -p option searches for the first match of the parent pattern in the callchain.

  $ perf report -i perf.data.delete -p perf_session__delete -s parent
  +  99.51%  [other]
  +   0.46%  perf_session__delete_dead_threads
  +   0.03%  perf_session__delete
  +   0.00%  perf_session__delete_threads

so we got multiple 'different' matches instancies, while they all belong under perf_session__delete function:

Quoted 6 lines
  $ perf report -i perf.data.delete -P perf_session__delete -s parent

+ 99.51% [other]
+ 0.49% perf_session__delete

NOTE the 'p' vs 'P' difference in above commands above.

I guess using --inverted (-G) option with -p does the job.

Thanks,
Namhyung

author
#10 lore raw

PATCH 5/5 perf tools: Fix perf_session__delete removal for report command

In reply to Jiri Olsa

There's no point of having out_delete label with perf_session__delete call within __cmd_report function, because it's called at the end of the cmd_report function.

The speed up due to commenting out the perf_session__delete at the end does not seem relevant anymore. Measured speedup for ~1GB data file with 222466 FORKS events is around 0.5%.

  $ perf report -i perf.data.delete -P perf_session__delete -s parent

+ 99.51% [other]
+ 0.49% perf_session__delete

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/builtin-report.c | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)
tools/perf/builtin-report.c +5 -18
index 8c2c7ce..36de70d 100644
@@ -497,7 +497,7 @@ static int __cmd_report(struct perf_report *rep)
 		ret = perf_session__cpu_bitmap(session, rep->cpu_list,
 					       rep->cpu_bitmap);
 		if (ret)
-			goto out_delete;
+			return ret;
 	}
 
 	if (use_browser <= 0)
@@ -508,11 +508,11 @@ static int __cmd_report(struct perf_report *rep)
 
 	ret = perf_report__setup_sample_type(rep);
 	if (ret)
-		goto out_delete;
+		return ret;
 
 	ret = perf_session__process_events(session, &rep->tool);
 	if (ret)
-		goto out_delete;
+		return ret;
 
 	kernel_map = session->machines.host.vmlinux_maps[MAP__FUNCTION];
 	kernel_kmap = map__kmap(kernel_map);
@@ -547,7 +547,7 @@ static int __cmd_report(struct perf_report *rep)
 
 	if (dump_trace) {
 		perf_session__fprintf_nr_events(session, stdout);
-		goto out_delete;
+		return 0;
 	}
 
 	nr_samples = 0;
@@ -572,7 +572,7 @@ static int __cmd_report(struct perf_report *rep)
 
 	if (nr_samples == 0) {
 		ui__error("The %s file has no samples!\n", session->filename);
-		goto out_delete;
+		return 0;
 	}
 
 	list_for_each_entry(pos, &session->evlist->entries, node)
@@ -598,19 +598,6 @@ static int __cmd_report(struct perf_report *rep)
 	} else
 		perf_evlist__tty_browse_hists(session->evlist, rep, help);
 
-out_delete:
-	/*
-	 * Speed up the exit process, for large files this can
-	 * take quite a while.
-	 *
-	 * XXX Enable this when using valgrind or if we ever
-	 * librarize this command.
-	 *
-	 * Also experiment with obstacks to see how much speed
-	 * up we'll get here.
-	 *
- 	 * perf_session__delete(session);
- 	 */
 	return ret;
 }
 
Signature · 1 line
1.7.11.7
#11 lore raw

Re: [PATCH 5/5] perf tools: Fix perf_session__delete removal for report command

Quoted 3 lines · Jiri Olsa

There's no point of having out_delete label with perf_session__delete call within __cmd_report function, because it's called at the end of the cmd_report function.

Is convenient to have a single return point for a function. Perhaps change the label to just out and remove the comment?

David

Quoted 91 lines

The speed up due to commenting out the perf_session__delete at the end does not seem relevant anymore. Measured speedup for ~1GB data file with 222466 FORKS events is around 0.5%.

   $ perf report -i perf.data.delete -P perf_session__delete -s parent

+ 99.51% [other]
+ 0.49% perf_session__delete

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
Cc Stephane Eranian <[email protected]>
---
  tools/perf/builtin-report.c | 23 +++++------------------
  1 file changed, 5 insertions(+), 18 deletions(-)
tools/perf/builtin-report.c +5 -18
index 8c2c7ce..36de70d 100644
@@ -497,7 +497,7 @@ static int __cmd_report(struct perf_report *rep)
  		ret = perf_session__cpu_bitmap(session, rep->cpu_list,
  					       rep->cpu_bitmap);
  		if (ret)
-			goto out_delete;
+			return ret;
  	}
 
  	if (use_browser <= 0)
@@ -508,11 +508,11 @@ static int __cmd_report(struct perf_report *rep)
 
  	ret = perf_report__setup_sample_type(rep);
  	if (ret)
-		goto out_delete;
+		return ret;
 
  	ret = perf_session__process_events(session, &rep->tool);
  	if (ret)
-		goto out_delete;
+		return ret;
 
  	kernel_map = session->machines.host.vmlinux_maps[MAP__FUNCTION];
  	kernel_kmap = map__kmap(kernel_map);
@@ -547,7 +547,7 @@ static int __cmd_report(struct perf_report *rep)
 
  	if (dump_trace) {
  		perf_session__fprintf_nr_events(session, stdout);
-		goto out_delete;
+		return 0;
  	}
 
  	nr_samples = 0;
@@ -572,7 +572,7 @@ static int __cmd_report(struct perf_report *rep)
 
  	if (nr_samples == 0) {
  		ui__error("The %s file has no samples!\n", session->filename);
-		goto out_delete;
+		return 0;
  	}
 
  	list_for_each_entry(pos, &session->evlist->entries, node)
@@ -598,19 +598,6 @@ static int __cmd_report(struct perf_report *rep)
  	} else
  		perf_evlist__tty_browse_hists(session->evlist, rep, help);
 
-out_delete:
-	/*
-	 * Speed up the exit process, for large files this can
-	 * take quite a while.
-	 *
-	 * XXX Enable this when using valgrind or if we ever
-	 * librarize this command.
-	 *
-	 * Also experiment with obstacks to see how much speed
-	 * up we'll get here.
-	 *
- 	 * perf_session__delete(session);
- 	 */
  	return ret;
  }
 
#12 lore raw

[tip:perf/core] perf report: Fix perf_session__delete removal

In reply to Jiri Olsa
perf report: Fix perf_session__delete removal
Commit-ID:  d4ae0a6f7c79be64c8f3551dd149189f8c4480eb
Gitweb:     http://git.kernel.org/tip/d4ae0a6f7c79be64c8f3551dd149189f8c4480eb
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 25 Jun 2013 13:54:13 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:46:07 -0300

perf report: Fix perf_session__delete removal

There's no point of having out_delete label with perf_session__delete call within __cmd_report function, because it's called at the end of the cmd_report function.

The speed up due to commenting out the perf_session__delete at the end does not seem relevant anymore. Measured speedup for ~1GB data file with 222466 FORKS events is around 0.5%.

  $ perf report -i perf.data.delete -P perf_session__delete -s parent

+ 99.51% [other]
+ 0.49% perf_session__delete

Cc Andi Kleen <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/builtin-report.c | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)
tools/perf/builtin-report.c +5 -18
index 6ab49da..ee2ca3e 100644
@@ -497,7 +497,7 @@ static int __cmd_report(struct perf_report *rep)
 		ret = perf_session__cpu_bitmap(session, rep->cpu_list,
 					       rep->cpu_bitmap);
 		if (ret)
-			goto out_delete;
+			return ret;
 	}
 
 	if (use_browser <= 0)
@@ -508,11 +508,11 @@ static int __cmd_report(struct perf_report *rep)
 
 	ret = perf_report__setup_sample_type(rep);
 	if (ret)
-		goto out_delete;
+		return ret;
 
 	ret = perf_session__process_events(session, &rep->tool);
 	if (ret)
-		goto out_delete;
+		return ret;
 
 	kernel_map = session->machines.host.vmlinux_maps[MAP__FUNCTION];
 	kernel_kmap = map__kmap(kernel_map);
@@ -547,7 +547,7 @@ static int __cmd_report(struct perf_report *rep)
 
 	if (dump_trace) {
 		perf_session__fprintf_nr_events(session, stdout);
-		goto out_delete;
+		return 0;
 	}
 
 	nr_samples = 0;
@@ -572,7 +572,7 @@ static int __cmd_report(struct perf_report *rep)
 
 	if (nr_samples == 0) {
 		ui__error("The %s file has no samples!\n", session->filename);
-		goto out_delete;
+		return 0;
 	}
 
 	list_for_each_entry(pos, &session->evlist->entries, node)
@@ -598,19 +598,6 @@ static int __cmd_report(struct perf_report *rep)
 	} else
 		perf_evlist__tty_browse_hists(session->evlist, rep, help);
 
-out_delete:
-	/*
-	 * Speed up the exit process, for large files this can
-	 * take quite a while.
-	 *
-	 * XXX Enable this when using valgrind or if we ever
-	 * librarize this command.
-	 *
-	 * Also experiment with obstacks to see how much speed
-	 * up we'll get here.
-	 *
- 	 * perf_session__delete(session);
- 	 */
 	return ret;
 }