All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 00/10] perf/core improvements and fixes
@ 2011-12-20 19:18 Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 01/10] perf record: Add ability to record event period Arnaldo Carvalho de Melo
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-12-20 19:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Andrew Vagin,
	Arun Sharma, cjashfor, David Ahern, devel, Jiri Olsa,
	Johannes Schindelin, Linus Torvalds, Namhyung Kim, Nelson Elhage,
	Paul Mackerras, Peter Zijlstra, Robert Richter, arnaldo.melo

Hi Ingo,

        Please consider pulling from:

git://github.com/acmel/linux.git perf/core

	There are still patchkits I need to merge/review, thanks everybody, the
more, the better!

	I'll continue processing them tomorrow,

Regards,

- Arnaldo

Andrew Vagin (1):
  perf record: Add ability to record event period

Jiri Olsa (1):
  perf test: Add more automated tests for event parsing

Namhyung Kim (6):
  perf report: Document '--call-graph' for optional print_limit argument
  perf symbols: Get rid of duplicated snprintf()
  perf symbols: Fix error path on symbol__init()
  perf tools: Fix a memory leak on perf_read_values_destroy
  perf tools: Remove stale git headlines from top comment
  perf events: Tidy up perf_event__preprocess_sample

Nelson Elhage (1):
  perf evlist: Fix errno value reporting on failed mmap

Robert Richter (1):
  perf evsel: Fix uninitialized memory access to struct perf_sample

 tools/perf/Documentation/perf-report.txt |    5 +-
 tools/perf/builtin-record.c              |    1 +
 tools/perf/builtin-report.c              |    6 +-
 tools/perf/builtin-test.c                |  127 +++++++++++++++++++++++++++++-
 tools/perf/perf.h                        |    1 +
 tools/perf/util/config.c                 |    5 +-
 tools/perf/util/event.c                  |   13 ++--
 tools/perf/util/evlist.c                 |    4 +-
 tools/perf/util/evsel.c                  |    5 +-
 tools/perf/util/symbol.c                 |   11 +--
 tools/perf/util/usage.c                  |    5 +-
 tools/perf/util/values.c                 |    1 +
 12 files changed, 160 insertions(+), 24 deletions(-)

-- 
1.7.8.rc0.35.gee6df


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 01/10] perf record: Add ability to record event period
  2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2011-12-20 19:18 ` Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 02/10] perf evsel: Fix uninitialized memory access to struct perf_sample Arnaldo Carvalho de Melo
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-12-20 19:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Andrew Vagin, Arun Sharma, David Ahern,
	Paul Mackerras, Peter Zijlstra, devel, Arnaldo Carvalho de Melo

From: Andrew Vagin <avagin@openvz.org>

The problem is that when SAMPLE_PERIOD is not set, the kernel generates
a number of samples in proportion to an event's period. Number of these
samples may be too big and the kernel throttles all samples above a
defined limit.

E.g.: I want to trace when a process sleeps. I created a process which
sleeps for 1ms and for 4ms.  perf got 100 events in both cases.

swapper 0 [000] 1141.371830: sched_stat_sleep: comm=foo pid=1801 delay=1386750 [ns]
swapper 0 [000] 1141.369444: sched_stat_sleep: comm=foo pid=1801 delay=4499585 [ns]

In the first case a kernel want to send 4499585 events and in the second
case it wants to send 1386750 events.  perf-reports shows that process
sleeps in both places equal time.

Instead of this we can get only one sample with an attribute period. As
result we have less data transferring between kernel and user-space and
we avoid throttling of samples.

The patch "events: Don't divide events if it has field period" added a
kernel part of this functionality.

Acked-by: Arun Sharma <asharma@fb.com>
Cc: Arun Sharma <asharma@fb.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: devel@openvz.org
Link: http://lkml.kernel.org/r/1324391565-1369947-1-git-send-email-avagin@openvz.org
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |    1 +
 tools/perf/perf.h           |    1 +
 tools/perf/util/evsel.c     |    3 +++
 3 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 766fa0a..f8fd14f 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -700,6 +700,7 @@ const struct option record_options[] = {
 	OPT_BOOLEAN('d', "data", &record.opts.sample_address,
 		    "Sample addresses"),
 	OPT_BOOLEAN('T', "timestamp", &record.opts.sample_time, "Sample timestamps"),
+	OPT_BOOLEAN('P', "period", &record.opts.period, "Sample period"),
 	OPT_BOOLEAN('n', "no-samples", &record.opts.no_samples,
 		    "don't sample"),
 	OPT_BOOLEAN('N', "no-buildid-cache", &record.no_buildid_cache,
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index ea804f5..64f8bee 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -200,6 +200,7 @@ struct perf_record_opts {
 	bool	     sample_time;
 	bool	     sample_id_all_avail;
 	bool	     system_wide;
+	bool	     period;
 	unsigned int freq;
 	unsigned int mmap_pages;
 	unsigned int user_freq;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 4a8c8b0..60ad028 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -108,6 +108,9 @@ void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts)
 	if (opts->system_wide)
 		attr->sample_type	|= PERF_SAMPLE_CPU;
 
+	if (opts->period)
+		attr->sample_type	|= PERF_SAMPLE_PERIOD;
+
 	if (opts->sample_id_all_avail &&
 	    (opts->sample_time || opts->system_wide ||
 	     !opts->no_inherit || opts->cpu_list))
-- 
1.7.8.rc0.35.gee6df


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 02/10] perf evsel: Fix uninitialized memory access to struct perf_sample
  2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 01/10] perf record: Add ability to record event period Arnaldo Carvalho de Melo
@ 2011-12-20 19:18 ` Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 03/10] perf report: Document '--call-graph' for optional print_limit argument Arnaldo Carvalho de Melo
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-12-20 19:18 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Robert Richter, Arnaldo Carvalho de Melo

From: Robert Richter <robert.richter@amd.com>

Memory in struct perf_sample is not fully initialized during parsing.
Depending on sampling data some parts may left unchanged. Zero out
struct perf_sample first to avoid access to uninitialized memory.

Cc: Ingo Molnar <mingo@elte.hu>
Link: http://lkml.kernel.org/r/1323966762-8574-2-git-send-email-robert.richter@amd.com
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 60ad028..667f3b7 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -460,7 +460,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
 		u32 val32[2];
 	} u;
 
-
+	memset(data, 0, sizeof(*data));
 	data->cpu = data->pid = data->tid = -1;
 	data->stream_id = data->id = data->time = -1ULL;
 
-- 
1.7.8.rc0.35.gee6df


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 03/10] perf report: Document '--call-graph' for optional print_limit argument
  2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 01/10] perf record: Add ability to record event period Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 02/10] perf evsel: Fix uninitialized memory access to struct perf_sample Arnaldo Carvalho de Melo
@ 2011-12-20 19:18 ` Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 04/10] perf evlist: Fix errno value reporting on failed mmap Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-12-20 19:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@gmail.com>

The '--call-graph' command line option can receive undocumented optional
print_limit argument. Besides, use strtoul() to parse the option since
its type is u32.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1323703017-6060-2-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-report.txt |    5 +++--
 tools/perf/builtin-report.c              |    6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index dc85392..35af0dc 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -80,9 +80,10 @@ OPTIONS
 --dump-raw-trace::
         Dump raw trace in ASCII.
 
--g [type,min,order]::
+-g [type,min[,limit],order]::
 --call-graph::
-        Display call chains using type, min percent threshold and order.
+        Display call chains using type, min percent threshold, optional print
+	limit and order.
 	type can be either:
 	- flat: single column, linear exposure of call chains.
 	- graph: use a graph tree, displaying absolute overhead rates.
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index ece7c5d..b2654c9 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -407,7 +407,7 @@ parse_callchain_opt(const struct option *opt, const char *arg, int unset)
 		goto setup;
 
 	if (tok2[0] != 'c') {
-		callchain_param.print_limit = strtod(tok2, &endptr);
+		callchain_param.print_limit = strtoul(tok2, &endptr, 0);
 		tok2 = strtok(NULL, ",");
 		if (!tok2)
 			goto setup;
@@ -485,8 +485,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
 		   "regex filter to identify parent, see: '--sort parent'"),
 	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, call_order",
-		     "Display callchains using output_type (graph, flat, fractal, or none) , min percent threshold and callchain order. "
+	OPT_CALLBACK_DEFAULT('g', "call-graph", &report, "output_type,min_percent[,print_limit],call_order",
+		     "Display callchains using output_type (graph, flat, fractal, or none) , min percent threshold, optional print limit and callchain order. "
 		     "Default: fractal,0.5,callee", &parse_callchain_opt, callchain_default_opt),
 	OPT_BOOLEAN('G', "inverted", &report.inverted_callchain,
 		    "alias for inverted call graph"),
-- 
1.7.8.rc0.35.gee6df


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 04/10] perf evlist: Fix errno value reporting on failed mmap
  2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2011-12-20 19:18 ` [PATCH 03/10] perf report: Document '--call-graph' for optional print_limit argument Arnaldo Carvalho de Melo
