xref: /linux/tools/power/cpupower/lib/cpupower.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __CPUPOWER_CPUPOWER_H__
3 #define __CPUPOWER_CPUPOWER_H__
4 
5 struct cpupower_topology {
6 	/* Amount of CPU cores, packages and threads per core in the system */
7 	unsigned int cores;
8 	unsigned int pkgs;
9 	unsigned int threads; /* per core */
10 
11 	/* Array gets mallocated with cores entries, holding per core info */
12 	struct cpuid_core_info *core_info;
13 };
14 
15 struct cpuid_core_info {
16 	int pkg;
17 	int core;
18 	int cpu;
19 
20 	/* flags */
21 	unsigned int is_online:1;
22 };
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 int get_cpu_topology(struct cpupower_topology *cpu_top);
29 void cpu_topology_release(struct cpupower_topology cpu_top);
30 int cpupower_is_cpu_online(unsigned int cpu);
31 
32 #ifdef __cplusplus
33 }
34 #endif
35 
36 #endif
37