• Namhyung Kim's avatar
    perf lock contention: Add -L/--lock-filter option · 511e19b9
    Namhyung Kim authored
    The -L/--lock-filter option is to filter only given locks.  The locks
    can be specified by address or name (if exists).
    
      $ sudo ./perf lock record -a  sleep 1
    
      $ sudo ./perf lock con -l
       contended  total wait  max wait  avg wait           address  symbol
    
              57     1.11 ms  42.83 us  19.54 us  ffff9f4140059000
              15   280.88 us  23.51 us  18.73 us  ffffffff9d007a40  jiffies_lock
               1    20.49 us  20.49 us  20.49 us  ffffffff9d0d50c0  rcu_state
               1     9.02 us   9.02 us   9.02 us  ffff9f41759e9ba0
    
      $ sudo ./perf lock con -L jiffies_lock,rcu_state
       contended  total wait  max wait  avg wait      type  caller
    
              15   280.88 us  23.51 us  18.73 us  spinlock  tick_sched_do_timer+0x93
               1    20.49 us  20.49 us  20.49 us  spinlock  __softirqentry_text_start+0xeb
    
      $ sudo ./perf lock con -L ffff9f4140059000
       contended  total wait  max wait  avg wait      type  caller
    
              38   779.40 us  42.83 us  20.51 us  spinlock  worker_thread+0x50
              11   216.30 us  39.87 us  19.66 us  spinlock  queue_work_on+0x39
               8   118.13 us  20.51 us  14.77 us  spinlock  kthread+0xe5
    
    Committer testing:
    
      # uname -a
      Linux quaco 6.0.12-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 8 17:15:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
      # perf lock record
      ^C[ perf record: Woken up 1 times to write data ]
      # perf lock con -L jiffies_lock,rcu_state
       contended   total wait     max wait     avg wait         type   caller
    
      # perf lock con
       contended   total wait     max wait     avg wait         type   caller
    
               1      9.06 us      9.06 us      9.06 us     spinlock   call_timer_fn+0x24
      # perf lock con -L call
      ignore unknown symbol: call
       contended   total wait     max wait     avg wait         type   caller
    
               1      9.06 us      9.06 us      9.06 us     spinlock   call_timer_fn+0x24
      #
    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: Blake Jones <blakejones@google.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Song Liu <song@kernel.org>
    Cc: bpf@vger.kernel.org
    Link: https://lore.kernel.org/r/20221219201732.460111-5-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    511e19b9
perf-lock.txt 4.57 KB