@ 2011-12-20 19:18 ` Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 05/10] perf symbols: Get rid of duplicated snprintf() Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-12-20 19:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Nelson Elhage, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Nelson Elhage <nelhage@nelhage.com>

On failure, perf_evlist__mmap_per_{cpu,thread} will try to munmap()
every map that doesn't have a NULL base. This will fail with EINVAL if
one of them has base == MAP_FAILED, clobbering errno, so that
perf_evlist__map will return EINVAL on any failure regardless of the
root cause.

Fix this by resetting failed maps to a NULL base.

Acked-by: Namhyung Kim <namhyung@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1324301972-22740-2-git-send-email-nelhage@nelhage.com
Signed-off-by: Nelson Elhage <nelhage@nelhage.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 8b19e7a..963d63d 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -447,8 +447,10 @@ static int __perf_evlist__mmap(struct perf_evlist *evlist,
 	evlist->mmap[idx].mask = mask;
 	evlist->mmap[idx].base = mmap(NULL, evlist->mmap_len, prot,
 				      MAP_SHARED, fd, 0);
-	if (evlist->mmap[idx].base == MAP_FAILED)
+	if (evlist->mmap[idx].base == MAP_FAILED) {
+		evlist->mmap[idx].base = NULL;
 		return -1;
+	}
 
 	perf_evlist__add_pollfd(evlist, fd);
 	return 0;
-- 
1.7.8.rc0.35.gee6df


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 05/10] perf symbols: Get rid of duplicated snprintf()
  2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2011-12-20 19:18 ` [PATCH 04/10] perf evlist: Fix errno value reporting on failed mmap Arnaldo Carvalho de Melo
@ 2011-12-20 19:18 ` Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 06/10] perf symbols: Fix error path on symbol__init() Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-12-20 19:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@gmail.com>

The 'path' variable is set on a upper line, don't need to do it again.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1323703017-6060-3-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 632b50c..e54b13d 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1757,7 +1757,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
 		struct stat st;
 
 		/*sshfs might return bad dent->d_type, so we have to stat*/
-		sprintf(path, "%s/%s", dir_name, dent->d_name);
+		snprintf(path, sizeof(path), "%s/%s", dir_name, dent->d_name);
 		if (stat(path, &st))
 			continue;
 
@@ -1766,8 +1766,6 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
 			    !strcmp(dent->d_name, ".."))
 				continue;
 
-			snprintf(path, sizeof(path), "%s/%s",
-				 dir_name, dent->d_name);
 			ret = map_groups__set_modules_path_dir(mg, path);
 			if (ret < 0)
 				goto out;
@@ -1788,9 +1786,6 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
 			if (map == NULL)
 				continue;
 
-			snprintf(path, sizeof(path), "%s/%s",
-				 dir_name, dent->d_name);
-
 			long_name = strdup(path);
 			if (long_name == NULL) {
 				ret = -1;
-- 
1.7.8.rc0.35.gee6df


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 06/10] perf symbols: Fix error path on symbol__init()
  2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2011-12-20 19:18 ` [PATCH 05/10] perf symbols: Get rid of duplicated snprintf() Arnaldo Carvalho de Melo
@ 2011-12-20 19:18 ` Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 07/10] perf tools: Fix a memory leak on perf_read_values_destroy Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-12-20 19:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@gmail.com>

The order of freeing comm_list and dso_list should be reversed.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1323703017-6060-4-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index e54b13d..215d50f 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2604,10 +2604,10 @@ int symbol__init(void)
 	symbol_conf.initialized = true;
 	return 0;
 
-out_free_dso_list:
-	strlist__delete(symbol_conf.dso_list);
 out_free_comm_list:
 	strlist__delete(symbol_conf.comm_list);
+out_free_dso_list:
+	strlist__delete(symbol_conf.dso_list);
 	return -1;
 }
 
-- 
1.7.8.rc0.35.gee6df


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 07/10] perf tools: Fix a memory leak on perf_read_values_destroy
  2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2011-12-20 19:18 ` [PATCH 06/10] perf symbols: Fix error path on symbol__init() Arnaldo Carvalho de Melo
