[PATCH] perf: Add a perf record --timechart option
From: Arjan van de Ven
Date: Sat Sep 12 2009 - 06:52:13 EST
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@xxxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/