This repository has been archived by the owner on Oct 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
/
system.h
109 lines (94 loc) · 2.87 KB
/
system.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
* Copyright 2010 William Tisäter. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The name of the copyright holder may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL WILLIAM TISÄTER BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _SYSTEM_H
#define _SYSTEM_H
#include <time.h>
#include <stdio.h>
#define SENSOR_FAN 0
#define SENSOR_TEMP 1
struct cpu_data
{
float one, two, three;
unsigned long long u, n, s, i;
};
struct mem_data
{
unsigned long long t, f, a, i, c, swu, swt, swi, swo;
};
struct net_data
{
int upt;
time_t uxt;
unsigned long long s, r;
};
struct disk_data
{
float p;
time_t uxt;
unsigned long long t, u, f;
};
struct sys_info
{
int upt;
time_t uxt;
struct mem_data mem;
struct cpu_data cpu;
};
struct sensor_data
{
int kind;
double data;
time_t uxt;
char label[50];
unsigned int id;
unsigned int chip;
unsigned int sensor;
};
# ifdef __cplusplus
extern "C" {
# endif
int kstat_init(void);
int get_uptime(void);
int get_unixtime(void);
int get_cpu_data(struct cpu_data *_cpu);
int get_avg_data(struct cpu_data *_cpu);
int get_mem_data(struct mem_data *_mem);
int get_swp_data(struct mem_data *_mem);
int get_net_data(const char *_dev, struct net_data *_data);
int get_disk_data(const char *_dev, struct disk_data *_disk);
int get_disk_info(char * _device, char * _uuid, char * _label, char * _name);
unsigned int get_sensor_num(void);
unsigned int get_sensor_data(unsigned int _id, struct sensor_data *_data);
unsigned int get_qnaptemp(unsigned int _id, struct sensor_data *_data);
unsigned int have_qnaptemp(void);
# ifdef __cplusplus
};
#endif
#endif