@ 2011-12-20 19:18 ` Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 08/10] perf tools: Remove stale git headlines from top comment Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-12-20 19:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@gmail.com>

After freeing each elements of the @values->value, we should free itself
too.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1323703017-6060-5-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/values.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c
index bdd3347..697c8b4e 100644
--- a/tools/perf/util/values.c
+++ b/tools/perf/util/values.c
@@ -32,6 +32,7 @@ void perf_read_values_destroy(struct perf_read_values *values)
 
 	for (i = 0; i < values->threads; i++)
 		free(values->value[i]);
+	free(values->value);
 	free(values->pid);
 	free(values->tid);
 	free(values->counterrawid);
-- 
1.7.8.rc0.35.gee6df


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 08/10] perf tools: Remove stale git headlines from top comment
  2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2011-12-20 19:18 ` [PATCH 07/10] perf tools: Fix a memory leak on perf_read_values_destroy Arnaldo Carvalho de Melo
@ 2011-12-20 19:18 ` Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 09/10] perf events: Tidy up perf_event__preprocess_sample Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-12-20 19:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Johannes Schindelin, Linus Torvalds,
	Paul Mackerras, Peter Zijlstra, Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@gmail.com>

These files are part of PERF not GIT although they're come from there :)

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1323784323-2150-1-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/config.c |    5 ++++-
 tools/perf/util/usage.c  |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 80d9598..0deac6a 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -1,5 +1,8 @@
 /*
- * GIT - The information manager from hell
+ * config.c
+ *
+ * Helper functions for parsing config items.
+ * Originally copied from GIT source.
  *
  * Copyright (C) Linus Torvalds, 2005
  * Copyright (C) Johannes Schindelin, 2005
diff --git a/tools/perf/util/usage.c b/tools/perf/util/usage.c
index e16bf9a..d76d1c0 100644
--- a/tools/perf/util/usage.c
+++ b/tools/perf/util/usage.c
@@ -1,5 +1,8 @@
 /*
- * GIT - The information manager from hell
+ * usage.c
+ *
+ * Various reporting routines.
+ * Originally copied from GIT source.
  *
  * Copyright (C) Linus Torvalds, 2005
  */
-- 
1.7.8.rc0.35.gee6df


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 09/10] perf events: Tidy up perf_event__preprocess_sample
  2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2011-12-20 19:18 ` [PATCH 08/10] perf tools: Remove stale git headlines from top comment Arnaldo Carvalho de Melo
@ 2011-12-20 19:18 ` Arnaldo Carvalho de Melo
  2011-12-20 19:18 ` [PATCH 10/10] perf test: Add more automated tests for event parsing Arnaldo Carvalho de Melo
  2011-12-20 19:33 ` [GIT PULL 00/10] perf/core improvements and fixes Ingo Molnar
  10 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-12-20 19:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@gmail.com>

Use local variable 'dso' to reduce typing a bit and rearrange the if
condition. Also NULL check of al->map in the condition is not necessary.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1323703017-6060-7-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/event.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 97c479b..b7c7f39 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -814,13 +814,14 @@ int perf_event__preprocess_sample(const union perf_event *event,
 	al->cpu = sample->cpu;
 
 	if (al->map) {
+		struct dso *dso = al->map->dso;
+
 		if (symbol_conf.dso_list &&
-		    (!al->map || !al->map->dso ||
-		     !(strlist__has_entry(symbol_conf.dso_list,
-					  al->map->dso->short_name) ||
-		       (al->map->dso->short_name != al->map->dso->long_name &&
-			strlist__has_entry(symbol_conf.dso_list,
-					   al->map->dso->long_name)))))
+		    (!dso || !(strlist__has_entry(symbol_conf.dso_list,
+						  dso->short_name) ||
+			       (dso->short_name != dso->long_name &&
+				strlist__has_entry(symbol_conf.dso_list,
+						   dso->long_name)))))
 			goto out_filtered;
 
 		al->sym = map__find_symbol(al->map, al->addr, filter);
-- 
1.7.8.rc0.35.gee6df


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 10/10] perf test: Add more automated tests for event parsing
  2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (8 preceding siblings ...)
  2011-12-20 19:18 ` [PATCH 09/10] perf events: Tidy up perf_event__preprocess_sample Arnaldo Carvalho de Melo
