All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Arjan van de Ven <arjan@infradead.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org,
	arjan@infradead.org, hpa@zytor.com, mingo@redhat.com,
	arjan@linux.intel.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perfcounters/core] perf timechart: Add "perf timechart record"
Date: Sat, 19 Sep 2009 17:00:53 GMT	[thread overview]
Message-ID: <tip-3c09eebd61eaacca866cd60b50416f18640bc731@git.kernel.org> (raw)
In-Reply-To: <20090919133442.0dc2c7f5@infradead.org>

Commit-ID:  3c09eebd61eaacca866cd60b50416f18640bc731
Gitweb:     http://git.kernel.org/tip/3c09eebd61eaacca866cd60b50416f18640bc731
Author:     Arjan van de Ven <arjan@infradead.org>
AuthorDate: Sat, 19 Sep 2009 13:34:42 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 19 Sep 2009 18:57:51 +0200

perf timechart: 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>
Cc: fweisbec@gmail.com
Cc: peterz@infradead.org
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <20090919133442.0dc2c7f5@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 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();
 

  reply	other threads:[~2009-09-19 17:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
2009-09-19 17:00   ` tip-bot for Arjan van de Ven [this message]
2009-09-19 11:35 ` [PATCH] perf: Be consistent about minimum text size in the svghelper Arjan van de Ven
2009-09-19 17:01   ` [tip:perfcounters/core] perf utils: " tip-bot for Arjan van de Ven
2009-09-19 11:35 ` [PATCH] trace: Move the end point of a C state in the power tracer Arjan van de Ven
2009-09-19 17:01   ` [tip:perfcounters/core] tracing, x86, cpuidle: " tip-bot for Arjan van de Ven
2009-09-19 11:36 ` [PATCH] perf: Add timechart help text and add timechart to "perf help" Arjan van de Ven
2009-09-19 17:01   ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-19 11:36 ` [PATCH] perf: Use a define for the maximum length of a trace event Arjan van de Ven
2009-09-19 17:01   ` [tip:perfcounters/core] perf utils: " tip-bot for 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=tip-3c09eebd61eaacca866cd60b50416f18640bc731@git.kernel.org \
    --to=arjan@infradead.org \
    --cc=arjan@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /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 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.