All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: Arjan van de Ven <arjan@infradead.org>,
	mingo@elte.hu, fweisbec@gmail.com, peterz@infradead.org
Subject: [PATCH 7/8] perf: Add a perf record --timechart option
Date: Sat, 12 Sep 2009 13:06:45 +0200	[thread overview]
Message-ID: <20090912130645.2765de6d@infradead.org> (raw)
In-Reply-To: <20090912130306.5d0086ea@infradead.org>

>From 2f2ee48c6cbf556724929c55b6c0842f737e9658 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.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@linux.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

  parent reply	other threads:[~2009-09-12 11:05 UTC|newest]

Thread overview: 24+ 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 ` Arjan van de Ven [this message]
2009-09-14  8:06   ` [PATCH 7/8] perf: Add a perf record --timechart option Peter Zijlstra
2009-09-14 20:33     ` Arjan van de Ven
2009-09-19  9:44       ` Ingo Molnar
2009-09-19 11:03         ` [PATCH] perf: Add "perf timechart record" Arjan van de Ven
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

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=20090912130645.2765de6d@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 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.