client: use eta msec as the poll interval
[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 #include "graph.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         graph_label_t read_iops;
42         graph_label_t write_iops;
43         struct graph *bandwidth_graph;
44         graph_label_t read_bw;
45         graph_label_t write_bw;
46 };
47
48 /*
49  * Main window widgets and data
50  */
51 struct gui {
52         GtkUIManager *uimanager;
53         GtkRecentManager *recentmanager;
54         GtkActionGroup *actiongroup;
55         guint recent_ui_id;
56         GtkWidget *menu;
57         GtkWidget *window;
58         GtkWidget *vbox;
59         GtkWidget *thread_status_pb;
60         GtkWidget *buttonbox;
61         GtkWidget *notebook;
62         GtkWidget *error_info_bar;
63         GtkWidget *error_label;
64         GtkListStore *log_model;
65         GtkWidget *log_tree;
66         GtkWidget *log_view;
67         struct gfio_graphs graphs;
68         struct probe_widget probe;
69         struct eta_widget eta;
70         pthread_t server_t;
71
72         pthread_t t;
73         int handler_running;
74
75         GHashTable *ge_hash;
76 } main_ui;
77
78 enum {
79         GE_STATE_NEW = 1,
80         GE_STATE_CONNECTED,
81         GE_STATE_JOB_SENT,
82         GE_STATE_JOB_STARTED,
83         GE_STATE_JOB_RUNNING,
84         GE_STATE_JOB_DONE,
85 };
86
87 enum {
88         GFIO_BUTTON_CONNECT = 0,
89         GFIO_BUTTON_SEND,
90         GFIO_BUTTON_START,
91         GFIO_BUTTON_NR,
92 };
93
94 /*
95  * Notebook entry
96  */
97 struct gui_entry {
98         struct gui *ui;
99
100         GtkWidget *vbox;
101         GtkWidget *job_notebook;
102         GtkWidget *thread_status_pb;
103         GtkWidget *buttonbox;
104         GtkWidget *button[GFIO_BUTTON_NR];
105         GtkWidget *notebook;
106         GtkWidget *error_info_bar;
107         GtkWidget *error_label;
108         GtkWidget *results_window;
109         GtkWidget *results_notebook;
110         GtkUIManager *results_uimanager;
111         GtkWidget *results_menu;
112         GtkWidget *disk_util_vbox;
113         GtkListStore *log_model;
114         GtkWidget *log_tree;
115         GtkWidget *log_view;
116         struct gfio_graphs graphs;
117         struct probe_widget probe;
118         struct eta_widget eta;
119         GtkWidget *page_label;
120         gint page_num;
121         unsigned int state;
122
123         struct graph *clat_graph;
124         struct graph *lat_bucket_graph;
125
126         struct gfio_client *client;
127         char *job_file;
128         char *host;
129         int port;
130         int type;
131         int server_start;
132 };
133
134 struct end_results {
135         struct group_run_stats gs;
136         struct thread_stat ts;
137 };
138
139 struct gfio_client {
140         struct gui_entry *ge;
141         struct fio_client *client;
142         GtkWidget *err_entry;
143         struct thread_options o;
144
145         struct end_results *results;
146         unsigned int nr_results;
147
148         struct cmd_du_pdu *du;
149         unsigned int nr_du;
150 };
151
152 #define GFIO_MIME       "text/fio"
153
154 extern void gfio_view_log(struct gui *ui);
155 extern void gfio_set_state(struct gui_entry *ge, unsigned int state);
156 extern void clear_ge_ui_info(struct gui_entry *ge);
157
158 extern const char *gfio_graph_font;
159 extern GdkColor gfio_color_white;
160
161 #endif