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