• Kan Liang's avatar
    perf evlist: Save branch counters information · 3a867a6d
    Kan Liang authored
    
    
    The branch counters logging (A.K.A LBR event logging) introduces a
    per-counter indication of precise event occurrences in LBRs. The kernel
    only dumps the number of occurrences into a record. The perf tool has
    to map the number to the corresponding event.
    
    Add evlist__update_br_cntr() to go through the evlist to pick the
    events that are configured to be logged. Assign a logical idx to track
    them, and add the total number of the events in the leader event.
    
    The total number will be used to allocate the space to save the branch
    counters for a block. The logical idx will be used to locate the
    corresponding event quickly in the following patches.
    
    It only needs to iterate the evlist once. The
    evsel__has_branch_counters() is also optimized.
    Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
    Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
    Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Link: https://lore.kernel.org/r/20240813160208.2493643-4-kan.liang@linux.intel.com
    
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    3a867a6d
evlist.h 15.9 KB