-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.h
56 lines (47 loc) · 1.01 KB
/
logger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef LOGGER_H_INCLUDED
#define LOGGER_H_INCLUDED
#include <stdio.h>
#include "disk.h"
#include "interface.h"
#include "battery.h"
struct system_t;
enum logger_type
{
CSV
};
struct logger_stat_t
{
enum {
LOGGER_CPU_FREQUENCY,
LOGGER_CPU_USAGE,
LOGGER_CPU_TEMPERATURE,
LOGGER_RAM_USED,
LOGGER_RAM_BUFFERS,
LOGGER_RAM_CACHED,
LOGGER_DISK_READ,
LOGGER_DISK_WRITE,
LOGGER_IFACE_READ,
LOGGER_IFACE_WRITE,
LOGGER_BAT_CHARGE,
LOGGER_BAT_CURRENT,
LOGGER_BAT_VOLTAGE
} type;
union logger_stat_data {
int cpu_id;
char iface_name[MAX_INTERFACE_NAME_LENGTH + 1];
char disk_name[MAX_DISK_NAME_LENGTH + 1];
char battery_name[MAX_BATTERY_NAME_LENGTH + 1];
} data;
};
struct logger_t
{
int type;
FILE *file;
int stat_count;
struct logger_stat_t *stats;
};
int logger_init(struct logger_t *logger, int type,
const char *filename, int stat_count, struct logger_stat_t *stats);
void logger_destroy(struct logger_t *logger);
void logger_log(struct logger_t *logger, struct system_t *system);
#endif