• Namhyung Kim's avatar
    perf ftrace: Add support for --pid option · a9af6be5
    Namhyung Kim authored
    The -p (--pid) option enables to trace existing process by its pid.
    
    Committer notes:
    
    Testing it:
    
    Using the function_graph tracer on a process that is just waiting for user
    input and thus will make 'perf ftrace' sit there waiting for that, then press
    any key on that mutt session and see what happens:
    
      # perf ftrace -t function_graph -p `pidof mutt` | head -40
      2)   1.038 us    |  switch_mm_irqs_off();
      ------------------------------------------
      2)    <idle>-0    =>   mutt-3595
      ------------------------------------------
    
      2)               |              finish_task_switch() {
      2)               |                smp_irq_work_interrupt() {
      2)               |                  irq_enter() {
      2)   0.180 us    |                    rcu_irq_enter();
      2)   1.248 us    |                  }
      2)               |                  __wake_up() {
      2)   0.126 us    |                    _raw_spin_lock_irqsave();
      2)               |                    __wake_up_common() {
      2)               |                      pollwake() {
      2)               |                        default_wake_function() {
      2)               |                          try_to_wake_up() {
      2)   0.662 us    |                            _raw_spin_lock_irqsave();
      2)               |                            select_task_rq_fair() {
      2)   1.719 us    |                              effective_load.isra.41();
      2)   1.343 us    |                              effective_load.isra.41();
      2)               |                              select_idle_sibling() {
      2)   0.331 us    |                                idle_cpu();
      2)   1.458 us    |                              }
      2)   8.350 us    |                            }
      2)   0.200 us    |                            _raw_spin_lock();
      2)               |                            ttwu_do_activate() {
      2)               |                              activate_task() {
      2)   0.136 us    |                                update_rq_clock.part.77();
      2)               |                                enqueue_task_fair() {
      2)               |                                  enqueue_entity() {
      2)   0.146 us    |                                    update_curr();
      2)   0.330 us    |                                    account_entity_enqueue();
      2)   0.280 us    |                                    update_cfs_shares();
      2)   0.321 us    |                                    place_entity();
      2)   0.206 us    |                                    __enqueue_entity();
      2)   6.926 us    |                                  }
      2)               |                                  enqueue_entity() {
      2)   0.105 us    |                                    update_curr();
      2)   0.175 us    |                                    account_entity_enqueue();
      2)   0.531 us    |                                    update_cfs_shares();
     #
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: kernel-team@lge.com
    Link: http://lkml.kernel.org/r/20170224011251.14946-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    a9af6be5
builtin-ftrace.c 6.22 KB