• Ian Rogers's avatar
    perf test pmu: Refactor format test and exposed test APIs · aa1551f2
    Ian Rogers authored
    In tests/pmu.c, make a common utility that creates a PMU in a mkdtemp
    directory and uses regular PMU parsing logic to load that PMU. Formats
    must still be eagerly loaded as by default the PMU code assumes devices
    are going to be in sysfs.
    
    In util/pmu.[ch], hide perf_pmu__format_parse but add the eager argument
    to perf_pmu__lookup called by perf_pmus__add_test_pmu. Later patches
    will eagerly load other non-sysfs files when eager loading is enabled.
    
    In tests/pmu.c, rather than manually constructing a list of term
    arguments, just use the term parsing code from a string.
    
    Add more comments and debug logging.
    Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
    Signed-off-by: default avatarIan Rogers <irogers@google.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Bjorn Helgaas <bhelgaas@google.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: James Clark <james.clark@arm.com>
    Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Cc: Ravi Bangoria <ravi.bangoria@amd.com>
    Cc: Thomas Richter <tmricht@linux.ibm.com>
    Link: https://lore.kernel.org/r/20240502213507.2339733-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    aa1551f2
pmu.h 8.89 KB