37 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2#ifndef __CPUPOWER_CPUPOWER_H__3#define __CPUPOWER_CPUPOWER_H__4 5struct 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 15struct 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 __cplusplus25extern "C" {26#endif27 28int get_cpu_topology(struct cpupower_topology *cpu_top);29void cpu_topology_release(struct cpupower_topology cpu_top);30int cpupower_is_cpu_online(unsigned int cpu);31 32#ifdef __cplusplus33}34#endif35 36#endif37