// SPDX-License-Identifier: GPL-2.0
#include <Python.h>
#include <structmember.h>
#include <inttypes.h>
#include <poll.h>
#include <linux/err.h>
#include <perf/cpumap.h>
#include <traceevent/event-parse.h>
#include <perf/mmap.h>
#include "evlist.h"
#include "callchain.h"
#include "evsel.h"
#include "event.h"
#include "print_binary.h"
#include "thread_map.h"
#include "trace-event.h"
#include "mmap.h"
#include "stat.h"
#include "metricgroup.h"
#include "util/env.h"
#include <internal/lib.h>
#include "util.h"
#if PY_MAJOR_VERSION < 3
#define _PyUnicode_FromString(arg) \
PyString_FromString(arg)
#define _PyUnicode_AsString(arg) \
PyString_AsString(arg)
#define _PyUnicode_FromFormat(...) \
PyString_FromFormat(__VA_ARGS__)
#define _PyLong_FromLong(arg) \
PyInt_FromLong(arg)
#else
#define _PyUnicode_FromString(arg) \
PyUnicode_FromString(arg)
#define _PyUnicode_FromFormat(...) \
PyUnicode_FromFormat(__VA_ARGS__)
#define _PyLong_FromLong(arg) \
PyLong_FromLong(arg)
#endif
#ifndef Py_TYPE
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#endif
/*
* Provide these two so that we don't have to link against callchain.c and
* start dragging hist.c, etc.
*/
struct callchain_param callchain_param;
int parse_callchain_record(const char *arg __maybe_unused,
struct callchain_param *param __maybe_unused)
{
return 0;
}
/*
* Add this one here not to drag util/env.c
*/
struct perf_env perf_env;
/*
* Add this one here not to drag util/stat-shadow.c
*/
void perf_stat__collect_metric_expr(struct evlist *evsel_list)
{
}
/*
* Add this one here not to drag util/metricgroup.c
*/
int metricgroup__copy_metric_events(struct evlist *evlist, struct cgroup *cgrp,
struct rblist *new_metric_events,
struct rblist *old_metric_events)
{
return 0;
}
/*
* XXX: All these evsel destructors need some better mechanism, like a linked
* list of destructors registered when the relevant code indeed is used instead
* of having more and more calls in perf_evsel__delete(). -- acme
*
* For now, add some more:
*
* Not to drag the BPF bandwagon...
*/
void bpf_counter__destroy(struct evsel *