[refactor] repositioned the structs from the header file to the library file
This commit is contained in:
parent
9d78ae637e
commit
0029210718
@ -8,5 +8,4 @@ ADD_EXECUTABLE(main
|
|||||||
source/lib.c
|
source/lib.c
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_EXECUTABLE(source/main.c source/lib.c)
|
|
||||||
TARGET_INCLUDE_DIRECTORIES(main PRIVATE source/lib/osx source/lib/linux)
|
TARGET_INCLUDE_DIRECTORIES(main PRIVATE source/lib/osx source/lib/linux)
|
||||||
|
|||||||
31
source/lib.c
31
source/lib.c
@ -24,7 +24,7 @@ typedef struct {
|
|||||||
|
|
||||||
unsigned long mem_size;
|
unsigned long mem_size;
|
||||||
|
|
||||||
} ram;
|
} ram_s;
|
||||||
|
|
||||||
unsigned long get_total(void);
|
unsigned long get_total(void);
|
||||||
unsigned long get_usage(void);
|
unsigned long get_usage(void);
|
||||||
@ -39,6 +39,7 @@ void cpu_temperature(unsigned short delay);
|
|||||||
char* cpu_frequency(void);
|
char* cpu_frequency(void);
|
||||||
|
|
||||||
cpu_s _cpu;
|
cpu_s _cpu;
|
||||||
|
ram_s _ram;
|
||||||
|
|
||||||
void *cpu_name(){
|
void *cpu_name(){
|
||||||
int buffer_size = 256;
|
int buffer_size = 256;
|
||||||
@ -253,6 +254,7 @@ long device_up_time(void){
|
|||||||
return info.uptime;
|
return info.uptime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -263,12 +265,36 @@ long device_up_time(void){
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <math.h>
|
|
||||||
#include <cjson/cJSON.h>
|
#include <cjson/cJSON.h>
|
||||||
|
|
||||||
#define CONVERT_BYTES_TO_GIGABYTES 107374182
|
#define CONVERT_BYTES_TO_GIGABYTES 107374182
|
||||||
#define D 1073741824
|
#define D 1073741824
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
char* name;
|
||||||
|
} device_s;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
|
||||||
|
int frequency;
|
||||||
|
char* name;
|
||||||
|
int threads;
|
||||||
|
|
||||||
|
} cpu_s;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
long double total;
|
||||||
|
long double available;
|
||||||
|
} ram_s;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
long long size;
|
||||||
|
short name;
|
||||||
|
} disk_s;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
cpu_s* cpu;
|
cpu_s* cpu;
|
||||||
@ -288,7 +314,6 @@ unsigned long get_total(void);
|
|||||||
unsigned long get_usage(void);
|
unsigned long get_usage(void);
|
||||||
long device_up_time(void);
|
long device_up_time(void);
|
||||||
float cpu_frequency(void);
|
float cpu_frequency(void);
|
||||||
char* cpu_name(void);
|
|
||||||
void size();
|
void size();
|
||||||
void av_size();
|
void av_size();
|
||||||
void* ram_i();
|
void* ram_i();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <cjson/cJSON.h>
|
#include <cjson/cJSON.h>
|
||||||
#include <lib.h>
|
#include "lib.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user