• Namhyung Kim's avatar
    perf lock contention: Implement -t/--threads option for BPF · eca949b2
    Namhyung Kim authored
    The BPF didn't show the per-thread stat properly.  Use task's thread id (PID)
    as a key instead of stack_id and add a task_data map to save task comm names.
    
      $ sudo ./perf lock con -abt -E 5 sleep 1
       contended   total wait     max wait     avg wait          pid   comm
    
               1    740.66 ms    740.66 ms    740.66 ms         1950   nv_queue
               3    305.50 ms    298.19 ms    101.83 ms         1884   nvidia-modeset/
               1     25.14 us     25.14 us     25.14 us      2725038   EventManager_De
              12     23.09 us      9.30 us      1.92 us            0   swapper
               1     20.18 us     20.18 us     20.18 us      2725033   EventManager_De
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    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/20221209190727.759804-3-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    eca949b2
lock-contention.h 3.38 KB