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-17 04:21:07 -07:00
|
|
|
#include <Ecore.h>
|
|
|
|
#include <Ecore_File.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;
|
2021-05-17 00:58:23 -07:00
|
|
|
int id;
|
2021-05-17 07:55:50 -07:00
|
|
|
int top_id;
|
2021-05-17 00:58:23 -07:00
|
|
|
} Cpu_Core;
|
2021-05-16 04:25:14 -07:00
|
|
|
|
|
|
|
#define MEM_VIDEO_CARD_MAX 8
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint64_t total;
|
|
|
|
uint64_t used;
|
2021-05-17 03:00:29 -07:00
|
|
|
} Meminfo_Video;
|
2021-05-16 04:25:14 -07:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2021-05-17 03:00:29 -07:00
|
|
|
uint64_t total;
|
|
|
|
uint64_t used;
|
|
|
|
uint64_t cached;
|
|
|
|
uint64_t buffered;
|
|
|
|
uint64_t shared;
|
|
|
|
uint64_t swap_total;
|
|
|
|
uint64_t swap_used;
|
2021-05-16 04:25:14 -07:00
|
|
|
|
2021-05-17 03:00:29 -07:00
|
|
|
uint64_t zfs_arc_used;
|
2021-05-16 04:25:14 -07:00
|
|
|
|
|
|
|
uint64_t video_count;
|
2021-05-17 04:21:07 -07:00
|
|
|
Meminfo_Video video[MEM_VIDEO_CARD_MAX];
|
2021-05-17 03:00:29 -07:00
|
|
|
} Meminfo;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
THERMAL = 0,
|
|
|
|
FANRPM = 1,
|
|
|
|
} Sensor_Type;
|
2021-05-16 04:25:14 -07:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2021-05-17 03:00:29 -07:00
|
|
|
char *name;
|
|
|
|
char *child_name;
|
2021-05-16 04:25:14 -07:00
|
|
|
#if defined(__linux__)
|
2021-05-17 03:00:29 -07:00
|
|
|
char *path;
|
2021-05-16 04:25:14 -07:00
|
|
|
#elif defined(__OpenBSD__)
|
2021-05-17 03:00:29 -07:00
|
|
|
int mibs[5];
|
2021-05-16 04:25:14 -07:00
|
|
|
#endif
|
2021-05-17 03:00:29 -07:00
|
|
|
double value;
|
|
|
|
bool invalid;
|
|
|
|
int id;
|
|
|
|
Sensor_Type type;
|
2021-05-17 00:58:23 -07:00
|
|
|
} 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];
|
2021-05-17 04:04:03 -07:00
|
|
|
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
|
|
|
char unit;
|
2021-05-16 04:25:14 -07:00
|
|
|
#endif
|
2021-05-16 09:39:04 -07:00
|
|
|
} Battery;
|
2021-05-16 04:25:14 -07:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2021-05-17 00:58:23 -07:00
|
|
|
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
|
2021-05-17 03:00:29 -07:00
|
|
|
power_ac_check(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);
|
|
|
|
|
2021-05-17 00:58:23 -07:00
|
|
|
Eina_List *
|
|
|
|
sensors_find(void);
|
2021-05-16 09:39:04 -07:00
|
|
|
|
2021-05-17 05:36:40 -07:00
|
|
|
void
|
|
|
|
memory_info(Meminfo *memory);
|
|
|
|
|
2021-05-17 00:58:23 -07:00
|
|
|
void
|
|
|
|
sensor_free(Sensor *sensor);
|
2021-05-16 09:39:04 -07:00
|
|
|
|
2021-05-17 00:58:23 -07:00
|
|
|
Eina_Bool
|
|
|
|
sensor_check(Sensor *sensor);
|
|
|
|
|
|
|
|
Eina_List *
|
|
|
|
network_interfaces_find(void);
|
2021-05-16 09:39:04 -07:00
|
|
|
|
2021-05-17 07:55:50 -07:00
|
|
|
Eina_List *
|
|
|
|
cores_find(void);
|
|
|
|
|
|
|
|
void
|
2021-05-17 08:19:44 -07:00
|
|
|
cores_update(Eina_List *cores);
|
2021-05-16 04:25:14 -07:00
|
|
|
|
|
|
|
int
|
2021-05-17 07:55:50 -07:00
|
|
|
cores_count(void);
|
2021-05-16 04:25:14 -07:00
|
|
|
|
|
|
|
int
|
2021-05-17 07:55:50 -07:00
|
|
|
cores_online_count(void);
|
|
|
|
|
|
|
|
void
|
|
|
|
cores_topology(Eina_List *cores);
|
2021-05-16 04:25:14 -07:00
|
|
|
|
|
|
|
int
|
2021-05-17 07:55:50 -07:00
|
|
|
cores_frequency(void);
|
2021-05-16 04:25:14 -07:00
|
|
|
|
|
|
|
int
|
2021-05-17 07:55:50 -07:00
|
|
|
core_id_frequency(int d);
|
2021-05-16 04:25:14 -07:00
|
|
|
|
|
|
|
int
|
2021-05-17 07:55:50 -07:00
|
|
|
core_id_temperature(int id);
|
|
|
|
|
|
|
|
int
|
|
|
|
cores_temperature_min_max(int *min, int *max);
|
|
|
|
|
|
|
|
int
|
|
|
|
cores_frequency_min_max(int *min, int *max);
|
2021-05-16 04:25:14 -07:00
|
|
|
|
2021-05-16 04:12:19 -07:00
|
|
|
#endif
|