mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 14:33:24 -04:00
perf python: Add missed explicit dependencies
Fix missing #include of pmus.h found while cleaning the evsel/evlist header files. Also define PY_SSIZE_T_CLEAN before including Python.h to comply with modern Python 3 C-API requirements, and introduce CHECK_INITIALIZED and CHECK_INITIALIZED_INT safety macros to be used by subsequent patches. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alice Rogers <alice.mei.rogers@gmail.com> Cc: Dapeng Mi <dapeng1.mi@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Leo Yan <leo.yan@linux.dev> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Richter <tmricht@linux.ibm.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
@@ -1,30 +1,37 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include <Python.h>
|
||||
#include <structmember.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include <linux/err.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include <internal/lib.h>
|
||||
#include <perf/cpumap.h>
|
||||
#ifdef HAVE_LIBTRACEEVENT
|
||||
#include <event-parse.h>
|
||||
#endif
|
||||
#include <perf/mmap.h>
|
||||
#include <structmember.h>
|
||||
|
||||
#include "callchain.h"
|
||||
#include "counts.h"
|
||||
#include "event.h"
|
||||
#include "evlist.h"
|
||||
#include "evsel.h"
|
||||
#include "event.h"
|
||||
#include "expr.h"
|
||||
#include "metricgroup.h"
|
||||
#include "mmap.h"
|
||||
#include "pmus.h"
|
||||
#include "print_binary.h"
|
||||
#include "record.h"
|
||||
#include "strbuf.h"
|
||||
#include "thread_map.h"
|
||||
#include "tp_pmu.h"
|
||||
#include "trace-event.h"
|
||||
#include "metricgroup.h"
|
||||
#include "mmap.h"
|
||||
#include "util/sample.h"
|
||||
#include <internal/lib.h>
|
||||
|
||||
#ifdef HAVE_LIBTRACEEVENT
|
||||
#include <event-parse.h>
|
||||
#endif
|
||||
|
||||
PyMODINIT_FUNC PyInit_perf(void);
|
||||
|
||||
@@ -38,6 +45,22 @@ PyMODINIT_FUNC PyInit_perf(void);
|
||||
offsetof(struct pyrf_event, sample) + offsetof(struct perf_sample, member), \
|
||||
0, help }
|
||||
|
||||
#define CHECK_INITIALIZED(ptr, msg) \
|
||||
do { \
|
||||
if (!(ptr)) { \
|
||||
PyErr_SetString(PyExc_ValueError, msg " not initialized"); \
|
||||
return NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CHECK_INITIALIZED_INT(ptr, msg) \
|
||||
do { \
|
||||
if (!(ptr)) { \
|
||||
PyErr_SetString(PyExc_ValueError, msg " not initialized"); \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
struct pyrf_event {
|
||||
PyObject_HEAD
|
||||
struct evsel *evsel;
|
||||
|
||||
Reference in New Issue
Block a user