• Namhyung Kim's avatar
    perf ftrace: Add 'profile' command · 0f223813
    Namhyung Kim authored
    The 'perf ftrace profile' command is to get function execution profiles
    using function-graph tracer so that users can see the total, average,
    max execution time as well as the number of invocations easily.
    
    The following is a profile for the perf_event_open syscall.
    
      $ sudo perf ftrace profile -G __x64_sys_perf_event_open -- \
        perf stat -e cycles -C1 true 2> /dev/null | head
      # Total (us)   Avg (us)   Max (us)      Count   Function
            65.611     65.611     65.611          1   __x64_sys_perf_event_open
            30.527     30.527     30.527          1   anon_inode_getfile
            30.260     30.260     30.260          1   __anon_inode_getfile
            29.700     29.700     29.700          1   alloc_file_pseudo
            17.578     17.578     17.578          1   d_alloc_pseudo
            17.382     17.382     17.382          1   __d_alloc
            16.738     16.738     16.738          1   kmem_cache_alloc_lru
            15.686     15.686     15.686          1   perf_event_alloc
            14.012      7.006     11.264          2   obj_cgroup_charge
      #
    Reviewed-by: default avatarIan Rogers <irogers@google.com>
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Changbin Du <changbin.du@gmail.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Link: https://lore.kernel.org/lkml/20240729004127.238611-4-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    0f223813
ftrace.h 1.76 KB