From: Arjan van de Ven <arjan@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, fweisbec@gmail.com
Subject: [PATCH] perf: Add "perf timechart record"
Date: Sat, 19 Sep 2009 13:03:58 +0200 [thread overview]
Message-ID: <20090919130358.133e6f79@infradead.org> (raw)
In-Reply-To: <20090919094452.GA2295@elte.hu>
>From f11a27881ef0fcdf459e6f52dd57885c7af93426 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sat, 19 Sep 2009 12:59:47 +0200
Subject: [PATCH] perf: Add "perf timechart record"
Add a command line option to record a trace, similar to "perf sched record".
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
tools/perf/builtin-timechart.c | 47 +++++++++++++++++++++++++++++++++------
1 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 00fac1b..58d737e 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -1086,11 +1086,42 @@ done:
return rc;
}
-static const char * const report_usage[] = {
- "perf report [<options>] <command>",
+static const char * const timechart_usage[] = {
+ "perf timechart [<options>] {record}",
NULL
};
+static const char *record_args[] = {
+ "record",
+ "-a",
+ "-R",
+ "-M",
+ "-f",
+ "-c", "1",
+ "-e", "power:power_start",
+ "-e", "power:power_end",
+ "-e", "power:power_frequency",
+ "-e", "sched:sched_wakeup",
+ "-e", "sched:sched_switch",
+};
+
+static int __cmd_record(int argc, const char **argv)
+{
+ unsigned int rec_argc, i, j;
+ const char **rec_argv;
+
+ rec_argc = ARRAY_SIZE(record_args) + argc - 1;
+ rec_argv = calloc(rec_argc + 1, sizeof(char *));
+
+ for (i = 0; i < ARRAY_SIZE(record_args); i++)
+ rec_argv[i] = strdup(record_args[i]);
+
+ for (j = 1; j < (unsigned int)argc; j++, i++)
+ rec_argv[i] = argv[j];
+
+ return cmd_record(i, rec_argv, NULL);
+}
+
static const struct option options[] = {
OPT_STRING('i', "input", &input_name, "file",
"input file name"),
@@ -1106,13 +1137,13 @@ int cmd_timechart(int argc, const char **argv, const char *prefix __used)
page_size = getpagesize();
- argc = parse_options(argc, argv, options, report_usage, 0);
+ argc = parse_options(argc, argv, options, timechart_usage,
+ PARSE_OPT_STOP_AT_NON_OPTION);
- /*
- * Any (unrecognized) arguments left?
- */
- if (argc)
- usage_with_options(report_usage, options);
+ if (argc && !strncmp(argv[0], "rec", 3))
+ return __cmd_record(argc, argv);
+ else if (argc)
+ usage_with_options(timechart_usage, options);
setup_pager();
--
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
next prev parent reply other threads:[~2009-09-19 11:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20090912130306.5d0086ea@infradead.org>
2009-09-12 11:03 ` [PATCH 1/8] perf: Add a timestamp to fork events Arjan van de Ven
2009-09-19 9:51 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-12 11:04 ` [PATCH 2/8] perf: Store trace event name/id pairs in perf.data Arjan van de Ven
2009-09-19 9:31 ` Ingo Molnar
2009-09-19 9:51 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-12 11:04 ` [PATCH 3/8] perf: Allow perf utilities to have "callback" options without arguments Arjan van de Ven
2009-09-19 9:52 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-12 11:05 ` [PATCH 4/8] perf: Add a sample_event type to the event_union Arjan van de Ven
2009-09-19 9:52 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-12 11:05 ` [PATCH 5/8] trace: Convert the power tracer into an event tracer Arjan van de Ven
2009-09-15 3:43 ` Li Zefan
2009-09-15 4:16 ` Arjan van de Ven
2009-09-19 9:52 ` [tip:perfcounters/core] tracing, perf: " tip-bot for Arjan van de Ven
2009-09-12 11:06 ` [PATCH 6/8] perf: Add a SVG helper library file Arjan van de Ven
2009-09-19 9:52 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-12 11:06 ` [PATCH 7/8] perf: Add a perf record --timechart option Arjan van de Ven
2009-09-14 8:06 ` Peter Zijlstra
2009-09-14 20:33 ` Arjan van de Ven
2009-09-19 9:44 ` Ingo Molnar
2009-09-19 11:03 ` Arjan van de Ven [this message]
2009-09-12 11:07 ` [PATCH 8/8] perf: Add the timechart tool Arjan van de Ven
2009-09-19 9:48 ` Ingo Molnar
2009-09-19 9:51 ` Ingo Molnar
2009-09-19 9:53 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-19 11:34 [git pull] incremental updates to timechart Arjan van de Ven
2009-09-19 11:34 ` [PATCH] perf: Add "perf timechart record" Arjan van de Ven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090919130358.133e6f79@infradead.org \
--to=arjan@infradead.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox