Skip to contentSkip to conversation

perf tools: Fix attr tests plus other small fixes

PATCH New Jiri Olsa 2 participants 10 messages May 24, 2013 – May 31, 2013 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

cover perf tools: Fix attr tests plus other small fixes

hi,
sending fixes for attr tests. It's tested with following patch reverted:
87f303a perf record: handle death by SIGTERM

otherwise I get a deadlock.. this issue will be
handled separatelly.

It's reachable at:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/core_misc

thanks,
jirka

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

---
Jiri Olsa (5):
perf tests: Fix attr test for record -d option
perf tests: Fix exclude_guest|exclude_host checking for attr tests perf tools: Remove frozen from perf_header struct
perf tools: Remove unused code from record command perf tools: Remove cwdlen from struct perf_session

 tools/perf/builtin-report.c            | 23 +++++------------------
 tools/perf/tests/attr/base-record      |  4 ++--
 tools/perf/tests/attr/base-stat        |  4 ++--
 tools/perf/tests/attr/test-record-data |  5 ++++-
 tools/perf/util/header.c               |  2 --
 tools/perf/util/header.h               |  1 -
 tools/perf/util/session.h              |  1 -
 7 files changed, 13 insertions(+), 27 deletions(-)
author
#1 lore raw

PATCH 1/5 perf tests: Fix attr test for record -d option

The sample type for '-d' option is changed, because of the memory profiling patches from Stephane. The '-d' now adds PERF_SAMPLE_DATA_SRC sample_type.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/tests/attr/test-record-data | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/tests/attr/test-record-data +4 -1
index 6627c3e..716e143 100644
@@ -4,5 +4,8 @@ args    = -d kill >/dev/null 2>&1
 
 [event:base-record]
 sample_period=4000
-sample_type=271
+
+# sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME |
+# PERF_SAMPLE_ADDR | PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC
+sample_type=33039
 mmap_data=1
Signature · 1 line
1.7.11.7
#2 lore raw

[tip:perf/core] perf tests: Fix attr test for record -d option

perf tests: Fix attr test for record -d option
Commit-ID:  8e72a67a7fcbdaa45d1b08f8ce601a37a4e9e163
Gitweb:     http://git.kernel.org/tip/8e72a67a7fcbdaa45d1b08f8ce601a37a4e9e163
Author:     Jiri Olsa <[email protected]>
AuthorDate: Fri, 24 May 2013 13:16:37 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 29 May 2013 15:11:10 +0300

perf tests: Fix attr test for record -d option

The sample type for '-d' option is changed, because of the memory profiling patches from Stephane. The '-d' now adds PERF_SAMPLE_DATA_SRC sample_type.

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/tests/attr/test-record-data | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/tests/attr/test-record-data +4 -1
index 6627c3e..716e143 100644
@@ -4,5 +4,8 @@ args    = -d kill >/dev/null 2>&1
 
 [event:base-record]
 sample_period=4000
-sample_type=271
+
+# sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME |
+# PERF_SAMPLE_ADDR | PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC
+sample_type=33039
 mmap_data=1
author
#3 lore raw

PATCH 2/5 perf tests: Fix exclude_guest|exclude_host checking for attr tests

In reply to Jiri Olsa

We have a one of the event open fallback case in __perf_evsel__open where we zero exclude_guest|exclude_host fields.

This means there's no way for attr tests to find out what's the right value for those fields, so we need to check for both 0 and 1. Luckily we still have other event parsing tests for those fields.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/tests/attr/base-record | 4 ++--
 tools/perf/tests/attr/base-stat   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
tools/perf/tests/attr/base-record +2 -2
index b4fc835..e9bd639 100644
@@ -27,8 +27,8 @@ watermark=0
 precise_ip=0
 mmap_data=0
 sample_id_all=1
-exclude_host=0
-exclude_guest=1
+exclude_host=0|1
+exclude_guest=0|1
 exclude_callchain_kernel=0
 exclude_callchain_user=0
 wakeup_events=0
tools/perf/tests/attr/base-stat +2 -2
index 748ee94..91cd48b 100644
@@ -27,8 +27,8 @@ watermark=0
 precise_ip=0
 mmap_data=0
 sample_id_all=0
-exclude_host=0
-exclude_guest=1
+exclude_host=0|1
+exclude_guest=0|1
 exclude_callchain_kernel=0
 exclude_callchain_user=0
 wakeup_events=0
Signature · 1 line
1.7.11.7
#4 lore raw

[tip:perf/core] perf tests: Fix exclude_guest|exclude_host checking for attr tests

perf tests: Fix exclude_guest|exclude_host checking for attr tests
Commit-ID:  66cd3f3a6ce6b69537ee62b2f2ea1775be139dff
Gitweb:     http://git.kernel.org/tip/66cd3f3a6ce6b69537ee62b2f2ea1775be139dff
Author:     Jiri Olsa <[email protected]>
AuthorDate: Fri, 24 May 2013 13:16:38 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 29 May 2013 15:15:19 +0300

perf tests: Fix exclude_guest|exclude_host checking for attr tests

We have a one of the event open fallback case in __perf_evsel__open where we zero exclude_guest|exclude_host fields.

This means there's no way for attr tests to find out what's the right value for those fields, so we need to check for both 0 and 1. Luckily we still have other event parsing tests for those fields.

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/tests/attr/base-record | 4 ++--
 tools/perf/tests/attr/base-stat   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
tools/perf/tests/attr/base-record +2 -2
index b4fc835..e9bd639 100644
@@ -27,8 +27,8 @@ watermark=0
 precise_ip=0
 mmap_data=0
 sample_id_all=1
-exclude_host=0
-exclude_guest=1
+exclude_host=0|1
+exclude_guest=0|1
 exclude_callchain_kernel=0
 exclude_callchain_user=0
 wakeup_events=0
tools/perf/tests/attr/base-stat +2 -2
index 748ee94..91cd48b 100644
@@ -27,8 +27,8 @@ watermark=0
 precise_ip=0
 mmap_data=0
 sample_id_all=0
-exclude_host=0
-exclude_guest=1
+exclude_host=0|1
+exclude_guest=0|1
 exclude_callchain_kernel=0
 exclude_callchain_user=0
 wakeup_events=0
author
#5 lore raw

PATCH 3/5 perf tools: Remove frozen from perf_header struct

In reply to Jiri Olsa

Removing frozen from perf_header struct as it's
no longer used.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/util/header.c | 2 --
 tools/perf/util/header.h | 1 -
 2 files changed, 3 deletions(-)
tools/perf/util/header.c +0 -2
index 326068a..738d3b8 100644
@@ -2391,7 +2391,6 @@ out_err_write:
 	}
 	lseek(fd, header->data_offset + header->data_size, SEEK_SET);
 
-	header->frozen = 1;
 	return 0;
 }
 
@@ -2871,7 +2870,6 @@ int perf_session__read_header(struct perf_session *session, int fd)
 						   session->pevent))
 		goto out_delete_evlist;
 
-	header->frozen = 1;
 	return 0;
 out_errno:
 	return -errno;
tools/perf/util/header.h +0 -1
index c9fc55c..16a3e83 100644
@@ -84,7 +84,6 @@ struct perf_session_env {
 };
 
 struct perf_header {
-	int			frozen;
 	bool			needs_swap;
 	s64			attr_offset;
 	u64			data_offset;
Signature · 1 line
1.7.11.7
#6 lore raw

[tip:perf/core] perf tools: Remove frozen from perf_header struct

perf tools: Remove frozen from perf_header struct
Commit-ID:  78e3a1f1ab932b52333ba14497d663d3ad758d16
Gitweb:     http://git.kernel.org/tip/78e3a1f1ab932b52333ba14497d663d3ad758d16
Author:     Jiri Olsa <[email protected]>
AuthorDate: Fri, 24 May 2013 13:16:39 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 29 May 2013 15:17:35 +0300

perf tools: Remove frozen from perf_header struct

Removing frozen from perf_header struct as it's no longer used.

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/util/header.c | 2 --
 tools/perf/util/header.h | 1 -
 2 files changed, 3 deletions(-)
tools/perf/util/header.c +0 -2
index 326068a..738d3b8 100644
@@ -2391,7 +2391,6 @@ out_err_write:
 	}
 	lseek(fd, header->data_offset + header->data_size, SEEK_SET);
 
-	header->frozen = 1;
 	return 0;
 }
 
@@ -2871,7 +2870,6 @@ int perf_session__read_header(struct perf_session *session, int fd)
 						   session->pevent))
 		goto out_delete_evlist;
 
-	header->frozen = 1;
 	return 0;
 out_errno:
 	return -errno;
tools/perf/util/header.h +0 -1
index c9fc55c..16a3e83 100644
@@ -84,7 +84,6 @@ struct perf_session_env {
 };
 
 struct perf_header {
-	int			frozen;
 	bool			needs_swap;
 	s64			attr_offset;
 	u64			data_offset;
author
#7 lore raw

PATCH 4/5 perf tools: Remove unused code from record command

In reply to Jiri Olsa

Removing old/unused leftover from __cmd_record function.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/builtin-report.c | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)
tools/perf/builtin-report.c +5 -18
index ca98d34..a62a7d9 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
author
#8 lore raw

PATCH 5/5 perf tools: Remove cwdlen from struct perf_session

In reply to Jiri Olsa

Removing cwdlen from struct perf_session as it's
no longer used.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/util/session.h | 1 -
 1 file changed, 1 deletion(-)
tools/perf/util/session.h +0 -1
index 6b51d47..f3b235e 100644
@@ -37,7 +37,6 @@ struct perf_session {
 	int			fd;
 	bool			fd_pipe;
 	bool			repipe;
-	int			cwdlen;
 	char			*cwd;
 	struct ordered_samples	ordered_samples;
 	char			filename[1];
Signature · 1 line
1.7.11.7
#9 lore raw

[tip:perf/core] perf tools: Remove cwdlen from struct perf_session

perf tools: Remove cwdlen from struct perf_session
Commit-ID:  0ac129e008971aea9f6b17cb77a12e2ffc9dc80c
Gitweb:     http://git.kernel.org/tip/0ac129e008971aea9f6b17cb77a12e2ffc9dc80c
Author:     Jiri Olsa <[email protected]>
AuthorDate: Fri, 24 May 2013 13:16:41 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 29 May 2013 15:24:04 +0300

perf tools: Remove cwdlen from struct perf_session

Removing cwdlen from struct perf_session as it's no longer used.

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/util/session.h | 1 -
 1 file changed, 1 deletion(-)
tools/perf/util/session.h +0 -1
index 6b51d47..f3b235e 100644
@@ -37,7 +37,6 @@ struct perf_session {
 	int			fd;
 	bool			fd_pipe;
 	bool			repipe;
-	int			cwdlen;
 	char			*cwd;
 	struct ordered_samples	ordered_samples;
 	char			filename[1];