Re: [PATCH v8 05/18] perf ftrace: show trace column header

2020-08-14 Thread Arnaldo Carvalho de Melo
Em Fri, Aug 14, 2020 at 08:56:55AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Sat, Aug 08, 2020 at 10:31:28AM +0800, Changbin Du escreveu:
> > This makes perf-ftrace display column header before printing trace.
> > 
> >   $ sudo perf ftrace
> >   # tracer: function
> >   #
> >   # entries-in-buffer/entries-written: 0/0   #P:8
> >   #
> >   #TASK-PID CPU#   TIMESTAMP  FUNCTION
> >   #  | | |   | |
> >  <...>-9246  [006]  10726.262760: mutex_unlock <-rb_simple_write
> >  <...>-9246  [006]  10726.262764: __fsnotify_parent <-vfs_write
> >  <...>-9246  [006]  10726.262765: fsnotify <-vfs_write
> >  <...>-9246  [006]  10726.262766: __sb_end_write <-vfs_write
> >  <...>-9246  [006]  10726.262767: 
> > fpregs_assert_state_consistent <-do_syscall_64
> 
> We have:
> 
>   # perf report -h header
>   
>Usage: perf report []
>   
>   --header  Show data header.
>   --header-only Show only data header.
>   
>   #
> 
> So perhaps we should have those as well, in the 'ftrace' case one would
> perhaps want to use --no-header, for instance, to do some scripting
> parsing just the trace lines.

This as well can be done after I process this series, to make progress.

Applied.

- Arnaldo


Re: [PATCH v8 05/18] perf ftrace: show trace column header

2020-08-14 Thread Arnaldo Carvalho de Melo
Em Sat, Aug 08, 2020 at 10:31:28AM +0800, Changbin Du escreveu:
> This makes perf-ftrace display column header before printing trace.
> 
>   $ sudo perf ftrace
>   # tracer: function
>   #
>   # entries-in-buffer/entries-written: 0/0   #P:8
>   #
>   #TASK-PID CPU#   TIMESTAMP  FUNCTION
>   #  | | |   | |
>  <...>-9246  [006]  10726.262760: mutex_unlock <-rb_simple_write
>  <...>-9246  [006]  10726.262764: __fsnotify_parent <-vfs_write
>  <...>-9246  [006]  10726.262765: fsnotify <-vfs_write
>  <...>-9246  [006]  10726.262766: __sb_end_write <-vfs_write
>  <...>-9246  [006]  10726.262767: fpregs_assert_state_consistent 
> <-do_syscall_64

We have:

  # perf report -h header
  
   Usage: perf report []
  
  --header  Show data header.
  --header-only Show only data header.
  
  #

So perhaps we should have those as well, in the 'ftrace' case one would
perhaps want to use --no-header, for instance, to do some scripting
parsing just the trace lines.

- Arnaldo
 
> Signed-off-by: Changbin Du 
> ---
>  tools/perf/builtin-ftrace.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
> index a3a4f4be9dde..39c694be2b71 100644
> --- a/tools/perf/builtin-ftrace.c
> +++ b/tools/perf/builtin-ftrace.c
> @@ -435,6 +435,9 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int 
> argc, const char **argv)
>   fcntl(trace_fd, F_SETFL, O_NONBLOCK);
>   pollfd.fd = trace_fd;
>  
> + /* display column headers */
> + read_tracing_file_to_stdout("trace");
> +
>   if (write_tracing_file("tracing_on", "1") < 0) {
>   pr_err("can't enable tracing\n");
>   goto out_close_fd;
> -- 
> 2.25.1
> 

-- 

- Arnaldo


[PATCH v8 05/18] perf ftrace: show trace column header

2020-08-07 Thread Changbin Du
This makes perf-ftrace display column header before printing trace.

  $ sudo perf ftrace
  # tracer: function
  #
  # entries-in-buffer/entries-written: 0/0   #P:8
  #
  #TASK-PID CPU#   TIMESTAMP  FUNCTION
  #  | | |   | |
 <...>-9246  [006]  10726.262760: mutex_unlock <-rb_simple_write
 <...>-9246  [006]  10726.262764: __fsnotify_parent <-vfs_write
 <...>-9246  [006]  10726.262765: fsnotify <-vfs_write
 <...>-9246  [006]  10726.262766: __sb_end_write <-vfs_write
 <...>-9246  [006]  10726.262767: fpregs_assert_state_consistent 
<-do_syscall_64

Signed-off-by: Changbin Du 
---
 tools/perf/builtin-ftrace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index a3a4f4be9dde..39c694be2b71 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -435,6 +435,9 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int 
argc, const char **argv)
fcntl(trace_fd, F_SETFL, O_NONBLOCK);
pollfd.fd = trace_fd;
 
+   /* display column headers */
+   read_tracing_file_to_stdout("trace");
+
if (write_tracing_file("tracing_on", "1") < 0) {
pr_err("can't enable tracing\n");
goto out_close_fd;
-- 
2.25.1