-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.h
63 lines (50 loc) · 1.15 KB
/
stats.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
#pragma once
#include "main.h"
#include <stdbool.h> // for bool
#include <time.h> // for timespec
#define STAT_OUTPUT_LENGTH 128
#define CPU_AMBER 20.f
#define CPU_RED 80.f
#define MEMORY_AMBER 60.f
#define MEMORY_RED 80.f
#define DISK_AMBER 20.f
#define DISK_RED 80.f
#define NET_AMBER 1000.f
#define NET_RED 10000.f
typedef enum
{
STAT_COLOUR_GREY,
STAT_COLOUR_AMBER,
STAT_COLOUR_RED,
} statColour_t;
struct procStat
{
unsigned long long tUser;
unsigned long long tNice;
unsigned long long tSystem;
unsigned long long tIdle;
unsigned long long tIoWait;
unsigned long long tIrq;
unsigned long long tSoftIrq;
unsigned long long tSteal;
unsigned long long tGuest;
unsigned long long tGuestNice;
};
struct netDevReading
{
struct timespec time;
unsigned long long bytesDown;
unsigned long long bytesUp;
};
struct diskReading
{
struct timespec time;
unsigned long tBusy;
};
struct cpuStat
{
unsigned long long tBusy;
unsigned long long tIdle;
};
void printStats(bool newLine, bool redraw, window_t* window, options_t* options);
void advanceSpinner(window_t* window, options_t* options);