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