From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Yicong Yang <yangyicong@hisilicon.com>,
James Clark <james.clark@linaro.org>,
Howard Chu <howardchu95@gmail.com>,
"Dr. David Alan Gilbert" <linux@treblig.org>,
Levi Yun <yeoreum.yun@arm.com>, Ze Gao <zegao2021@gmail.com>,
Weilin Wang <weilin.wang@intel.com>, Xu Yang <xu.yang_2@nxp.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 05/11] perf python: Add member access to a number of evsel variables
Date: Wed, 8 Jan 2025 23:51:02 -0800 [thread overview]
Message-ID: <20250109075108.7651-6-irogers@google.com> (raw)
In-Reply-To: <20250109075108.7651-1-irogers@google.com>
Most variables are part of the perf_event_attr, so that they may be
queried and modified.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/python.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 8f68320130c4..6a7042fd2569 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -802,6 +802,28 @@ static PyMethodDef pyrf_evsel__methods[] = {
{ .ml_name = NULL, }
};
+#define evsel_member_def(member, ptype, help) \
+ { #member, ptype, \
+ offsetof(struct pyrf_evsel, evsel.member), \
+ 0, help }
+
+#define evsel_attr_member_def(member, ptype, help) \
+ { #member, ptype, \
+ offsetof(struct pyrf_evsel, evsel.core.attr.member), \
+ 0, help }
+
+static PyMemberDef pyrf_evsel__members[] = {
+ evsel_member_def(tracking, T_BOOL, "tracking event."),
+ evsel_attr_member_def(type, T_UINT, "attribute type."),
+ evsel_attr_member_def(size, T_UINT, "attribute size."),
+ evsel_attr_member_def(config, T_ULONGLONG, "attribute config."),
+ evsel_attr_member_def(sample_period, T_ULONGLONG, "attribute sample_period."),
+ evsel_attr_member_def(sample_type, T_ULONGLONG, "attribute sample_type."),
+ evsel_attr_member_def(read_format, T_ULONGLONG, "attribute read_format."),
+ evsel_attr_member_def(wakeup_events, T_UINT, "attribute wakeup_events."),
+ { .name = NULL, },
+};
+
static const char pyrf_evsel__doc[] = PyDoc_STR("perf event selector list object.");
static PyTypeObject pyrf_evsel__type = {
@@ -811,6 +833,7 @@ static PyTypeObject pyrf_evsel__type = {
.tp_dealloc = (destructor)pyrf_evsel__delete,
.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
.tp_doc = pyrf_evsel__doc,
+ .tp_members = pyrf_evsel__members,
.tp_methods = pyrf_evsel__methods,
.tp_init = (initproc)pyrf_evsel__init,
.tp_str = pyrf_evsel__str,
--
2.47.1.613.gc27f4b7a9f-goog
next prev parent reply other threads:[~2025-01-09 7:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 7:50 [PATCH v1 00/11] Python improvements for a real use of parse_events Ian Rogers
2025-01-09 7:50 ` [PATCH v1 01/11] perf debug: Avoid stack overflow in recursive error message Ian Rogers
2025-02-27 5:40 ` Howard Chu
2025-02-27 5:45 ` Ian Rogers
2025-02-27 6:03 ` Howard Chu
2025-01-09 7:50 ` [PATCH v1 02/11] perf evlist: Add success path to evlist__create_syswide_maps Ian Rogers
2025-01-09 7:51 ` [PATCH v1 03/11] perf evsel: tp_format accessing improvements Ian Rogers
2025-02-27 5:43 ` Howard Chu
2025-01-09 7:51 ` [PATCH v1 04/11] perf python: Add evlist enable and disable methods Ian Rogers
2025-01-09 7:51 ` Ian Rogers [this message]
2025-01-09 7:51 ` [PATCH v1 06/11] perf python: Add optional cpus and threads arguments to parse_events Ian Rogers
2025-01-09 7:51 ` [PATCH v1 07/11] perf python: Update ungrouped evsel leader in clone Ian Rogers
2025-01-09 7:51 ` [PATCH v1 08/11] perf python: Avoid duplicated code in get_tracepoint_field Ian Rogers
2025-01-09 7:51 ` [PATCH v1 09/11] perf python: Add evlist all_cpus accessor Ian Rogers
2025-01-09 7:51 ` [PATCH v1 10/11] perf python: Add evlist.config to set up record options Ian Rogers
2025-02-27 5:46 ` Howard Chu
2025-02-27 6:21 ` Ian Rogers
2025-01-09 7:51 ` [PATCH v1 11/11] perf python tracepoint: Switch to using parse_events Ian Rogers
2025-02-04 22:23 ` [PATCH v1 00/11] Python improvements for a real use of parse_events Ian Rogers
2025-02-10 16:06 ` Ian Rogers
2025-02-10 19:42 ` Namhyung Kim
[not found] ` <CA+JHD90PDGA-Zbu6hUZ1DZQbSD71FBPRbBdGd1dWCxhi3q6Q1g@mail.gmail.com>
2025-02-25 6:30 ` Ian Rogers
2025-02-27 5:52 ` Howard Chu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250109075108.7651-6-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=howardchu95@gmail.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux@treblig.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=weilin.wang@intel.com \
--cc=xu.yang_2@nxp.com \
--cc=yangyicong@hisilicon.com \
--cc=yeoreum.yun@arm.com \
--cc=zegao2021@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox