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