-struct eta_widget {
- GtkWidget *name;
- GtkWidget *iotype;
- GtkWidget *ioengine;
- GtkWidget *iodepth;
- GtkWidget *jobs;
- GtkWidget *files;
- GtkWidget *read_bw;
- GtkWidget *read_iops;
- GtkWidget *cr_bw;
- GtkWidget *cr_iops;
- GtkWidget *write_bw;
- GtkWidget *write_iops;
- GtkWidget *cw_bw;
- GtkWidget *cw_iops;
-};
-
-struct gui {
- GtkWidget *window;
- GtkWidget *vbox;
- GtkWidget *topvbox;
- GtkWidget *topalign;
- GtkWidget *bottomalign;
- GtkWidget *thread_status_pb;
- GtkWidget *buttonbox;
- GtkWidget *button[ARRAYSIZE(buttonspeclist)];
- GtkWidget *scrolled_window;
-#define DRAWING_AREA_XDIM 1000
-#define DRAWING_AREA_YDIM 400
- GtkWidget *drawing_area;
- int drawing_area_xdim;
- int drawing_area_ydim;
- GtkWidget *error_info_bar;
- GtkWidget *error_label;
- GtkWidget *results_notebook;
- GtkWidget *results_window;
- GtkListStore *log_model;
- GtkWidget *log_tree;
- GtkWidget *log_view;
- GtkTextBuffer *text;
- struct probe_widget probe;
- struct eta_widget eta;
- int connected;
- pthread_t t;
- pthread_t server_t;
-
- struct graph *iops_graph;
- struct graph *bandwidth_graph;
- struct gfio_client *client;
- int nr_job_files;
- char **job_files;
-} ui;
-
-struct gfio_client {
- struct gui *ui;
- struct fio_client *client;
- GtkWidget *results_widget;
- GtkWidget *disk_util_frame;
- GtkWidget *err_entry;
- unsigned int job_added;
- struct thread_options o;
-};
-
-static void setup_iops_graph(struct gui *ui)
-{
- if (ui->iops_graph)
- graph_free(ui->iops_graph);
- ui->iops_graph = graph_new(DRAWING_AREA_XDIM / 2.0,
- DRAWING_AREA_YDIM, gfio_graph_font);
- graph_title(ui->iops_graph, "IOPS");
- graph_x_title(ui->iops_graph, "Time (secs)");
- graph_y_title(ui->iops_graph, "IOs / sec");
- graph_add_label(ui->iops_graph, "Read IOPS");
- graph_add_label(ui->iops_graph, "Write IOPS");
- graph_set_color(ui->iops_graph, "Read IOPS", 0.13, 0.54, 0.13);
- graph_set_color(ui->iops_graph, "Write IOPS", 1.0, 0.0, 0.0);
- line_graph_set_data_count_limit(ui->iops_graph, 100);
-}
-
-static void setup_bandwidth_graph(struct gui *ui)
-{
- if (ui->bandwidth_graph)
- graph_free(ui->bandwidth_graph);
- ui->bandwidth_graph = graph_new(DRAWING_AREA_XDIM / 2.0,
- DRAWING_AREA_YDIM, gfio_graph_font);
- graph_title(ui->bandwidth_graph, "Bandwidth");
- graph_x_title(ui->bandwidth_graph, "Time (secs)");
- graph_y_title(ui->bandwidth_graph, "Kbytes / sec");
- graph_add_label(ui->bandwidth_graph, "Read Bandwidth");
- graph_add_label(ui->bandwidth_graph, "Write Bandwidth");
- graph_set_color(ui->bandwidth_graph, "Read Bandwidth", 0.13, 0.54, 0.13);
- graph_set_color(ui->bandwidth_graph, "Write Bandwidth", 1.0, 0.0, 0.0);
- line_graph_set_data_count_limit(ui->bandwidth_graph, 100);
-}
-
-static void clear_ui_info(struct gui *ui)
-{
- gtk_label_set_text(GTK_LABEL(ui->probe.hostname), "");
- gtk_label_set_text(GTK_LABEL(ui->probe.os), "");
- gtk_label_set_text(GTK_LABEL(ui->probe.arch), "");
- gtk_label_set_text(GTK_LABEL(ui->probe.fio_ver), "");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.name), "");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.iotype), "");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.ioengine), "");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.iodepth), "");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.jobs), "");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.files), "");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.read_bw), "");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.read_iops), "");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.write_bw), "");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.write_iops), "");
-}
-
-static GtkWidget *new_info_entry_in_frame(GtkWidget *box, const char *label)
-{
- GtkWidget *entry, *frame;
-
- frame = gtk_frame_new(label);
- entry = gtk_entry_new();
- gtk_entry_set_editable(GTK_ENTRY(entry), 0);
- gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 3);
- gtk_container_add(GTK_CONTAINER(frame), entry);
-
- return entry;
-}
-
-static GtkWidget *new_info_label_in_frame(GtkWidget *box, const char *label)
-{
- GtkWidget *label_widget;
- GtkWidget *frame;
-
- frame = gtk_frame_new(label);
- label_widget = gtk_label_new(NULL);
- gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 3);
- gtk_container_add(GTK_CONTAINER(frame), label_widget);
-
- return label_widget;
-}
-
-static GtkWidget *create_spinbutton(GtkWidget *hbox, double min, double max, double defval)
-{
- GtkWidget *button, *box;
-
- box = gtk_hbox_new(FALSE, 3);
- gtk_container_add(GTK_CONTAINER(hbox), box);
-
- button = gtk_spin_button_new_with_range(min, max, 1.0);
- gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
-
- gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(button), GTK_UPDATE_IF_VALID);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(button), defval);
-
- return button;
-}
-
-static void gfio_set_connected(struct gui *ui, int connected)
-{
- if (connected) {
- gtk_widget_set_sensitive(ui->button[SEND_BUTTON], 1);
- ui->connected = 1;
- gtk_button_set_label(GTK_BUTTON(ui->button[CONNECT_BUTTON]), "Disconnect");
- gtk_widget_set_sensitive(ui->button[CONNECT_BUTTON], 1);
- } else {
- ui->connected = 0;
- gtk_button_set_label(GTK_BUTTON(ui->button[CONNECT_BUTTON]), "Connect");
- gtk_widget_set_sensitive(ui->button[SEND_BUTTON], 0);
- gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 0);
- gtk_widget_set_sensitive(ui->button[CONNECT_BUTTON], 1);
- }
-}
-
-static void label_set_int_value(GtkWidget *entry, unsigned int val)
-{
- char tmp[80];
-
- sprintf(tmp, "%u", val);
- gtk_label_set_text(GTK_LABEL(entry), tmp);
-}
-
-static void entry_set_int_value(GtkWidget *entry, unsigned int val)
-{
- char tmp[80];
-
- sprintf(tmp, "%u", val);
- gtk_entry_set_text(GTK_ENTRY(entry), tmp);
-}
-
-#define ALIGN_LEFT 1
-#define ALIGN_RIGHT 2
-#define INVISIBLE 4
-#define UNSORTABLE 8
-
-GtkTreeViewColumn *tree_view_column(GtkWidget *tree_view, int index, const char *title, unsigned int flags)
-{
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *col;
- double xalign = 0.0; /* left as default */
- PangoAlignment align;
- gboolean visible;
-
- align = (flags & ALIGN_LEFT) ? PANGO_ALIGN_LEFT :
- (flags & ALIGN_RIGHT) ? PANGO_ALIGN_RIGHT :
- PANGO_ALIGN_CENTER;
- visible = !(flags & INVISIBLE);
-
- renderer = gtk_cell_renderer_text_new();
- col = gtk_tree_view_column_new();
-
- gtk_tree_view_column_set_title(col, title);
- if (!(flags & UNSORTABLE))
- gtk_tree_view_column_set_sort_column_id(col, index);
- gtk_tree_view_column_set_resizable(col, TRUE);
- gtk_tree_view_column_pack_start(col, renderer, TRUE);
- gtk_tree_view_column_add_attribute(col, renderer, "text", index);
- gtk_object_set(GTK_OBJECT(renderer), "alignment", align, NULL);
- switch (align) {
- case PANGO_ALIGN_LEFT:
- xalign = 0.0;
- break;
- case PANGO_ALIGN_CENTER:
- xalign = 0.5;
- break;
- case PANGO_ALIGN_RIGHT:
- xalign = 1.0;
- break;
- }
- gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), xalign, 0.5);
- gtk_tree_view_column_set_visible(col, visible);
- gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), col);
- return col;
-}
-
-static void gfio_ui_setup_log(struct gui *ui)
-{
- GtkTreeSelection *selection;
- GtkListStore *model;
- GtkWidget *tree_view;
-
- model = gtk_list_store_new(4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
-
- tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
- gtk_widget_set_can_focus(tree_view, FALSE);
-
- selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
- gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_BROWSE);
- g_object_set(G_OBJECT(tree_view), "headers-visible", TRUE,
- "enable-grid-lines", GTK_TREE_VIEW_GRID_LINES_BOTH, NULL);
-
- tree_view_column(tree_view, 0, "Time", ALIGN_RIGHT | UNSORTABLE);
- tree_view_column(tree_view, 1, "Host", ALIGN_RIGHT | UNSORTABLE);
- tree_view_column(tree_view, 2, "Level", ALIGN_RIGHT | UNSORTABLE);
- tree_view_column(tree_view, 3, "Text", ALIGN_LEFT | UNSORTABLE);
-
- ui->log_model = model;
- ui->log_tree = tree_view;
-}
-
-static GtkWidget *gfio_output_clat_percentiles(unsigned int *ovals,
- fio_fp64_t *plist,
- unsigned int len,
- const char *base,
- unsigned int scale)