[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240724221122.54601-1-jwyatt@redhat.com>
Date: Wed, 24 Jul 2024 18:11:18 -0400
From: "John B. Wyatt IV" <jwyatt@...hat.com>
To: linux-pm@...r.kernel.org,
"Thomas Renninger" <trenn@...e.com>,
"Shuah Khan" <shuah@...nel.org>,
"Shuah Khan" <skhan@...uxfoundation.org>
Cc: "John B. Wyatt IV" <jwyatt@...hat.com>,
linux-kernel@...r.kernel.org,
"John Kacur" <jkacur@...hat.com>,
"Tomas Glozar" <tglozar@...hat.com>,
"John B. Wyatt IV" <sageofredondo@...il.com>
Subject: [PATCH 0/2][RFC] Add SWIG Bindings to libcpupower
SWIG is a tool packaged in Fedora and other distros that can generate
bindings from C and C++ code for several languages including Python,
Perl, and Go. We at Red Hat are interested in adding binding support to
libcpupower so Python tools like rteval or tuned can make easy use of it.
This RFC provides a limited subset of bindings as a demonstration. The second
commit provides a Python test script to verify the bindings. I wanted to get
feedback on this before implementing (and possibly testing) the entire library.
The name raw_pylibcpupower is used because this is a demonstration example that
only provides direct bindings for a few functions. A wrapper `pylibcpupower`
may be needed to make the bindings more 'pythonic'. The bindings folder is used
because Go bindings may be useful for Kubernetes or OpenShift in the future.
How should the bindings be built? The current example requires the makefile
in cpupower directory be run first to generate the .o files needed before
running the makefile in the python directory in a seperate step. Would the
maintainers prefer the two makefiles integrated?
Another question is do you want more test files like the .py example? Would
this be used as part of a greater test suite?
Note that while SWIG itself is GPL v3+ licensed; the resulting output, the
bindings code, is permissively licensed. Please see
https://swig.org/legal.html for more details.
John B. Wyatt IV (2):
Add SWIG bindings files for libcpupower
Include test_raw_pylibcpupower.py
.../power/cpupower/bindings/python/.gitignore | 8 ++++
tools/power/cpupower/bindings/python/Makefile | 31 +++++++++++++
tools/power/cpupower/bindings/python/README | 33 ++++++++++++++
.../bindings/python/raw_pylibcpupower.i | 45 +++++++++++++++++++
.../bindings/python/test_raw_pylibcpupower.py | 42 +++++++++++++++++
5 files changed, 159 insertions(+)
create mode 100644 tools/power/cpupower/bindings/python/.gitignore
create mode 100644 tools/power/cpupower/bindings/python/Makefile
create mode 100644 tools/power/cpupower/bindings/python/README
create mode 100644 tools/power/cpupower/bindings/python/raw_pylibcpupower.i
create mode 100755 tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py
--
2.45.2
Powered by blists - more mailing lists