evisum/src/bin/next/machine.h

149 lines
2.1 KiB
C
Raw Normal View History

2021-05-16 09:39:04 -07:00
#ifndef MACHINE_H
#define MACHINE_H
2021-05-16 04:12:19 -07:00
2021-05-16 09:39:04 -07:00
#include <Eina.h>
2021-05-16 04:25:14 -07:00
#include <stdint.h>
#include <stdbool.h>
typedef struct
{
unsigned long total;
unsigned long idle;
float percent;
int id;
} Cpu_Core;
2021-05-16 04:25:14 -07:00
#define MEM_VIDEO_CARD_MAX 8
typedef struct
{
uint64_t total;
uint64_t used;
} meminfo_video_t;
typedef struct
{
uint64_t total;
uint64_t used;
uint64_t cached;
uint64_t buffered;
uint64_t shared;
uint64_t swap_total;
uint64_t swap_used;
uint64_t zfs_arc_used;
uint64_t video_count;
meminfo_video_t video[MEM_VIDEO_CARD_MAX];
} meminfo_t;
typedef struct
{
char *name;
char *child_name;
#if defined(__linux__)
char *path;
#elif defined(__OpenBSD__)
int mibs[5];
#endif
double value;
bool invalid;
} Sensor;
2021-05-16 04:25:14 -07:00
typedef struct
{
char *name;
char *vendor;
char *model;
double charge_full;
double charge_current;
2021-05-16 09:39:04 -07:00
double percent;
2021-05-16 04:25:14 -07:00
bool present;
#if defined(__OpenBSD__)
int mibs[5];
#endif
2021-05-16 09:39:04 -07:00
} Battery;
2021-05-16 04:25:14 -07:00
typedef struct
{
bool have_ac;
#if defined(__OpenBSD__)
int mibs[5];
#endif
} AC_Adapter;
2021-05-16 04:25:14 -07:00
typedef struct
{
char name[255];
uint64_t total_in;
uint64_t total_out;
uint64_t peak_in;
uint64_t peak_out;
uint64_t in;
uint64_t out;
} Network_Interface;
Eina_Bool
power_ac(void);
2021-05-16 04:25:14 -07:00
2021-05-16 09:39:04 -07:00
Eina_List *
batteries_find(void);
void
battery_free(Battery *bat);
void
battery_check(Battery *bat);
Eina_List *
sensors_find(void);
2021-05-16 09:39:04 -07:00
void
sensor_free(Sensor *sensor);
2021-05-16 09:39:04 -07:00
Eina_Bool
sensor_check(Sensor *sensor);
Eina_List *
network_interfaces_find(void);
2021-05-16 09:39:04 -07:00
2021-05-16 04:25:14 -07:00
int
system_cpu_online_count_get(void);
int
system_cpu_count_get(void);
Cpu_Core **
2021-05-16 04:25:14 -07:00
system_cpu_usage_get(int *ncpu);
Cpu_Core **
2021-05-16 04:25:14 -07:00
system_cpu_usage_delayed_get(int *ncpu, int usecs);
Cpu_Core **
2021-05-16 04:25:14 -07:00
system_cpu_state_get(int *ncpu);
int
system_cpu_frequency_get(void);
int
system_cpu_n_frequency_get(int n);
int
system_cpu_n_temperature_get(int n);
int
system_cpu_temperature_min_max_get(int *min, int *max);
int
system_cpu_frequency_min_max_get(int *min, int *max);
void
system_cpu_topology_get(int *ids, int ncpus);
void
system_memory_usage_get(meminfo_t *memory);
2021-05-16 04:12:19 -07:00
#endif