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