• Ian Rogers's avatar
    perf parse-events: Make common term list to strbuf helper · 7a6e9164
    Ian Rogers authored
    A term list is turned into a string for debug output and for the str
    value in the alias.
    
    Add a helper to do this based on existing code, but then fix for
    situations like events being identified.
    
    Use strbuf to manage the dynamic memory allocation and remove the 256
    byte limit.
    
    Use in various places the string of the term list is required.
    
    Before:
    
      $ sudo perf stat -vv -e inst_retired.any true
      Using CPUID GenuineIntel-6-8D-1
      intel_pt default config: tsc,mtc,mtc_period=3,psb_period=3,pt,branch
      Attempting to add event pmu 'cpu' with 'inst_retired.any,' that may result in non-fatal errors
      After aliases, add event pmu 'cpu' with 'event,period,' that may result in non-fatal errors
      inst_retired.any -> cpu/inst_retired.any/
      ...
    
    After:
    
    $ sudo perf stat -vv -e inst_retired.any true
    
      Using CPUID GenuineIntel-6-8D-1
      intel_pt default config: tsc,mtc,mtc_period=3,psb_period=3,pt,branch
      Attempt to add: cpu/inst_retired.any/
      ..after resolving event: cpu/event=0xc0,period=0x1e8483/
      inst_retired.any -> cpu/event=0xc0,period=0x1e8483/
      ...
    Signed-off-by: default avatarIan Rogers <irogers@google.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: James Clark <james.clark@arm.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lore.kernel.org/lkml/20230830070753.1821629-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    7a6e9164
parse-events.h 7.8 KB