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>, David Ahern <dsahern@gmail.com>,
Stephane Eranian <eranian@google.com>,
Jeremy Eder <jeder@redhat.com>
Subject: [PATCH 17/17] perf ftrace: Tidy up the function graph output of 'show' subcommand
Date: Tue, 30 Jul 2013 18:19:14 +0900 [thread overview]
Message-ID: <1375175954-798-18-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1375175954-798-1-git-send-email-namhyung@kernel.org>
From: Namhyung Kim <namhyung.kim@lge.com>
Now it doesn't call pevent_print_event() but prints context info in
itself using print_graph_duration(). Make it compact by only print
cpu number and duration:
# perf ftrace show
...
10) 0.065 us | __fsnotify_parent();
10) | fsnotify() {
10) 0.060 us | __srcu_read_lock();
10) 0.040 us | __srcu_read_unlock();
10) 0.652 us | }
10) 0.040 us | fput();
10) | __audit_syscall_exit() {
10) | path_put() {
10) 0.037 us | dput();
10) 0.032 us | mntput();
10) 0.563 us | }
10) 0.035 us | unroll_tree_refs();
10) 0.035 us | kfree();
10) 1.284 us | }
10) | __audit_syscall_entry() {
10) 0.029 us | current_kernel_time();
10) 0.239 us | }
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/builtin-ftrace.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 8d4ec20e3854..9e78ec19caeb 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -879,6 +879,27 @@ static struct pevent_record *get_ordered_record(struct perf_ftrace *ftrace);
static struct event_format *fgraph_exit_event;
+static void
+print_graph_duration(struct trace_seq *s, struct event_format *event,
+ struct pevent_record *record)
+{
+ unsigned long long duration;
+ unsigned long long rettime, calltime;
+ unsigned long usec, nsec;
+
+ if (pevent_get_field_val(s, event, "rettime", record, &rettime, 1))
+ return;
+
+ if (pevent_get_field_val(s, event, "calltime", record, &calltime, 1))
+ return;
+
+ duration = rettime - calltime;
+ usec = duration / 1000;
+ nsec = duration % 1000;
+
+ trace_seq_printf(s, "%3d) %3lu.%03lu us | ", record->cpu, usec, nsec);
+}
+
static int
fgraph_ent_handler(struct trace_seq *s, struct pevent_record *record,
struct event_format *event, void *context)
@@ -911,9 +932,14 @@ fgraph_ent_handler(struct trace_seq *s, struct pevent_record *record,
if (next && next->cpu == record->cpu &&
pevent_data_type(event->pevent, next) == fgraph_exit_event->id) {
is_leaf = true;
+
+ print_graph_duration(s, fgraph_exit_event, next);
+
/* consume record */
get_ordered_record(ftrace);
free(next);
+ } else {
+ trace_seq_printf(s, "%3d) %*s | ", record->cpu, 10, "");
}
nested:
@@ -954,6 +980,8 @@ fgraph_ret_handler(struct trace_seq *s, struct pevent_record *record,
unsigned long long depth;
int i;
+ print_graph_duration(s, event, record);
+
if (pevent_get_field_val(s, event, "depth", record, &depth, 1))
return trace_seq_putc(s, '!');
@@ -1265,9 +1293,12 @@ static int do_ftrace_show(struct perf_ftrace *ftrace)
continue;
}
- pevent_print_event(ftrace->pevent, &seq, record);
- trace_seq_do_printf(&seq);
+ if (!strcmp(ftrace->tracer, "function_graph"))
+ pevent_event_info(&seq, event, record);
+ else
+ pevent_print_event(ftrace->pevent, &seq, record);
+ trace_seq_do_printf(&seq);
trace_seq_reset(&seq);
free(record);
--
1.7.11.7
next prev parent reply other threads:[~2013-07-30 9:19 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-30 9:18 [PATCHSET 00/17] perf tools: Introduce new 'ftrace' command (v4) Namhyung Kim
2013-07-30 9:18 ` [PATCH 01/17] perf util: Save pid-cmdline mapping into tracing header Namhyung Kim
2013-07-30 13:28 ` Arnaldo Carvalho de Melo
2013-07-31 0:51 ` Namhyung Kim
2013-07-31 14:07 ` Arnaldo Carvalho de Melo
2013-08-05 7:17 ` Namhyung Kim
2013-08-07 13:44 ` David Ahern
2013-08-09 5:51 ` Namhyung Kim
2013-07-30 9:18 ` [PATCH 02/17] perf util: Add more debug message on failure path Namhyung Kim
2013-07-30 13:33 ` Arnaldo Carvalho de Melo
2013-07-30 9:19 ` [PATCH 03/17] perf tools: Introduce new 'ftrace' tool Namhyung Kim
2013-07-30 9:19 ` [PATCH 04/17] perf ftrace: Add support for --pid option Namhyung Kim
2013-07-30 9:19 ` [PATCH 05/17] perf ftrace: Add support for -a and -C option Namhyung Kim
2013-07-30 9:19 ` [PATCH 06/17] perf ftrace: Split "live" sub-command Namhyung Kim
2013-07-30 9:19 ` [PATCH 07/17] perf ftrace: Add 'record' sub-command Namhyung Kim
2013-07-30 9:19 ` [PATCH 08/17] perf ftrace: Add 'show' sub-command Namhyung Kim
2013-07-30 9:19 ` [PATCH 09/17] perf ftrace: Add 'report' sub-command Namhyung Kim
2013-07-30 9:19 ` [PATCH 10/17] perf ftrace: Add dump_printf() for low-level debugging Namhyung Kim
2013-07-30 9:19 ` [PATCH 11/17] perf ftrace: Use pager for displaying result Namhyung Kim
2013-07-30 9:19 ` [PATCH 12/17] perf ftrace: Cleanup using ftrace_setup/teardown() Namhyung Kim
2013-07-30 9:19 ` [PATCH 13/17] perf tools: Add document for perf-ftrace command Namhyung Kim
2013-07-30 9:19 ` [PATCH 14/17] perf ftrace: Add a signal handler for SIGSEGV Namhyung Kim
2013-07-30 9:19 ` [PATCH 15/17] perf ftrace: Add --clock option Namhyung Kim
2013-07-30 9:19 ` [PATCH 16/17] perf ftrace: Show leaf-functions as oneliner Namhyung Kim
2013-07-30 9:19 ` Namhyung Kim [this message]
2013-08-01 12:02 ` [PATCHSET 00/17] perf tools: Introduce new 'ftrace' command (v4) Jiri Olsa
2013-08-02 9:16 ` Ingo Molnar
2013-08-05 7:44 ` Namhyung Kim
[not found] ` <51FB2B90.6090602@gmail.com>
2013-08-02 13:33 ` [PATCH] perf tools: Renaming 'time' variable in perf_time_to_tsc due to name shadowing error Jiri Olsa
2013-08-03 19:23 ` Adrian Hunter
2013-08-05 7:47 ` Jiri Olsa
2013-08-09 10:23 ` [PATCHSET 00/17] perf tools: Introduce new 'ftrace' command (v4) Jiri Olsa
2013-08-13 2:20 ` Namhyung Kim
2013-08-28 14:57 ` Jeremy Eder
2013-08-29 2:56 ` Namhyung Kim
2013-08-09 10:25 ` Jiri Olsa
2013-08-09 10:30 ` Jiri Olsa
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=1375175954-798-18-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=dsahern@gmail.com \
--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®