Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp649955ybh; Sun, 12 Jul 2020 19:11:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0Sp7RCegAe+t/RawuH3hC4zvJgAUZTmwv0na7SYP/5JW3E6wiHqNlOVOI2f2sMDW8vUXp X-Received: by 2002:aa7:cfc8:: with SMTP id r8mr55072422edy.125.1594606280963; Sun, 12 Jul 2020 19:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594606280; cv=none; d=google.com; s=arc-20160816; b=HzV+dksaT1dx9/hae97+c9F4T1+nCYDNnH10KuYiiwDS24Us8rrImIz3tA38fEE6qG cJq7tT3uw/ILlIPiaAz9qBrg75vmRYHmXCvPzRcZ0wTa1e9WWITbGecTF0x+kzTNWMlt baUkAASGDrijJJBnuWlx/t5/o0JmVGVJn0GI2UTqXbJWNJKi6EqM5S2tDfU3a5rLaT3j vICnm019zrH7nxn8UruRCagTd3rwMLaQQo4pQY/CLm/VnXmTy7Emd1oxFJoyI7XvcRXu ltOmleGtPfwnxhp88oUcq6AOPdWXwAfj3iJVNdYfvXMb0ocTNbVdCIesSHqBOk84Dama bRfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=/JqMalK70RTxMXtSwcvKCPNkTTdjYqusM3wuf7O+RAk=; b=l+W2w5vOLlreOViJEh9ge8K4e1weN5cTLsCkkpYJ8C5tuHRwHzA+B8WrgI6sv9i74u 44hvvkqi8mJjZK1FY+DS1oa8FKvSw9uB6BAoEBHESA0mJTJI2JOhEHHJFXZXCU50AN0m oMfGjLtgNUTc17WzX/PMFbgLLfjf51JSdo/P/7zt8pVwqlH/zdCP+eCePew0EkJN8T9t P06wx55sOaMCSoF5L5vGCOlZ6pKrVi0eJQ92q30X5Cd1PSjjzLTokfBkonpomN0S0SIR NurjTDZEi36YYwC6v+vPCS+oYyPwFnwGFcC0zCp5ueusuHwG6Ssx8VA56WsF/ITpqUst 7tmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e13si8177622edn.432.2020.07.12.19.10.57; Sun, 12 Jul 2020 19:11:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728187AbgGMCIK (ORCPT + 99 others); Sun, 12 Jul 2020 22:08:10 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:51302 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726261AbgGMCIK (ORCPT ); Sun, 12 Jul 2020 22:08:10 -0400 Received: by mail-wm1-f66.google.com with SMTP id 22so11721610wmg.1 for ; Sun, 12 Jul 2020 19:08:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/JqMalK70RTxMXtSwcvKCPNkTTdjYqusM3wuf7O+RAk=; b=TPhL/AExsRMs+OABeyfOSLqYFtmosSxuOWm75pDGNa2OGE2vPbY6fT1JAiFFsGK0S2 je8e9eUWxKYaCNWDRw58NZ3fbb8LHfGUSY7unvqauVQIrMT0wLt4QS/qTGthHEvzWnR9 pCPq0xVo5torQeTWzEIAAHD5X7f9wBEScSWT0uJUXQeq28HHdiBn/xb1bq0ghehNSrNP H6yQzKS+ksNuixJfrb0L+Nxa/9APbe1CJHL//nBudab533jsg0xRz0dck1JL+bU1IgmY ZdiAiGDBwyIGJcL3xQOKfGLnDguiqS62z08erJMkhiMH5EndBqC/So9sndPsB15NSiv6 WUxw== X-Gm-Message-State: AOAM532ruvKzlyTqgBix1UT/8EvfSwaK8Q0AKv6nz4k0srqT7ok/3zSy /Lbe1sVxd9kf1GzmuKc2IbPafDY/BATKOGJKo/k= X-Received: by 2002:a1c:7d56:: with SMTP id y83mr17518706wmc.154.1594606087718; Sun, 12 Jul 2020 19:08:07 -0700 (PDT) MIME-Version: 1.0 References: <20200711124035.6513-1-changbin.du@gmail.com> <20200711124035.6513-14-changbin.du@gmail.com> In-Reply-To: <20200711124035.6513-14-changbin.du@gmail.com> From: Namhyung Kim Date: Mon, 13 Jul 2020 11:07:56 +0900 Message-ID: Subject: Re: [PATCH v5 13/17] perf ftrace: add option 'verbose' to show more info for graph tracer To: Changbin Du Cc: Jiri Olsa , Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Steven Rostedt , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 11, 2020 at 9:43 PM Changbin Du wrote: > > Sometimes we want ftrace display more and longer information about > the trace. > > $ sudo perf ftrace -G > 2) 0.979 us | mutex_unlock(); > 2) 1.540 us | __fsnotify_parent(); > 2) 0.433 us | fsnotify(); > > $ sudo perf ftrace -G --graph-opts verbose These -G option usage should be changed.. Thanks Namhyung > 14160.770883 | 0) <...>-47814 | .... | 1.289 us | mutex_unlock(); > 14160.770886 | 0) <...>-47814 | .... | 1.624 us | __fsnotify_parent(); > 14160.770887 | 0) <...>-47814 | .... | 0.636 us | fsnotify(); > 14160.770888 | 0) <...>-47814 | .... | 0.328 us | __sb_end_write(); > 14160.770888 | 0) <...>-47814 | d... | 0.430 us | fpregs_assert_state_consistent(); > 14160.770889 | 0) <...>-47814 | d... | | do_syscall_64() { > 14160.770889 | 0) <...>-47814 | .... | | __x64_sys_close() { > > Signed-off-by: Changbin Du > --- > tools/perf/Documentation/perf-ftrace.txt | 1 + > tools/perf/builtin-ftrace.c | 29 +++++++++++++++++++++++- > 2 files changed, 29 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/Documentation/perf-ftrace.txt b/tools/perf/Documentation/perf-ftrace.txt > index e6e9564d6c2e..0dd5ef4f9c65 100644 > --- a/tools/perf/Documentation/perf-ftrace.txt > +++ b/tools/perf/Documentation/perf-ftrace.txt > @@ -107,6 +107,7 @@ OPTIONS > List of options allowed to set: > nosleep-time - Measure on-CPU time only for function_graph tracer. > noirqs - Ignore functions that happen inside interrupt. > + verbose - Show process names, PIDs, timestamps, etc. > > SEE ALSO > -------- > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c > index a5906258c413..d169d6329454 100644 > --- a/tools/perf/builtin-ftrace.c > +++ b/tools/perf/builtin-ftrace.c > @@ -45,6 +45,7 @@ struct perf_ftrace { > int func_irq_info; > int graph_nosleep_time; > int graph_noirqs; > + int graph_verbose; > }; > > struct filter_entry { > @@ -205,6 +206,9 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused) > write_tracing_option_file("func_stack_trace", "0"); > write_tracing_option_file("sleep-time", "1"); > write_tracing_option_file("funcgraph-irqs", "1"); > + write_tracing_option_file("funcgraph-proc", "0"); > + write_tracing_option_file("funcgraph-abstime", "0"); > + write_tracing_option_file("latency-format", "0"); > write_tracing_option_file("irq-info", "0"); > } > > @@ -420,6 +424,23 @@ static int set_tracing_funcgraph_irqs(struct perf_ftrace *ftrace) > return 0; > } > > +static int set_tracing_funcgraph_verbose(struct perf_ftrace *ftrace) > +{ > + if (!ftrace->graph_verbose) > + return 0; > + > + if (write_tracing_option_file("funcgraph-proc", "1") < 0) > + return -1; > + > + if (write_tracing_option_file("funcgraph-abstime", "1") < 0) > + return -1; > + > + if (write_tracing_option_file("latency-format", "1") < 0) > + return -1; > + > + return 0; > +} > + > static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > { > char *trace_file; > @@ -514,6 +535,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > goto out_reset; > } > > + if (set_tracing_funcgraph_verbose(ftrace) < 0) { > + pr_err("failed to set tracing option funcgraph-proc/funcgraph-abstime\n"); > + goto out_reset; > + } > + > if (write_tracing_file("current_tracer", ftrace->tracer) < 0) { > pr_err("failed to set current_tracer to %s\n", ftrace->tracer); > goto out_reset; > @@ -696,6 +722,7 @@ static int parse_graph_tracer_opts(const struct option *opt, > struct sublevel_option graph_tracer_opts[] = { > { .name = "nosleep-time", .value_ptr = &ftrace->graph_nosleep_time }, > { .name = "noirqs", .value_ptr = &ftrace->graph_noirqs }, > + { .name = "verbose", .value_ptr = &ftrace->graph_verbose }, > { .name = NULL, } > }; > > @@ -752,7 +779,7 @@ int cmd_ftrace(int argc, const char **argv) > OPT_INTEGER('D', "graph-depth", &ftrace.graph_depth, > "Max depth for function graph tracer"), > OPT_CALLBACK(0, "graph-opts", &ftrace, "options", > - "graph tracer options, available options: nosleep-time,noirqs", > + "graph tracer options, available options: nosleep-time,noirqs,verbose", > parse_graph_tracer_opts), > OPT_CALLBACK('m', "buffer-size", &ftrace.percpu_buffer_size, "size", > "size of per cpu buffer", parse_buffer_size), > -- > 2.25.1 >