graph: use 0 as the floor for the line graph
[fio.git] / gfio.h
1 #ifndef GFIO_H
2 #define GFIO_H
3
4 #include <gtk/gtk.h>
5
6 struct probe_widget {
7         GtkWidget *hostname;
8         GtkWidget *os;
9         GtkWidget *arch;
10         GtkWidget *fio_ver;
11 };
12
13 struct multitext_widget {
14         GtkWidget *entry;
15         char **text;
16         unsigned int cur_text;
17         unsigned int max_text;
18 };
19
20 struct eta_widget {
21         GtkWidget *names;
22         struct multitext_widget iotype;
23         struct multitext_widget bs;
24         struct multitext_widget ioengine;
25         struct multitext_widget iodepth;
26         GtkWidget *jobs;
27         GtkWidget *files;
28         GtkWidget *read_bw;
29         GtkWidget *read_iops;
30         GtkWidget *cr_bw;
31         GtkWidget *cr_iops;
32         GtkWidget *write_bw;
33         GtkWidget *write_iops;
34         GtkWidget *cw_bw;
35         GtkWidget *cw_iops;
36 };
37
38 struct gfio_graphs {
39 #define DRAWING_AREA_XDIM 1000
40 #define DRAWING_AREA_YDIM 400
41         GtkWidget *drawing_area;
42         struct graph *iops_graph;
43         struct graph *bandwidth_graph;
44 };
45
46 /*
47  * Main window widgets and data
48  */
49 struct gui {
50         GtkUIManager *uimanager;
51         GtkRecentManager *recentmanager;
52         GtkActionGroup *actiongroup;
53         guint recent_ui_id;
54         GtkWidget *menu;
55         GtkWidget *window;
56         GtkWidget *vbox;
57         GtkWidget *thread_status_pb;
58         GtkWidget *buttonbox;
59         GtkWidget *notebook;
60         GtkWidget *error_info_bar;
61         GtkWidget *error_label;
62         GtkListStore *log_model;
63         GtkWidget *log_tree;
64         GtkWidget *log_view;
65         struct gfio_graphs graphs;
66         struct probe_widget probe;
67         struct eta_widget eta;
68         pthread_t server_t;
69
70         pthread_t t;
71         int handler_running;
72
73         struct flist_head list;
74 } main_ui;
75
76 enum {
77         GE_STATE_NEW = 1,
78         GE_STATE_CONNECTED,
79         GE_STATE_JOB_SENT,
80         GE_STATE_JOB_STARTED,
81         GE_STATE_JOB_RUNNING,
82         GE_STATE_JOB_DONE,
83 };
84
85 enum {
86         GFIO_BUTTON_CONNECT = 0,
87         GFIO_BUTTON_SEND,
88         GFIO_BUTTON_START,
89         GFIO_BUTTON_NR,
90 };
91
92 /*
93  * Notebook entry
94  */
95 struct gui_entry {
96         struct flist_head list;
97         struct gui *ui;
98
99         GtkWidget *vbox;
100         GtkWidget *job_notebook;
101         GtkWidget *thread_status_pb;
102         GtkWidget *buttonbox;
103         GtkWidget *button[GFIO_BUTTON_NR];
104         GtkWidget *notebook;
105         GtkWidget *error_info_bar;
106         GtkWidget *error_label;
107         GtkWidget *results_window;
108         GtkWidget *results_notebook;
109         GtkUIManager *results_uimanager;
110         GtkWidget *results_menu;
111         GtkWidget *disk_util_vbox;
112         GtkListStore *log_model;
113         GtkWidget *log_tree;
114         GtkWidget *log_view;
115         struct gfio_graphs graphs;
116         struct probe_widget probe;
117         struct eta_widget eta;
118         GtkWidget *page_label;
119         gint page_num;
120         unsigned int state;
121
122         struct graph *clat_graph;
123         struct graph *lat_bucket_graph;
124
125         struct gfio_client *client;
126         int nr_job_files;
127         char **job_files;
128 };
129
130 struct end_results {
131         struct group_run_stats gs;
132         struct thread_stat ts;
133 };
134
135 struct gfio_client {
136         struct gui_entry *ge;
137         struct fio_client *client;
138         GtkWidget *err_entry;
139         struct thread_options o;
140
141         struct end_results *results;
142         unsigned int nr_results;
143
144         struct cmd_du_pdu *du;
145         unsigned int nr_du;
146 };
147
148 #define ARRAYSIZE(x) (sizeof((x)) / (sizeof((x)[0])))
149
150 #define GFIO_MIME       "text/fio"
151
152 #endif