Commit-ID: 48290609c0d265f5dac0fca6fd4e3c5732542f67
Gitweb: http://git.kernel.org/tip/48290609c0d265f5dac0fca6fd4e3c5732542f67
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 3 Jan 2011 17:48:12 -0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 4 Jan 2011 00:23:27 -0200
perf evsel: Introduce per cpu and per thread open helpers
Abstracting away the loops needed to create the various event fd handlers.
The users have to pass a confiruged perf->evsel.attr field, which is already
usable after perf_evsel__new (constructor) time, using defaults.
Comes out of the ad-hoc routines in builtin-stat, that now uses it.
Fixed a small silly bug where we were die()ing before killing our
children, dysfunctional family this one 8-)
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-stat.c | 84 ++++++++++++++-------------------------------
tools/perf/util/evsel.c | 52 ++++++++++++++++++++++++++++
tools/perf/util/evsel.h | 5 +++
3 files changed, 83 insertions(+), 58 deletions(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index a8b00b4..065e79e 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -53,8 +53,6 @@
#include <math.h>
#include <locale.h>
-#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
-
#define DEFAULT_SEPARATOR " "
static struct perf_event_attr default_attrs[] = {
@@ -160,56 +158,24 @@ struct stats runtime_cycles_stats[MAX_NR_CPUS];
struct stats runtime_branches_stats[MAX_NR_CPUS];
struct stats walltime_nsecs_stats;
-#define ERR_PERF_OPEN \
-"counter %d, sys_perf_event_open() syscall ...