diff mbox

cpupower: Install cpupower.h as a public header file

Message ID 20171016185004.zyq6eugwedc34f7l@mitya57.me (mailing list archive)
State Deferred
Delegated to: Shuah Khan
Headers show

Commit Message

Dmitry Shachnev Oct. 16, 2017, 6:50 p.m. UTC
This helps software that uses cpupower_is_cpu_online function, such as
gnome-applets.

Signed-off-by: Dmitry Shachnev <mitya57@debian.org>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=153161
---
 tools/power/cpupower/Makefile | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Renninger Oct. 17, 2017, 8:29 a.m. UTC | #1
On Monday, October 16, 2017 09:50:04 PM Dmitry Shachnev wrote:
> This helps software that uses cpupower_is_cpu_online function, such as
> gnome-applets.

Can you give it a try or confirm that the CPU topology list/functions also 
work as intended if used as an external library, please.
And whether they are written to be easily used and understood or whether
the interface could still be enhanced.

If things work as expected by others, it's certainly a good idea to publish 
these.

Thanks,

     Thomas

> 
> Signed-off-by: Dmitry Shachnev <mitya57@debian.org>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=153161
> ---
>  tools/power/cpupower/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
> index 4c5a481a850c..113e14983c7d 100644
> --- a/tools/power/cpupower/Makefile
> +++ b/tools/power/cpupower/Makefile
> @@ -278,6 +278,7 @@ install-lib:
>  	$(INSTALL) -d $(DESTDIR)${includedir}
>  	$(INSTALL_DATA) lib/cpufreq.h $(DESTDIR)${includedir}/cpufreq.h
>  	$(INSTALL_DATA) lib/cpuidle.h $(DESTDIR)${includedir}/cpuidle.h
> +	$(INSTALL_DATA) lib/cpupower.h $(DESTDIR)${includedir}/cpupower.h
>  
>  install-tools:
>  	$(INSTALL) -d $(DESTDIR)${bindir}
> @@ -314,6 +315,7 @@ uninstall:
>  	- rm -f $(DESTDIR)${libdir}/libcpupower.*
>  	- rm -f $(DESTDIR)${includedir}/cpufreq.h
>  	- rm -f $(DESTDIR)${includedir}/cpuidle.h
> +	- rm -f $(DESTDIR)${includedir}/cpupower.h
>  	- rm -f $(DESTDIR)${bindir}/utils/cpupower
>  	- rm -f $(DESTDIR)${mandir}/man1/cpupower.1
>  	- rm -f $(DESTDIR)${mandir}/man1/cpupower-frequency-set.1
>
Dmitry Shachnev Oct. 17, 2017, 7:53 p.m. UTC | #2
Hi Thomas!

On Tue, Oct 17, 2017 at 10:29:23AM +0200, Thomas Renninger wrote:
> On Monday, October 16, 2017 09:50:04 PM Dmitry Shachnev wrote:
> > This helps software that uses cpupower_is_cpu_online function, such as
> > gnome-applets.
>
> Can you give it a try or confirm that the CPU topology list/functions also
> work as intended if used as an external library, please.
> And whether they are written to be easily used and understood or whether
> the interface could still be enhanced.
>
> If things work as expected by others, it's certainly a good idea to publish
> these.

With the attached little test program, I get this result:

cores = 0, pkgs = 1, threads per code = 0
core 0: pkg = 0, core = 0, cpu = 0, online = 1
core 1: pkg = 0, core = 1, cpu = 1, online = 1

cores is always 0, but that is explained in a comment in cpupower.c.
threads is never assigned any value, I assume this can be implemented later?

The rest of output looks fine to me, though I am not going to use this API
so I cannot really judge.

--
Dmitry Shachnev
diff mbox

Patch

diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 4c5a481a850c..113e14983c7d 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -278,6 +278,7 @@  install-lib:
 	$(INSTALL) -d $(DESTDIR)${includedir}
 	$(INSTALL_DATA) lib/cpufreq.h $(DESTDIR)${includedir}/cpufreq.h
 	$(INSTALL_DATA) lib/cpuidle.h $(DESTDIR)${includedir}/cpuidle.h
+	$(INSTALL_DATA) lib/cpupower.h $(DESTDIR)${includedir}/cpupower.h
 
 install-tools:
 	$(INSTALL) -d $(DESTDIR)${bindir}
@@ -314,6 +315,7 @@  uninstall:
 	- rm -f $(DESTDIR)${libdir}/libcpupower.*
 	- rm -f $(DESTDIR)${includedir}/cpufreq.h
 	- rm -f $(DESTDIR)${includedir}/cpuidle.h
+	- rm -f $(DESTDIR)${includedir}/cpupower.h
 	- rm -f $(DESTDIR)${bindir}/utils/cpupower
 	- rm -f $(DESTDIR)${mandir}/man1/cpupower.1
 	- rm -f $(DESTDIR)${mandir}/man1/cpupower-frequency-set.1