@ 2011-12-20 19:18 ` Arnaldo Carvalho de Melo
  2011-12-20 19:33 ` [GIT PULL 00/10] perf/core improvements and fixes Ingo Molnar
  10 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-12-20 19:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Paul Mackerras, Peter Zijlstra,
	cjashfor, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Adding automated tests for event parsing to include testing for modifier
and ',' operator.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: cjashfor@linux.vnet.ibm.com
Link: http://lkml.kernel.org/r/1323963039-7602-4-git-send-email-jolsa@redhat.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
[ committer note: Remove some tests that need group_leader & bison patchkits ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c |  127 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 126 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 6173f78..2b9a7f4 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -603,7 +603,7 @@ out_free_threads:
 
 #define TEST_ASSERT_VAL(text, cond) \
 do { \
-	if (!cond) { \
+	if (!(cond)) { \
 		pr_debug("FAILED %s:%d %s\n", __FILE__, __LINE__, text); \
 		return -1; \
 	} \
@@ -759,6 +759,103 @@ static int test__checkevent_breakpoint_w(struct perf_evlist *evlist)
 	return 0;
 }
 
+static int test__checkevent_tracepoint_modifier(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = list_entry(evlist->entries.next,
+					      struct perf_evsel, node);
+
+	TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
+	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
+	TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
+	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
+
+	return test__checkevent_tracepoint(evlist);
+}
+
+static int
+test__checkevent_tracepoint_multi_modifier(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel;
+
+	TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1);
+
+	list_for_each_entry(evsel, &evlist->entries, node) {
+		TEST_ASSERT_VAL("wrong exclude_user",
+				!evsel->attr.exclude_user);
+		TEST_ASSERT_VAL("wrong exclude_kernel",
+				evsel->attr.exclude_kernel);
+		TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
+		TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
+	}
+
+	return test__checkevent_tracepoint_multi(evlist);
+}
+
+static int test__checkevent_raw_modifier(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = list_entry(evlist->entries.next,
+					      struct perf_evsel, node);
+
+	TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
+	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
+	TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
+	TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
+
+	return test__checkevent_raw(evlist);
+}
+
+static int test__checkevent_numeric_modifier(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = list_entry(evlist->entries.next,
+					      struct perf_evsel, node);
+
+	TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
+	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
+	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
+	TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
+
+	return test__checkevent_numeric(evlist);
+}
+
+static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = list_entry(evlist->entries.next,
+					      struct perf_evsel, node);
+
+	TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
+	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
+	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
+	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
+
+	return test__checkevent_symbolic_name(evlist);
+}
+
+static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = list_entry(evlist->entries.next,
+					      struct perf_evsel, node);
+
+	TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
+	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
+	TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
+	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
+
+	return test__checkevent_symbolic_alias(evlist);
+}
+
+static int test__checkevent_genhw_modifier(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = list_entry(evlist->entries.next,
+					      struct perf_evsel, node);
+
+	TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
+	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
+	TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
+	TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
+
+	return test__checkevent_genhw(evlist);
+}
+
 static struct test__event_st {
 	const char *name;
 	__u32 type;
@@ -808,6 +905,34 @@ static struct test__event_st {
 		.name  = "mem:0:w",
 		.check = test__checkevent_breakpoint_w,
 	},
+	{
+		.name  = "syscalls:sys_enter_open:k",
+		.check = test__checkevent_tracepoint_modifier,
+	},
+	{
+		.name  = "syscalls:*:u",
+		.check = test__checkevent_tracepoint_multi_modifier,
+	},
+	{
+		.name  = "r1:kp",
+		.check = test__checkevent_raw_modifier,
+	},
+	{
+		.name  = "1:1:hp",
+		.check = test__checkevent_numeric_modifier,
+	},
+	{
+		.name  = "instructions:h",
+		.check = test__checkevent_symbolic_name_modifier,
+	},
+	{
+		.name  = "faults:u",
+		.check = test__checkevent_symbolic_alias_modifier,
+	},
+	{
+		.name  = "L1-dcache-load-miss:kp",
+		.check = test__checkevent_genhw_modifier,
+	},
 };
 
 #define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st))
