[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090912130645.2765de6d@infradead.org>
Date: Sat, 12 Sep 2009 13:06:45 +0200
From: Arjan van de Ven <arjan@...radead.org>
To: linux-kernel@...r.kernel.org
Cc: Arjan van de Ven <arjan@...radead.org>, mingo@...e.hu,
fweisbec@...il.com, peterz@...radead.org
Subject: [PATCH 7/8] perf: Add a perf record --timechart option
>From 2f2ee48c6cbf556724929c55b6c0842f737e9658 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@...ux.intel.com>
Date: Sat, 12 Sep 2009 12:52:13 +0200
Subject: [PATCH] perf: Add a perf record --timechart option
This patch adds a "perf record --timechart" option, to make it easy
to capture traces for use by the timechart tool.
Signed-off-by: Arjan van de Ven <arjan@...ux.intel.com>
---
tools/perf/builtin-record.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 99a12fe..f06a447 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -47,6 +47,7 @@ static int append_file = 0;
static int call_graph = 0;
static int inherit_stat = 0;
static int no_samples = 0;
+static int timechart = 0;
static int sample_address = 0;
static long samples;
@@ -385,6 +386,12 @@ static void create_counter(int counter, int cpu, pid_t pid)
attr->sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+ if (timechart) {
+ attr->sample_type |= PERF_SAMPLE_CPU;
+ attr->sample_type |= PERF_SAMPLE_TIME;
+ attr->sample_type |= PERF_SAMPLE_RAW;
+ }
+
if (freq) {
attr->sample_type |= PERF_SAMPLE_PERIOD;
attr->freq = 1;
@@ -637,6 +644,24 @@ static int __cmd_record(int argc, const char **argv)
return 0;
}
+static int do_timechart(const struct option *opt __used, const char *str __used, int unset __used)
+{
+ parse_events(NULL, "power:power_start", 0);
+ parse_events(NULL, "power:power_end", 0);
+ parse_events(NULL, "power:power_frequency", 0);
+ parse_events(NULL, "sched:sched_wakeup", 0);
+ parse_events(NULL, "sched:sched_switch", 0);
+ default_interval = 1;
+ system_wide = 1;
+ timechart = 1;
+ if (!nr_counters) {
+ printf("No counters found.. is debugfs mounted?\n");
+ exit(0);
+ }
+ return 0;
+}
+
+
static const char * const record_usage[] = {
"perf record [<options>] [<command>]",
"perf record [<options>] -- <command> [<options>]",
@@ -681,6 +706,9 @@ static const struct option options[] = {
"Sample addresses"),
OPT_BOOLEAN('n', "no-samples", &no_samples,
"don't sample"),
+ OPT_CALLBACK_NOOPT('t', "timechart", NULL, NULL,
+ "create a timechart recording",
+ do_timechart),
OPT_END()
};
--
1.6.0.6
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists