perf ftrace: Add 'trace' subcommand
authorNamhyung Kim <namhyung@kernel.org>
Wed, 15 Dec 2021 18:51:50 +0000 (10:51 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 16 Dec 2021 15:18:12 +0000 (12:18 -0300)
commit416e15ad17f84358ba3eca6b82378be97c793c62
tree3264e51fd42d1aac86f01079bf5f654db29e3c35
parent83869019c74cc2d01c96a3be2463a4eebe362224
perf ftrace: Add 'trace' subcommand

This is a preparation to add more sub-commands for ftrace.  The
'trace' subcommand does the same thing when no subcommand is given.

Committer testing:

The previous mode, i.e. no subcommand and the new 'perf ftrace trace'
are equivalent:

  # perf ftrace -G check_preempt_curr sleep 0.00001
  # tracer: function_graph
  #
  # CPU  DURATION                  FUNCTION CALLS
  # |     |   |                     |   |   |   |
   25)               |  check_preempt_curr() {
   25)               |    resched_curr() {
   25)               |      native_smp_send_reschedule() {
   25)               |        default_send_IPI_single_phys() {
   25)   0.110 us    |          __default_send_IPI_dest_field();
   25)   0.490 us    |        }
   25)   0.640 us    |      }
   25)   0.850 us    |    }
   25)   2.060 us    |  }
  # perf ftrace trace -G check_preempt_curr sleep 0.00001
  # tracer: function_graph
  #
  # CPU  DURATION                  FUNCTION CALLS
  # |     |   |                     |   |   |   |
   10)               |  check_preempt_curr() {
   10)               |    resched_curr() {
   10)               |      native_smp_send_reschedule() {
   10)               |        default_send_IPI_single_phys() {
   10)   0.080 us    |          __default_send_IPI_dest_field();
   10)   0.460 us    |        }
   10)   0.610 us    |      }
   10)   0.830 us    |    }
   10)   2.020 us    |  }
  #

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Changbin Du <changbin.du@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20211215185154.360314-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-ftrace.c