From: Gautam Menghani <gautam@linux.ibm.com>
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
namhyung@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
irogers@google.com, adrian.hunter@intel.com,
kan.liang@linux.intel.com
Cc: Gautam Menghani <gautam@linux.ibm.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH 0/3] Introduce a C extension module to allow libperf usage from python
Date: Thu, 13 Mar 2025 13:21:21 +0530 [thread overview]
Message-ID: <20250313075126.547881-1-gautam@linux.ibm.com> (raw)
In this RFC series, we are introducing a C extension module to allow
python programs to call the libperf API functions. Currently libperf can
be used by C programs, but expanding the support to python is beneficial
for python users.
The structure of the patch series is as follows:
1. Patch 1 : Create wrappers for the perf structs which are used by
examples/counting.c
2. Patch 2: Create the C extension module that maps and exposes the
libperf functions to python programs
2. Patch 3: A python variant of counting.c - counting.py to demonstrate
the usage of libperf from python
We have not added support for entire libperf, as we want to get
community feedback on the approach taken in this series.
Gautam Menghani (3):
libperf: Introduce wrappers for perf structs to be exposed to python
libperf: Introduce a C extension module for python
libperf: Add counting.py example to demonstrate libperf usage from
python
tools/lib/perf/Build | 1 +
.../perf/Documentation/examples/counting.py | 74 +++
tools/lib/perf/Makefile | 12 +-
tools/lib/perf/include/perf/py_perf.h | 431 ++++++++++++++++++
tools/lib/perf/libperf.map | 1 +
tools/lib/perf/py_perf.c | 262 +++++++++++
6 files changed, 779 insertions(+), 2 deletions(-)
create mode 100755 tools/lib/perf/Documentation/examples/counting.py
create mode 100644 tools/lib/perf/include/perf/py_perf.h
create mode 100644 tools/lib/perf/py_perf.c
--
2.47.0
next reply other threads:[~2025-03-13 7:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 7:51 Gautam Menghani [this message]
2025-03-13 7:51 ` [RFC PATCH 1/3] libperf: Introduce wrappers for perf structs to be exposed to python Gautam Menghani
2025-03-13 7:51 ` [RFC PATCH 2/3] libperf: Introduce a C extension module for python Gautam Menghani
2025-03-13 7:51 ` [RFC PATCH 3/3] libperf: Add counting.py example to demonstrate libperf usage from python Gautam Menghani
2025-03-13 14:12 ` [RFC PATCH 0/3] Introduce a C extension module to allow " John B. Wyatt IV
2025-03-13 16:01 ` Ian Rogers
2025-03-14 8:20 ` Gautam Menghani
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=20250313075126.547881-1-gautam@linux.ibm.com \
--to=gautam@linux.ibm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).