* [PATCH] perf: add support for specifying profile cpu for record
@ 2009-08-12 9:18 Jens Axboe
2009-08-12 9:52 ` [tip:perfcounters/urgent] perf record: Add missing -C option support for specifying profile cpu tip-bot for Jens Axboe
2009-08-12 12:18 ` tip-bot for Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Jens Axboe @ 2009-08-12 9:18 UTC (permalink / raw)
To: Linux Kernel; +Cc: mingo
Hi,
perf top supports a -C for setting the profile CPU, but perf record does
not. This adds the same option for perf record, allowing the user to
specify a specific target profile CPU.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 6da0992..8e85543 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -35,6 +35,7 @@ static const char *output_name = "perf.data";
static int group = 0;
static unsigned int realtime_prio = 0;
static int system_wide = 0;
+static int profile_cpu = -1;
static pid_t target_pid = -1;
static int inherit = 1;
static int force = 0;
@@ -425,6 +426,9 @@ try_again:
if (err == EPERM)
die("Permission error - are you root?\n");
+ else if (err == ENODEV && profile_cpu != -1)
+ die("No such device - did you specify an out-of-range"
+ " profile CPU?\n");
/*
* If it's cycles then fall back to hrtimer
@@ -554,9 +558,13 @@ static int __cmd_record(int argc, const char **argv)
if (pid == -1)
pid = getpid();
- open_counters(-1, pid);
- } else for (i = 0; i < nr_cpus; i++)
- open_counters(i, target_pid);
+ open_counters(profile_cpu, pid);
+ } else if (profile_cpu != -1)
+ open_counters(profile_cpu, target_pid);
+ else {
+ for (i = 0; i < nr_cpus; i++)
+ open_counters(i, target_pid);
+ }
if (file_new)
perf_header__write(header, output);
@@ -635,6 +643,8 @@ static const struct option options[] = {
"system-wide collection from all CPUs"),
OPT_BOOLEAN('A', "append", &append_file,
"append to the output file to do incremental profiling"),
+ OPT_INTEGER('C', "profile_cpu", &profile_cpu,
+ "CPU to profile on"),
OPT_BOOLEAN('f', "force", &force,
"overwrite existing data file"),
OPT_LONG('c', "count", &default_interval,
--
Jens Axboe
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [tip:perfcounters/urgent] perf record: Add missing -C option support for specifying profile cpu
2009-08-12 9:18 [PATCH] perf: add support for specifying profile cpu for record Jens Axboe
@ 2009-08-12 9:52 ` tip-bot for Jens Axboe
2009-08-12 12:18 ` tip-bot for Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Jens Axboe @ 2009-08-12 9:52 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
jens.axboe, fweisbec, tglx, mingo
Commit-ID: 009eb52b6580a92e5fb35f77f94b8cc11c963d9d
Gitweb: http://git.kernel.org/tip/009eb52b6580a92e5fb35f77f94b8cc11c963d9d
Author: Jens Axboe <jens.axboe@oracle.com>
AuthorDate: Wed, 12 Aug 2009 11:18:01 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 12 Aug 2009 11:35:45 +0200
perf record: Add missing -C option support for specifying profile cpu
perf top supports a -C for setting the profile CPU, but perf
record does not. This adds the same option for perf record,
allowing the user to specify a specific target profile CPU.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20090812091801.GC12579@kernel.dk>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
tools/perf/builtin-record.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 30b83de..de76008 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -35,6 +35,7 @@ static const char *output_name = "perf.data";
static int group = 0;
static unsigned int realtime_prio = 0;
static int system_wide = 0;
+static int profile_cpu = -1;
static pid_t target_pid = -1;
static int inherit = 1;
static int force = 0;
@@ -431,6 +432,8 @@ try_again:
if (err == EPERM)
die("Permission error - are you root?\n");
+ else if (err == ENODEV && profile_cpu != -1)
+ die("No such device - did you specify an out-of-range profile CPU?\n");
/*
* If it's cycles then fall back to hrtimer
@@ -564,9 +567,15 @@ static int __cmd_record(int argc, const char **argv)
if (pid == -1)
pid = getpid();
- open_counters(-1, pid);
- } else for (i = 0; i < nr_cpus; i++)
- open_counters(i, target_pid);
+ open_counters(profile_cpu, pid);
+ } else {
+ if (profile_cpu != -1) {
+ open_counters(profile_cpu, target_pid);
+ } else {
+ for (i = 0; i < nr_cpus; i++)
+ open_counters(i, target_pid);
+ }
+ }
if (file_new)
perf_header__write(header, output);
@@ -645,6 +654,8 @@ static const struct option options[] = {
"system-wide collection from all CPUs"),
OPT_BOOLEAN('A', "append", &append_file,
"append to the output file to do incremental profiling"),
+ OPT_INTEGER('C', "profile_cpu", &profile_cpu,
+ "CPU to profile on"),
OPT_BOOLEAN('f', "force", &force,
"overwrite existing data file"),
OPT_LONG('c', "count", &default_interval,
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [tip:perfcounters/urgent] perf record: Add missing -C option support for specifying profile cpu
2009-08-12 9:18 [PATCH] perf: add support for specifying profile cpu for record Jens Axboe
2009-08-12 9:52 ` [tip:perfcounters/urgent] perf record: Add missing -C option support for specifying profile cpu tip-bot for Jens Axboe
@ 2009-08-12 12:18 ` tip-bot for Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Jens Axboe @ 2009-08-12 12:18 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
jens.axboe, fweisbec, tglx, mingo
Commit-ID: 0a5ac84650fb7a7f226814103d95724e34b012ae
Gitweb: http://git.kernel.org/tip/0a5ac84650fb7a7f226814103d95724e34b012ae
Author: Jens Axboe <jens.axboe@oracle.com>
AuthorDate: Wed, 12 Aug 2009 11:18:01 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 12 Aug 2009 14:10:51 +0200
perf record: Add missing -C option support for specifying profile cpu
perf top supports a -C for setting the profile CPU, but perf
record does not. This adds the same option for perf record,
allowing the user to specify a specific target profile CPU.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20090812091801.GC12579@kernel.dk>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
tools/perf/builtin-record.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 30b83de..de76008 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -35,6 +35,7 @@ static const char *output_name = "perf.data";
static int group = 0;
static unsigned int realtime_prio = 0;
static int system_wide = 0;
+static int profile_cpu = -1;
static pid_t target_pid = -1;
static int inherit = 1;
static int force = 0;
@@ -431,6 +432,8 @@ try_again:
if (err == EPERM)
die("Permission error - are you root?\n");
+ else if (err == ENODEV && profile_cpu != -1)
+ die("No such device - did you specify an out-of-range profile CPU?\n");
/*
* If it's cycles then fall back to hrtimer
@@ -564,9 +567,15 @@ static int __cmd_record(int argc, const char **argv)
if (pid == -1)
pid = getpid();
- open_counters(-1, pid);
- } else for (i = 0; i < nr_cpus; i++)
- open_counters(i, target_pid);
+ open_counters(profile_cpu, pid);
+ } else {
+ if (profile_cpu != -1) {
+ open_counters(profile_cpu, target_pid);
+ } else {
+ for (i = 0; i < nr_cpus; i++)
+ open_counters(i, target_pid);
+ }
+ }
if (file_new)
perf_header__write(header, output);
@@ -645,6 +654,8 @@ static const struct option options[] = {
"system-wide collection from all CPUs"),
OPT_BOOLEAN('A', "append", &append_file,
"append to the output file to do incremental profiling"),
+ OPT_INTEGER('C', "profile_cpu", &profile_cpu,
+ "CPU to profile on"),
OPT_BOOLEAN('f', "force", &force,
"overwrite existing data file"),
OPT_LONG('c', "count", &default_interval,
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-12 12:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-12 9:18 [PATCH] perf: add support for specifying profile cpu for record Jens Axboe
2009-08-12 9:52 ` [tip:perfcounters/urgent] perf record: Add missing -C option support for specifying profile cpu tip-bot for Jens Axboe
2009-08-12 12:18 ` tip-bot for Jens Axboe
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.