+};
+
+struct gfio_client {
+ struct gui_entry *ge;
+ struct fio_client *client;
+ GtkWidget *results_widget;
+ GtkWidget *disk_util_frame;
+ GtkWidget *err_entry;
+ unsigned int job_added;
+ struct thread_options o;
+};
+
+static void gfio_update_thread_status(struct gui_entry *ge, char *status_message, double perc);
+static void gfio_update_thread_status_all(char *status_message, double perc);
+void report_error(GError *error);
+
+static void iops_graph_y_axis_unit_change(struct graph *g, int power_of_ten)
+{
+ switch (power_of_ten) {
+ case 9: graph_y_title(g, "Billions of IOs / sec");
+ break;
+ case 6: graph_y_title(g, "Millions of IOs / sec");
+ break;
+ case 3: graph_y_title(g, "Thousands of IOs / sec");
+ break;
+ case 0:
+ default: graph_y_title(g, "IOs / sec");
+ break;
+ }
+}
+
+static struct graph *setup_iops_graph(void)
+{
+ struct graph *g;
+
+ g = graph_new(DRAWING_AREA_XDIM / 2.0, DRAWING_AREA_YDIM, gfio_graph_font);
+ graph_title(g, "IOPS");
+ graph_x_title(g, "Time (secs)");
+ graph_y_title(g, "IOs / sec");
+ graph_add_label(g, "Read IOPS");
+ graph_add_label(g, "Write IOPS");
+ graph_set_color(g, "Read IOPS", 0.13, 0.54, 0.13);
+ graph_set_color(g, "Write IOPS", 1.0, 0.0, 0.0);
+ line_graph_set_data_count_limit(g, gfio_graph_limit);
+ graph_y_axis_unit_change_notify(g, iops_graph_y_axis_unit_change);
+ graph_add_extra_space(g, 0.005, 0.005, 0.03, 0.03);
+ return g;
+}
+
+static void bandwidth_graph_y_axis_unit_change(struct graph *g, int power_of_ten)
+{
+ switch (power_of_ten) {
+ case 9: graph_y_title(g, "Petabytes / sec");
+ break;
+ case 6: graph_y_title(g, "Gigabytes / sec");
+ break;
+ case 3: graph_y_title(g, "Megabytes / sec");
+ break;
+ case 0:
+ default: graph_y_title(g, "Kilobytes / sec");
+ break;
+ }
+}
+
+static struct graph *setup_bandwidth_graph(void)
+{
+ struct graph *g;
+
+ g = graph_new(DRAWING_AREA_XDIM / 2.0, DRAWING_AREA_YDIM, gfio_graph_font);
+ graph_title(g, "Bandwidth");
+ graph_x_title(g, "Time (secs)");
+ graph_y_title(g, "Kbytes / sec");
+ graph_add_label(g, "Read Bandwidth");
+ graph_add_label(g, "Write Bandwidth");
+ graph_set_color(g, "Read Bandwidth", 0.13, 0.54, 0.13);
+ graph_set_color(g, "Write Bandwidth", 1.0, 0.0, 0.0);
+ line_graph_set_data_count_limit(g, 100);
+ graph_y_axis_unit_change_notify(g, bandwidth_graph_y_axis_unit_change);
+ graph_add_extra_space(g, 0.005, 0.005, 0.03, 0.03);
+
+ return g;
+}
+
+static void setup_graphs(struct gfio_graphs *g)
+{
+ g->iops_graph = setup_iops_graph();
+ g->bandwidth_graph = setup_bandwidth_graph();
+}
+
+static void multitext_add_entry(struct multitext_widget *mt, const char *text)
+{
+ mt->text = realloc(mt->text, (mt->max_text + 1) * sizeof(char *));
+ mt->text[mt->max_text] = strdup(text);
+ mt->max_text++;
+}
+
+static void multitext_set_entry(struct multitext_widget *mt, unsigned int index)
+{
+ if (index >= mt->max_text)
+ return;
+ if (!mt->text || !mt->text[index])
+ return;
+
+ mt->cur_text = index;
+ gtk_entry_set_text(GTK_ENTRY(mt->entry), mt->text[index]);
+}
+
+static void multitext_update_entry(struct multitext_widget *mt,
+ unsigned int index, const char *text)
+{
+ if (!mt->text)
+ return;
+
+ if (mt->text[index])
+ free(mt->text[index]);
+
+ mt->text[index] = strdup(text);
+ if (mt->cur_text == index)
+ gtk_entry_set_text(GTK_ENTRY(mt->entry), mt->text[index]);
+}
+
+static void multitext_free(struct multitext_widget *mt)
+{
+ int i;
+
+ gtk_entry_set_text(GTK_ENTRY(mt->entry), "");
+
+ for (i = 0; i < mt->max_text; i++) {
+ if (mt->text[i])
+ free(mt->text[i]);
+ }
+
+ free(mt->text);
+ mt->cur_text = -1;
+ mt->max_text = 0;
+}
+
+static void clear_ge_ui_info(struct gui_entry *ge)
+{
+ gtk_label_set_text(GTK_LABEL(ge->probe.hostname), "");
+ gtk_label_set_text(GTK_LABEL(ge->probe.os), "");
+ gtk_label_set_text(GTK_LABEL(ge->probe.arch), "");
+ gtk_label_set_text(GTK_LABEL(ge->probe.fio_ver), "");
+#if 0
+ /* should we empty it... */
+ gtk_entry_set_text(GTK_ENTRY(ge->eta.name), "");
+#endif
+ multitext_update_entry(&ge->eta.iotype, 0, "");
+ multitext_update_entry(&ge->eta.ioengine, 0, "");
+ multitext_update_entry(&ge->eta.iodepth, 0, "");
+ gtk_entry_set_text(GTK_ENTRY(ge->eta.jobs), "");
+ gtk_entry_set_text(GTK_ENTRY(ge->eta.files), "");
+ gtk_entry_set_text(GTK_ENTRY(ge->eta.read_bw), "");
+ gtk_entry_set_text(GTK_ENTRY(ge->eta.read_iops), "");
+ gtk_entry_set_text(GTK_ENTRY(ge->eta.write_bw), "");
+ gtk_entry_set_text(GTK_ENTRY(ge->eta.write_iops), "");
+}
+
+static GtkWidget *new_combo_entry_in_frame(GtkWidget *box, const char *label)
+{
+ GtkWidget *entry, *frame;
+
+ frame = gtk_frame_new(label);
+ entry = gtk_combo_box_new_text();
+ gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 3);
+ gtk_container_add(GTK_CONTAINER(frame), entry);
+
+ return entry;