mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>,
	Stephane Eranian <eranian@google.com>,
	Jeremy Eder <jeder@redhat.com>
Subject: [PATCH 15/18] perf ftrace: Add --clock option
Date: Wed, 16 Oct 2013 14:00:18 +0900	[thread overview]
Message-ID: <1381899621-14638-16-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1381899621-14638-1-git-send-email-namhyung@kernel.org>

From: Namhyung Kim <namhyung.kim@lge.com>

The --clock (-c) option is for controlling trace_clock.  Default to
'perf' if exists, or 'local'.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-ftrace.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 8fec8d6df37d..2a7acdbd6985 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -35,6 +35,7 @@ struct perf_ftrace {
 	struct perf_target target;
 	const char *tracer;
 	const char *dirname;
+	const char *clock;
 	struct pevent *pevent;
 	bool show_full_info;
 };
@@ -114,6 +115,9 @@ static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused)
 	if (reset_tracing_cpu() < 0)
 		return -1;
 
+	if (write_tracing_file("trace_clock", "local") < 0)
+		return -1;
+
 	return 0;
 }
 
@@ -188,6 +192,24 @@ static int reset_tracing_cpu(void)
 	return 0;
 }
 
+static int set_tracing_clock(struct perf_ftrace *ftrace)
+{
+	const char *tclock = ftrace->clock;
+
+	if (tclock == NULL)
+		tclock = "perf";
+
+	if (!write_tracing_file("trace_clock", tclock))
+		return 0;
+
+	/* exit if user specified an invalid clock */
+	if (ftrace->clock)
+		return -1;
+
+	pr_debug("'perf' clock is not supported.. falling back to 'local' clock\n");
+	return write_tracing_file("trace_clock", "local");
+}
+
 static int setup_tracing_files(struct perf_ftrace *ftrace)
 {
 	int ret = -1;
@@ -213,6 +235,11 @@ static int setup_tracing_files(struct perf_ftrace *ftrace)
 		goto out;
 	}
 
+	if (set_tracing_clock(ftrace) < 0) {
+		pr_err("failed to set trace clock\n");
+		goto out;
+	}
+
 	if (write_tracing_file("current_tracer", ftrace->tracer) < 0) {
 		pr_err("failed to set current_tracer to %s\n", ftrace->tracer);
 		goto out;
@@ -1495,6 +1522,8 @@ __cmd_ftrace_live(struct perf_ftrace *ftrace, int argc, const char **argv)
 		    "system-wide collection from all CPUs"),
 	OPT_STRING('C', "cpu", &ftrace->target.cpu_list, "cpu",
 		    "list of cpus to monitor"),
+	OPT_STRING('c', "clock", &ftrace->clock, "clock",
+		    "clock to be used for tracer"),
 	OPT_END()
 	};
 
@@ -1537,6 +1566,8 @@ __cmd_ftrace_record(struct perf_ftrace *ftrace, int argc, const char **argv)
 		    "list of cpus to monitor"),
 	OPT_STRING('o', "output", &ftrace->dirname, "dirname",
 		   "input directory name to use (default: perf.data)"),
+	OPT_STRING('c', "clock", &ftrace->clock, "clock",
+		    "clock to be used for tracer"),
 	OPT_END()
 	};
 
-- 
1.7.11.7


  parent reply	other threads:[~2013-10-16  5:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16  5:00 [PATCHSET 00/18] perf tools: Introduce new 'ftrace' command (5) Namhyung Kim
2013-10-16  5:00 ` [PATCH 01/18] perf util: Save pid-cmdline mapping into tracing header Namhyung Kim
2013-10-16  5:00 ` [PATCH 02/18] perf util: Add more debug message on failure path Namhyung Kim
2013-10-16  5:00 ` [PATCH 03/18] perf tools: Introduce new 'ftrace' tool Namhyung Kim
2013-10-16  5:00 ` [PATCH 04/18] perf ftrace: Add support for --pid option Namhyung Kim
2013-10-16  5:00 ` [PATCH 05/18] perf ftrace: Add support for -a and -C option Namhyung Kim
2013-10-16  5:00 ` [PATCH 06/18] perf ftrace: Split "live" sub-command Namhyung Kim
2013-10-16  5:00 ` [PATCH 07/18] perf ftrace: Add 'record' sub-command Namhyung Kim
2013-10-16  5:00 ` [PATCH 08/18] perf ftrace: Add 'show' sub-command Namhyung Kim
2013-10-16  5:00 ` [PATCH 09/18] perf ftrace: Add 'report' sub-command Namhyung Kim
2013-10-16  5:00 ` [PATCH 10/18] perf ftrace: Add dump_printf() for low-level debugging Namhyung Kim
2013-10-16  5:00 ` [PATCH 11/18] perf ftrace: Use pager for displaying result Namhyung Kim
2013-10-16  5:00 ` [PATCH 12/18] perf ftrace: Cleanup using ftrace_setup/teardown() Namhyung Kim
2013-10-16  5:00 ` [PATCH 13/18] perf tools: Add document for perf-ftrace command Namhyung Kim
2013-10-16  5:00 ` [PATCH 14/18] perf ftrace: Add a signal handler for SIGSEGV Namhyung Kim
2013-10-16  5:00 ` Namhyung Kim [this message]
2013-10-16  5:00 ` [PATCH 16/18] perf ftrace: Show leaf-functions as oneliner Namhyung Kim
2013-10-16  5:00 ` [PATCH 17/18] perf ftrace: Tidy up the function graph output of 'show' subcommand Namhyung Kim
2013-10-16  5:00 ` [PATCH 18/18] perf ftrace: Add --filter option Namhyung Kim

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=1381899621-14638-16-git-send-email-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jeder@redhat.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®