-- 
1.7.8.rc0.35.gee6df


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [GIT PULL 00/10] perf/core improvements and fixes
  2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (9 preceding siblings ...)
  2011-12-20 19:18 ` [PATCH 10/10] perf test: Add more automated tests for event parsing Arnaldo Carvalho de Melo
@ 2011-12-20 19:33 ` Ingo Molnar
  10 siblings, 0 replies; 12+ messages in thread
From: Ingo Molnar @ 2011-12-20 19:33 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Andrew Vagin, Arun Sharma, cjashfor, David Ahern,
	devel, Jiri Olsa, Johannes Schindelin, Linus Torvalds,
	Namhyung Kim, Nelson Elhage, Paul Mackerras, Peter Zijlstra,
	Robert Richter, arnaldo.melo


* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:

> Hi Ingo,
> 
>         Please consider pulling from:
> 
> git://github.com/acmel/linux.git perf/core
> 
> 	There are still patchkits I need to merge/review, thanks everybody, the
> more, the better!
> 
> 	I'll continue processing them tomorrow,
> 
> Regards,
> 
> - Arnaldo
> 
> Andrew Vagin (1):
>   perf record: Add ability to record event period
> 
> Jiri Olsa (1):
>   perf test: Add more automated tests for event parsing
> 
> Namhyung Kim (6):
>   perf report: Document '--call-graph' for optional print_limit argument
>   perf symbols: Get rid of duplicated snprintf()
>   perf symbols: Fix error path on symbol__init()
>   perf tools: Fix a memory leak on perf_read_values_destroy
>   perf tools: Remove stale git headlines from top comment
>   perf events: Tidy up perf_event__preprocess_sample
> 
> Nelson Elhage (1):
>   perf evlist: Fix errno value reporting on failed mmap
> 
> Robert Richter (1):
>   perf evsel: Fix uninitialized memory access to struct perf_sample
> 
>  tools/perf/Documentation/perf-report.txt |    5 +-
>  tools/perf/builtin-record.c              |    1 +
>  tools/perf/builtin-report.c              |    6 +-
>  tools/perf/builtin-test.c                |  127 +++++++++++++++++++++++++++++-
>  tools/perf/perf.h                        |    1 +
>  tools/perf/util/config.c                 |    5 +-
>  tools/perf/util/event.c                  |   13 ++--
>  tools/perf/util/evlist.c                 |    4 +-
>  tools/perf/util/evsel.c                  |    5 +-
>  tools/perf/util/symbol.c                 |   11 +--
>  tools/perf/util/usage.c                  |    5 +-
>  tools/perf/util/values.c                 |    1 +
>  12 files changed, 160 insertions(+), 24 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-12-20 19:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-20 19:18 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
2011-12-20 19:18 ` [PATCH 01/10] perf record: Add ability to record event period Arnaldo Carvalho de Melo
2011-12-20 19:18 ` [PATCH 02/10] perf evsel: Fix uninitialized memory access to struct perf_sample Arnaldo Carvalho de Melo
2011-12-20 19:18 ` [PATCH 03/10] perf report: Document '--call-graph' for optional print_limit argument Arnaldo Carvalho de Melo
2011-12-20 19:18 ` [PATCH 04/10] perf evlist: Fix errno value reporting on failed mmap Arnaldo Carvalho de Melo
2011-12-20 19:18 ` [PATCH 05/10] perf symbols: Get rid of duplicated snprintf() Arnaldo Carvalho de Melo
2011-12-20 19:18 ` [PATCH 06/10] perf symbols: Fix error path on symbol__init() Arnaldo Carvalho de Melo
2011-12-20 19:18 ` [PATCH 07/10] perf tools: Fix a memory leak on perf_read_values_destroy Arnaldo Carvalho de Melo
2011-12-20 19:18 ` [PATCH 08/10] perf tools: Remove stale git headlines from top comment Arnaldo Carvalho de Melo
2011-12-20 19:18 ` [PATCH 09/10] perf events: Tidy up perf_event__preprocess_sample Arnaldo Carvalho de Melo
2011-12-20 19:18 ` [PATCH 10/10] perf test: Add more automated tests for event parsing Arnaldo Carvalho de Melo
2011-12-20 19:33 ` [GIT PULL 00/10] perf/core improvements and fixes Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.