• Namhyung Kim's avatar
    perf annotate: Cache debuginfo for data type profiling · 037f1b67
    Namhyung Kim authored
    
    
    In find_data_type(), it creates and deletes a debug info whenver it
    tries to find data type for a sample.  This is inefficient and it most
    likely accesses the same binary again and again.
    
    Let's add a single entry cache the debug info structure for the last DSO.
    Depending on sample data, it usually gives me 2~3x (and sometimes more)
    speed ups.
    
    Note that this will introduce a little difference in the output due to
    the order of checking stack operations.  It used to check the stack ops
    before checking the availability of debug info but I moved it after the
    symbol check.  So it'll report stack operations in DSOs without debug
    info as unknown.  But I think it's ok and better to have the checking
    near the caching logic.
    
    Committer testing:
    
      root@x1:~# perf mem record -a sleep 5s
      root@x1:~# perf evlist
      cpu_atom/mem-loads,ldlat=30/P
      cpu_atom/mem-stores/P
      dummy:u
      root@x1:~# diff -u before after
      --- before	2024-08-08 09:33:53.880780784 -0300
      +++ after	2024-08-08 09:35:13.917325041 -0300
      @@ -81,8 +81,8 @@
       # Overhead  Data Type
       # ........  .........
       #
      -    55.43%  (unknown)
      -    11.61%  (stack operation)
      +    55.56%  (unknown)
      +    11.48%  (stack operation)
            4.93%  struct pcpu_hot
            3.26%  unsigned int
            2.48%  struct
    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: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
    Cc: Ian Rogers <irogers@google.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>
    Link: https://lore.kernel.org/r/20240805234648.1453689-1-namhyung@kernel.org
    
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    037f1b67
session.c 80.2 KB