machine: remove generic func
This commit is contained in:
parent
a48cedb30c
commit
f4abba9a65
|
@ -70,72 +70,3 @@
|
|||
#include "machine/sensors.bogox"
|
||||
#include "machine/network.bogox"
|
||||
|
||||
void
|
||||
system_info_all_free(Sys_Info *info)
|
||||
{
|
||||
sensor_t *snsr;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < info->cpu_count; i++)
|
||||
free(info->cores[i]);
|
||||
free(info->cores);
|
||||
|
||||
for (i = 0; i < info->sensor_count; i++) {
|
||||
snsr = info->sensors[i];
|
||||
if (snsr->name)
|
||||
free(snsr->name);
|
||||
if (snsr->child_name)
|
||||
free(snsr->child_name);
|
||||
free(snsr);
|
||||
}
|
||||
if (info->sensors)
|
||||
free(info->sensors);
|
||||
|
||||
for (i = 0; i < info->power.battery_count; i++) {
|
||||
if (info->power.batteries[i]->name)
|
||||
free(info->power.batteries[i]->name);
|
||||
#if defined(__OpenBSD__)
|
||||
if (info->power.batteries[i]->mibs)
|
||||
free(info->power.batteries[i]->mibs);
|
||||
#endif
|
||||
free(info->power.batteries[i]);
|
||||
}
|
||||
if (info->power.batteries)
|
||||
free(info->power.batteries);
|
||||
|
||||
free(info);
|
||||
}
|
||||
|
||||
Sys_Info *
|
||||
system_info_basic_get(void)
|
||||
{
|
||||
Sys_Info *info = calloc(1, sizeof(Sys_Info));
|
||||
if (!info) return NULL;
|
||||
|
||||
info->cores = system_cpu_usage_get(&info->cpu_count);
|
||||
|
||||
system_memory_usage_get(&info->memory);
|
||||
system_power_state_get(&info->power);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
Sys_Info *
|
||||
system_info_all_get(void)
|
||||
{
|
||||
Sys_Info *info;
|
||||
|
||||
info = calloc(1, sizeof(Sys_Info));
|
||||
if (!info) return NULL;
|
||||
|
||||
info->cores = system_cpu_usage_get(&info->cpu_count);
|
||||
|
||||
system_memory_usage_get(&info->memory);
|
||||
|
||||
system_power_state_get(&info->power);
|
||||
|
||||
info->sensors = system_sensors_thermal_get(&info->sensor_count);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,30 +82,6 @@ typedef struct
|
|||
uint64_t outgoing;
|
||||
} network_t;
|
||||
|
||||
typedef struct Sys_Info Sys_Info;
|
||||
struct Sys_Info
|
||||
{
|
||||
int cpu_count;
|
||||
cpu_core_t **cores;
|
||||
|
||||
meminfo_t memory;
|
||||
power_t power;
|
||||
|
||||
int sensor_count;
|
||||
sensor_t **sensors;
|
||||
|
||||
network_t network_usage;
|
||||
};
|
||||
|
||||
Sys_Info *
|
||||
system_info_all_get(void);
|
||||
|
||||
Sys_Info *
|
||||
system_info_basic_get(void);
|
||||
|
||||
void
|
||||
system_info_all_free(Sys_Info *);
|
||||
|
||||
int
|
||||
system_cpu_online_count_get(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue