Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] cpupower: Install cpupower.h as a public header file
@ 2017-10-16 18:50 Dmitry Shachnev
  2017-10-17  8:29 ` Thomas Renninger
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Shachnev @ 2017-10-16 18:50 UTC (permalink / raw)
  To: Thomas Renninger; +Cc: linux-pm

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(+)

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
-- 
2.14.1


--
Dmitry Shachnev

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpupower: Install cpupower.h as a public header file
  2017-10-16 18:50 [PATCH] cpupower: Install cpupower.h as a public header file Dmitry Shachnev
@ 2017-10-17  8:29 ` Thomas Renninger
  2017-10-17 19:53   ` Dmitry Shachnev
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Renninger @ 2017-10-17  8:29 UTC (permalink / raw)
  To: Dmitry Shachnev; +Cc: linux-pm

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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpupower: Install cpupower.h as a public header file
  2017-10-17  8:29 ` Thomas Renninger
@ 2017-10-17 19:53   ` Dmitry Shachnev
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Shachnev @ 2017-10-17 19:53 UTC (permalink / raw)
  To: Thomas Renninger; +Cc: linux-pm


[-- Attachment #1.1: Type: text/plain, Size: 1045 bytes --]

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

[-- Attachment #1.2: test_cpupower.c --]
[-- Type: text/x-csrc, Size: 540 bytes --]

#include <stdio.h>
#include <cpupower.h>

int main() {
    struct cpupower_topology cpu_top;
    int cpus = get_cpu_topology (&cpu_top);
    printf("cores = %u, pkgs = %u, threads per code = %u\n",
           cpu_top.cores, cpu_top.pkgs, cpu_top.threads);
    for (int i = 0; i < cpus; ++i) {
        struct cpuid_core_info *info = cpu_top.core_info + i;
        printf("core %d: pkg = %d, core = %d, cpu = %d, online = %u\n",
               i, info->pkg, info->core, info->cpu, info->is_online);
    }
    cpu_topology_release(cpu_top);
}

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-17 19:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-16 18:50 [PATCH] cpupower: Install cpupower.h as a public header file Dmitry Shachnev
2017-10-17  8:29 ` Thomas Renninger
2017-10-17 19:53   ` Dmitry Shachnev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox