diff options
author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 00:35:56 -0300 |
---|---|---|
committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 00:35:56 -0300 |
commit | 754b5d1114f096778e483f8a6f3a5dc333225e26 (patch) | |
tree | 30911ec9da4cfd2f5572c27f7288fcbfa4cd212d /includes/cpu_util.h | |
parent | 35c2857da302ab8b3c308052f2cd1674fb4141a6 (diff) | |
parent | 5f01c706267c595de92406a32e7f31ef5056c2d0 (diff) |
Update upstream source from tag 'upstream/2.0.3pre'
Update to upstream version '2.0.3pre'
with Debian dir 6683980bf6b5c02f6847fd56765833301f75f4f3
Diffstat (limited to 'includes/cpu_util.h')
-rw-r--r-- | includes/cpu_util.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/includes/cpu_util.h b/includes/cpu_util.h new file mode 100644 index 00000000..1adbf491 --- /dev/null +++ b/includes/cpu_util.h @@ -0,0 +1,52 @@ +#ifndef __CPU_UTIL_H__ +#define __CPU_UTIL_H__ + +#include "hardinfo.h" + +#ifndef PROC_CPUINFO +#define PROC_CPUINFO "/proc/cpuinfo" +#endif + +#define STRIFNULL(f,cs) if (f == NULL) f = g_strdup(cs); +#define UNKIFNULL(f) STRIFNULL(f, _("(Unknown)") ) +#define EMPIFNULL(f) STRIFNULL(f, "") + +const gchar *byte_order_str(void); + +/* from /sys/devices/system/cpu/cpu%d/%s */ +gchar* get_cpu_str(const gchar* file, gint cpuid); +gint get_cpu_int(const char* item, int cpuid, int null_val); + +/* space delimted list of flags, finds flag */ +int processor_has_flag(gchar * strflags, gchar * strflag); + +typedef struct { + gint id; + gint cpukhz_max, cpukhz_min, cpukhz_cur; + gchar *scaling_driver, *scaling_governor; + gint transition_latency; + gchar *shared_list; +} cpufreq_data; + +typedef struct { + gint id; /* thread */ + gint socket_id; + gint core_id; + gint book_id; + gint drawer_id; +} cpu_topology_data; + +cpufreq_data *cpufreq_new(gint id); +void cpufreq_update(cpufreq_data *cpufd, int cur_only); +void cpufreq_free(cpufreq_data *cpufd); + +gchar *cpufreq_section_str(cpufreq_data *cpufd); + +cpu_topology_data *cputopo_new(gint id); +void cputopo_free(cpu_topology_data *cputd); + +gchar *cputopo_section_str(cpu_topology_data *cputd); + +int cpu_procs_cores_threads_nodes(int *p, int *c, int *t, int *n); + +#endif |