| 1 |
#ifndef _GSM_LOAD_GRAPH_H_ |
| 2 |
#define _GSM_LOAD_GRAPH_H_ |
| 3 |
|
| 4 |
#include <glib.h> |
| 5 |
#include <glibtop/cpu.h> |
| 6 |
|
| 7 |
#include "gsm-graph.h" |
| 8 |
#include "legacy/gsm_color_button.h" |
| 9 |
#include "util.h" |
| 10 |
#include "settings-keys.h" |
| 11 |
|
| 12 |
enum |
| 13 |
{ |
| 14 |
LOAD_GRAPH_CPU, |
| 15 |
LOAD_GRAPH_MEM, |
| 16 |
LOAD_GRAPH_NET, |
| 17 |
LOAD_GRAPH_DISK |
| 18 |
}; |
| 19 |
|
| 20 |
enum |
| 21 |
{ |
| 22 |
CPU_TOTAL, |
| 23 |
CPU_USED, |
| 24 |
N_CPU_STATES |
| 25 |
}; |
| 26 |
|
| 27 |
struct LoadGraphLabels |
| 28 |
{ |
| 29 |
GtkLabel *cpu[GLIBTOP_NCPU]; |
| 30 |
GtkLabel *memory; |
| 31 |
GtkLabel *swap; |
| 32 |
GtkLabel *net_in; |
| 33 |
GtkLabel *net_in_total; |
| 34 |
GtkLabel *net_out; |
| 35 |
GtkLabel *net_out_total; |
| 36 |
GtkLabel *disk_read; |
| 37 |
GtkLabel *disk_read_total; |
| 38 |
GtkLabel *disk_write; |
| 39 |
GtkLabel *disk_write_total; |
| 40 |
}; |
| 41 |
|
| 42 |
struct LoadGraph |
| 43 |
: private procman::NonCopyable |
| 44 |
{ |
| 45 |
LoadGraph (guint type); |
| 46 |
~LoadGraph(); |
| 47 |
|
| 48 |
unsigned get_num_bars (int height) const; |
| 49 |
void clear_background (); |
| 50 |
bool is_logarithmic_scale () const; |
| 51 |
char * get_caption (guint index); |
| 52 |
float translate_to_log_partial_if_needed (float position_partial); |
| 53 |
|
| 54 |
double indent; |
| 55 |
|
| 56 |
guint n; |
| 57 |
gint type; |
| 58 |
guint speed; |
| 59 |
guint num_points; |
| 60 |
guint latest; |
| 61 |
gulong iteration; |
| 62 |
guint graph_dely; |
| 63 |
guint num_bars; |
| 64 |
guint real_draw_height; |
| 65 |
|
| 66 |
std::vector<GdkRGBA> colors; |
| 67 |
|
| 68 |
std::vector<double> data_block; |
| 69 |
std::vector<double*> data; |
| 70 |
|
| 71 |
GtkBox *main_widget; |
| 72 |
GsmGraph *disp; |
| 73 |
|
| 74 |
LoadGraphLabels labels; |
| 75 |
GsmColorButton *mem_color_picker; |
| 76 |
GsmColorButton *swap_color_picker; |
| 77 |
|
| 78 |
Glib::RefPtr<Gio::Settings> font_settings; |
| 79 |
|
| 80 |
|
| 81 |
struct CPU |
| 82 |
{ |
| 83 |
guint now; |
| 84 |
|
| 85 |
|
| 86 |
guint64 times[2][GLIBTOP_NCPU][N_CPU_STATES]; |
| 87 |
} cpu; |
| 88 |
|
| 89 |
struct NET |
| 90 |
{ |
| 91 |
guint64 last_in, last_out; |
| 92 |
guint64 last_hash; |
| 93 |
guint64 time; |
| 94 |
guint64 max; |
| 95 |
std::vector<unsigned> values; |
| 96 |
} net; |
| 97 |
|
| 98 |
struct DISK |
| 99 |
{ |
| 100 |
guint64 last_read, last_write; |
| 101 |
guint64 time; |
| 102 |
guint64 max; |
| 103 |
std::vector<unsigned> values; |
| 104 |
} disk; |
| 105 |
|
| 106 |
}; |
| 107 |
|
| 108 |
|
| 109 |
void |
| 110 |
load_graph_queue_draw (LoadGraph *g); |
| 111 |
|
| 112 |
|
| 113 |
void |
| 114 |
load_graph_start (LoadGraph *g); |
| 115 |
|
| 116 |
|
| 117 |
void |
| 118 |
load_graph_stop (LoadGraph *g); |
| 119 |
|
| 120 |
int |
| 121 |
load_graph_update_data (LoadGraph *g); |
| 122 |
|
| 123 |
|
| 124 |
void |
| 125 |
load_graph_change_speed (LoadGraph *g, |
| 126 |
guint new_speed); |
| 127 |
|
| 128 |
|
| 129 |
void |
| 130 |
load_graph_change_num_points (LoadGraph *g, |
| 131 |
guint new_num_points); |
| 132 |
|
| 133 |
|
| 134 |
void |
| 135 |
load_graph_reset (LoadGraph *g); |
| 136 |
|
| 137 |
LoadGraphLabels* |
| 138 |
load_graph_get_labels (LoadGraph *g) G_GNUC_CONST; |
| 139 |
|
| 140 |
GtkBox* |
| 141 |
load_graph_get_widget (LoadGraph *g) G_GNUC_CONST; |
| 142 |
|
| 143 |
GsmColorButton* |
| 144 |
load_graph_get_mem_color_picker (LoadGraph *g) G_GNUC_CONST; |
| 145 |
|
| 146 |
GsmColorButton* |
| 147 |
load_graph_get_swap_color_picker (LoadGraph *g) G_GNUC_CONST; |
| 148 |
|
| 149 |
#endif |