python.c (351a1f5c8afa13ea5cfcdae543f6596ef8ebdbd9) python.c (a583053299c1e66e6202b494cbc3acd93cedc4cc)
1// SPDX-License-Identifier: GPL-2.0
2#include <Python.h>
3#include <structmember.h>
4#include <inttypes.h>
5#include <poll.h>
6#include <linux/err.h>
7#include <perf/cpumap.h>
8#include <traceevent/event-parse.h>

--- 970 unchanged lines hidden (view full) ---

979 Py_INCREF(pevsel);
980 evsel = &((struct pyrf_evsel *)pevsel)->evsel;
981 evsel->idx = evlist->core.nr_entries;
982 evlist__add(evlist, evsel);
983
984 return Py_BuildValue("i", evlist->core.nr_entries);
985}
986
1// SPDX-License-Identifier: GPL-2.0
2#include <Python.h>
3#include <structmember.h>
4#include <inttypes.h>
5#include <poll.h>
6#include <linux/err.h>
7#include <perf/cpumap.h>
8#include <traceevent/event-parse.h>

--- 970 unchanged lines hidden (view full) ---

979 Py_INCREF(pevsel);
980 evsel = &((struct pyrf_evsel *)pevsel)->evsel;
981 evsel->idx = evlist->core.nr_entries;
982 evlist__add(evlist, evsel);
983
984 return Py_BuildValue("i", evlist->core.nr_entries);
985}
986
987static struct perf_mmap *get_md(struct evlist *evlist, int cpu)
987static struct mmap *get_md(struct evlist *evlist, int cpu)
988{
989 int i;
990
991 for (i = 0; i < evlist->nr_mmaps; i++) {
988{
989 int i;
990
991 for (i = 0; i < evlist->nr_mmaps; i++) {
992 struct perf_mmap *md = &evlist->mmap[i];
992 struct mmap *md = &evlist->mmap[i];
993
994 if (md->cpu == cpu)
995 return md;
996 }
997
998 return NULL;
999}
1000
1001static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
1002 PyObject *args, PyObject *kwargs)
1003{
1004 struct evlist *evlist = &pevlist->evlist;
1005 union perf_event *event;
1006 int sample_id_all = 1, cpu;
1007 static char *kwlist[] = { "cpu", "sample_id_all", NULL };
993
994 if (md->cpu == cpu)
995 return md;
996 }
997
998 return NULL;
999}
1000
1001static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
1002 PyObject *args, PyObject *kwargs)
1003{
1004 struct evlist *evlist = &pevlist->evlist;
1005 union perf_event *event;
1006 int sample_id_all = 1, cpu;
1007 static char *kwlist[] = { "cpu", "sample_id_all", NULL };
1008 struct perf_mmap *md;
1008 struct mmap *md;
1009 int err;
1010
1011 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|i", kwlist,
1012 &cpu, &sample_id_all))
1013 return NULL;
1014
1015 md = get_md(evlist, cpu);
1016 if (!md)

--- 367 unchanged lines hidden ---
1009 int err;
1010
1011 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|i", kwlist,
1012 &cpu, &sample_id_all))
1013 return NULL;
1014
1015 md = get_md(evlist, cpu);
1016 if (!md)

--- 367 unchanged lines hidden ---