perf pmu: Use perf_pmu__open_file() and perf_pmu__scan_file()

Remove some code that duplicates existing methods. Copy strings where
const strings are required.

No functional changes.

Committer notes:

Add a stub for erf_pmu__scan_file() in tools/perf/util/python.c not to
drag tools/perf/util/pmu.c into the python binding.

This fixes 'perf test python' at this point in this patchset.

Reviewed-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Acked-by: Suzuki Poulouse <suzuki.poulose@arm.com>
Tested-by: Tanmay Jagdale <tanmay@marvell.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Bharat Bhushan <bbhushan2@marvell.com>
Cc: George Cherian <gcherian@marvell.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Linu Cherian <lcherian@marvell.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sunil Kovvuri Goutham <sgoutham@marvell.com>
Cc: Will Deacon <will@kernel.org>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230120143702.4035046-3-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
James Clark
2023-01-20 14:36:55 +00:00
committed by Arnaldo Carvalho de Melo
parent f8ad6018ce
commit d50a79cd0f
5 changed files with 27 additions and 60 deletions

View File

@@ -20,6 +20,7 @@
#include "stat.h"
#include "metricgroup.h"
#include "util/env.h"
#include "util/pmu.h"
#include <internal/lib.h>
#include "util.h"
@@ -83,7 +84,7 @@ void perf_stat__collect_metric_expr(struct evlist *evsel_list)
}
/*
* This one is needed not to drag the PMU bandwagon, jevents generated
* These ones are needed not to drag the PMU bandwagon, jevents generated
* pmu_sys_event_tables, etc and evsel__find_pmu() is used so far just for
* doing per PMU perf_event_attr.exclude_guest handling, not really needed, so
* far, for the perf python binding known usecases, revisit if this become
@@ -94,6 +95,11 @@ struct perf_pmu *evsel__find_pmu(struct evsel *evsel __maybe_unused)
return NULL;
}
int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, ...)
{
return EOF;
}
/*
* Add this one here not to drag util/metricgroup.c
*/