- struct gui_entry *ge = (struct gui_entry *) data;
-
- gtk_widget_destroy(w);
- ge->results_window = NULL;
- ge->results_notebook = NULL;
- return TRUE;
-}
-
-static void results_close(GtkWidget *w, gpointer *data)
-{
- struct gui_entry *ge = (struct gui_entry *) data;
-
- gtk_widget_destroy(ge->results_window);
-}
-
-static GtkActionEntry results_menu_items[] = {
- { "FileMenuAction", GTK_STOCK_FILE, "File", NULL, NULL, NULL},
- { "GraphMenuAction", GTK_STOCK_FILE, "Graph", NULL, NULL, NULL},
- { "CloseFile", GTK_STOCK_CLOSE, "Close", "<Control>W", NULL, G_CALLBACK(results_close) },
-};
-static gint results_nmenu_items = sizeof(results_menu_items) / sizeof(results_menu_items[0]);
-
-static const gchar *results_ui_string = " \
- <ui> \
- <menubar name=\"MainMenu\"> \
- <menu name=\"FileMenu\" action=\"FileMenuAction\"> \
- <menuitem name=\"Close\" action=\"CloseFile\" /> \
- </menu> \
- <menu name=\"GraphMenu\" action=\"GraphMenuAction\"> \
- </menu>\
- </menubar> \
- </ui> \
-";
-
-static GtkWidget *get_results_menubar(GtkWidget *window, struct gui_entry *ge)
-{
- GtkActionGroup *action_group;
- GtkWidget *widget;
- GError *error = 0;
-
- ge->results_uimanager = gtk_ui_manager_new();
-
- action_group = gtk_action_group_new("ResultsMenu");
- gtk_action_group_add_actions(action_group, results_menu_items, results_nmenu_items, ge);
-
- gtk_ui_manager_insert_action_group(ge->results_uimanager, action_group, 0);
- gtk_ui_manager_add_ui_from_string(GTK_UI_MANAGER(ge->results_uimanager), results_ui_string, -1, &error);
-
- gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(ge->results_uimanager));
-
- widget = gtk_ui_manager_get_widget(ge->results_uimanager, "/MainMenu");
- return widget;
-}
-
-static GtkWidget *get_results_window(struct gui_entry *ge)
-{
- GtkWidget *win, *notebook, *vbox;
-
- if (ge->results_window)
- return ge->results_notebook;
-
- win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(win), "Results");
- gtk_window_set_default_size(GTK_WINDOW(win), 1024, 768);
- g_signal_connect(win, "delete-event", G_CALLBACK(results_window_delete), ge);
- g_signal_connect(win, "destroy", G_CALLBACK(results_window_delete), ge);
-
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(win), vbox);
-
- ge->results_menu = get_results_menubar(win, ge);
- gtk_box_pack_start(GTK_BOX(vbox), ge->results_menu, FALSE, FALSE, 0);
-
- notebook = gtk_notebook_new();
- gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), 1);
- gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook));
- gtk_container_add(GTK_CONTAINER(vbox), notebook);
-
- ge->results_window = win;
- ge->results_notebook = notebook;
- return ge->results_notebook;
-}
-
-static void disk_util_destroy(GtkWidget *w, gpointer data)
-{
- struct gui_entry *ge = (struct gui_entry *) data;
-
- ge->disk_util_vbox = NULL;
- gtk_widget_destroy(w);
-}
-
-static GtkWidget *get_scrolled_window(gint border_width)
-{
- GtkWidget *scroll;
-
- scroll = gtk_scrolled_window_new(NULL, NULL);
- gtk_container_set_border_width(GTK_CONTAINER(scroll), border_width);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- return scroll;
-}
-
-static GtkWidget *gfio_disk_util_get_vbox(struct gui_entry *ge)
-{
- GtkWidget *vbox, *box, *scroll, *res_notebook;
-
- if (ge->disk_util_vbox)
- return ge->disk_util_vbox;
-
- scroll = get_scrolled_window(5);
- vbox = gtk_vbox_new(FALSE, 3);
- box = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), box, FALSE, FALSE, 5);
-
- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), vbox);
- res_notebook = get_results_window(ge);
-
- gtk_notebook_append_page(GTK_NOTEBOOK(res_notebook), scroll, gtk_label_new("Disk utilization"));
- ge->disk_util_vbox = box;
- g_signal_connect(vbox, "destroy", G_CALLBACK(disk_util_destroy), ge);
-
- return ge->disk_util_vbox;
-}
-
-static int __gfio_disk_util_show(GtkWidget *res_notebook,
- struct gfio_client *gc, struct cmd_du_pdu *p)
-{
- GtkWidget *box, *frame, *entry, *vbox, *util_vbox;
- struct gui_entry *ge = gc->ge;
- double util;
- char tmp[16];
-
- util_vbox = gfio_disk_util_get_vbox(ge);
-
- vbox = gtk_vbox_new(FALSE, 3);
- gtk_container_add(GTK_CONTAINER(util_vbox), vbox);
-
- frame = gtk_frame_new((char *) p->dus.name);
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 2);
-
- box = gtk_vbox_new(FALSE, 3);
- gtk_container_add(GTK_CONTAINER(frame), box);
-
- frame = gtk_frame_new("Read");
- gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 2);
- vbox = gtk_hbox_new(TRUE, 3);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
- entry = new_info_entry_in_frame(vbox, "IOs");
- entry_set_int_value(entry, p->dus.ios[0]);
- entry = new_info_entry_in_frame(vbox, "Merges");
- entry_set_int_value(entry, p->dus.merges[0]);
- entry = new_info_entry_in_frame(vbox, "Sectors");
- entry_set_int_value(entry, p->dus.sectors[0]);
- entry = new_info_entry_in_frame(vbox, "Ticks");
- entry_set_int_value(entry, p->dus.ticks[0]);
-
- frame = gtk_frame_new("Write");
- gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 2);
- vbox = gtk_hbox_new(TRUE, 3);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
- entry = new_info_entry_in_frame(vbox, "IOs");
- entry_set_int_value(entry, p->dus.ios[1]);
- entry = new_info_entry_in_frame(vbox, "Merges");
- entry_set_int_value(entry, p->dus.merges[1]);
- entry = new_info_entry_in_frame(vbox, "Sectors");
- entry_set_int_value(entry, p->dus.sectors[1]);
- entry = new_info_entry_in_frame(vbox, "Ticks");
- entry_set_int_value(entry, p->dus.ticks[1]);
-
- frame = gtk_frame_new("Shared");
- gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 2);
- vbox = gtk_hbox_new(TRUE, 3);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
- entry = new_info_entry_in_frame(vbox, "IO ticks");
- entry_set_int_value(entry, p->dus.io_ticks);
- entry = new_info_entry_in_frame(vbox, "Time in queue");
- entry_set_int_value(entry, p->dus.time_in_queue);
-
- util = 0.0;
- if (p->dus.msec)
- util = (double) 100 * p->dus.io_ticks / (double) p->dus.msec;
- if (util > 100.0)
- util = 100.0;
-
- sprintf(tmp, "%3.2f%%", util);
- entry = new_info_entry_in_frame(vbox, "Disk utilization");
- gtk_entry_set_text(GTK_ENTRY(entry), tmp);
-
- gtk_widget_show_all(ge->results_window);
- return 0;
-}
-
-static int gfio_disk_util_show(struct gfio_client *gc)
-{
- struct gui_entry *ge = gc->ge;
- GtkWidget *res_notebook;
- int i;
-
- if (!gc->nr_du)
- return 1;
-
- res_notebook = get_results_window(ge);
-
- for (i = 0; i < gc->nr_du; i++) {
- struct cmd_du_pdu *p = &gc->du[i];
-
- __gfio_disk_util_show(res_notebook, gc, p);
- }
-
- gtk_widget_show_all(ge->results_window);
- return 0;
-}
-
-static void gfio_add_end_results(struct gfio_client *gc, struct thread_stat *ts,
- struct group_run_stats *rs)
-{
- unsigned int nr = gc->nr_results;
-
- gc->results = realloc(gc->results, (nr + 1) * sizeof(struct end_results));
- memcpy(&gc->results[nr].ts, ts, sizeof(*ts));
- memcpy(&gc->results[nr].gs, rs, sizeof(*rs));
- gc->nr_results++;
-}
-
-static void __gfio_display_end_results(GtkWidget *win, struct gfio_client *gc,
- struct thread_stat *ts,
- struct group_run_stats *rs)
-{
- GtkWidget *box, *vbox, *entry, *scroll;
-
- scroll = gtk_scrolled_window_new(NULL, NULL);
- gtk_container_set_border_width(GTK_CONTAINER(scroll), 5);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- vbox = gtk_vbox_new(FALSE, 3);
-
- box = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), box, TRUE, FALSE, 5);
-
- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), vbox);
-
- gtk_notebook_append_page(GTK_NOTEBOOK(win), scroll, gtk_label_new(ts->name));
-
- entry = new_info_entry_in_frame(box, "Name");
- gtk_entry_set_text(GTK_ENTRY(entry), ts->name);
- if (strlen(ts->description)) {
- entry = new_info_entry_in_frame(box, "Description");
- gtk_entry_set_text(GTK_ENTRY(entry), ts->description);
- }
- entry = new_info_entry_in_frame(box, "Group ID");
- entry_set_int_value(entry, ts->groupid);
- entry = new_info_entry_in_frame(box, "Jobs");
- entry_set_int_value(entry, ts->members);
- gc->err_entry = entry = new_info_entry_in_frame(box, "Error");
- entry_set_int_value(entry, ts->error);
- entry = new_info_entry_in_frame(box, "PID");
- entry_set_int_value(entry, ts->pid);
-
- if (ts->io_bytes[DDIR_READ])
- gfio_show_ddir_status(gc, vbox, rs, ts, DDIR_READ);
- if (ts->io_bytes[DDIR_WRITE])
- gfio_show_ddir_status(gc, vbox, rs, ts, DDIR_WRITE);
-
- gfio_show_latency_buckets(gc, vbox, ts);
- gfio_show_cpu_usage(vbox, ts);
- gfio_show_io_depths(vbox, ts);
-}
-
-static void gfio_display_end_results(struct gfio_client *gc)
-{
- struct gui_entry *ge = gc->ge;
- GtkWidget *res_notebook;
- int i;
-
- res_notebook = get_results_window(ge);
-
- for (i = 0; i < gc->nr_results; i++) {
- struct end_results *e = &gc->results[i];
-
- __gfio_display_end_results(res_notebook, gc, &e->ts, &e->gs);
- }
-
- if (gfio_disk_util_show(gc))
- gtk_widget_show_all(ge->results_window);
-}
-
-static void gfio_display_ts(struct fio_client *client, struct thread_stat *ts,
- struct group_run_stats *rs)
-{
- struct gfio_client *gc = client->client_data;
- struct gui_entry *ge = gc->ge;
-
- gfio_add_end_results(gc, ts, rs);
-
- gdk_threads_enter();
- if (ge->results_window)
- __gfio_display_end_results(ge->results_notebook, gc, ts, rs);
- else
- gfio_display_end_results(gc);
- gdk_threads_leave();
-}
-
-static void gfio_text_op(struct fio_client *client, struct fio_net_cmd *cmd)
-{
- struct cmd_text_pdu *p = (struct cmd_text_pdu *) cmd->payload;
- struct gui *ui = &main_ui;
- GtkTreeIter iter;
- struct tm *tm;
- time_t sec;
- char tmp[64], timebuf[80];
-
- sec = p->log_sec;
- tm = localtime(&sec);
- strftime(tmp, sizeof(tmp), "%Y-%m-%d %H:%M:%S", tm);
- sprintf(timebuf, "%s.%03ld", tmp, p->log_usec / 1000);
-
- gdk_threads_enter();
-
- gtk_list_store_append(ui->log_model, &iter);
- gtk_list_store_set(ui->log_model, &iter, 0, timebuf, -1);
- gtk_list_store_set(ui->log_model, &iter, 1, client->hostname, -1);
- gtk_list_store_set(ui->log_model, &iter, 2, p->level, -1);
- gtk_list_store_set(ui->log_model, &iter, 3, p->buf, -1);
-
- if (p->level == FIO_LOG_ERR)
- view_log(NULL, (gpointer) ui);
-
- gdk_threads_leave();
-}
-
-static void gfio_disk_util_op(struct fio_client *client, struct fio_net_cmd *cmd)
-{
- struct cmd_du_pdu *p = (struct cmd_du_pdu *) cmd->payload;
- struct gfio_client *gc = client->client_data;
- struct gui_entry *ge = gc->ge;
- unsigned int nr = gc->nr_du;
-
- gc->du = realloc(gc->du, (nr + 1) * sizeof(struct cmd_du_pdu));
- memcpy(&gc->du[nr], p, sizeof(*p));
- gc->nr_du++;
-
- gdk_threads_enter();
- if (ge->results_window)
- __gfio_disk_util_show(ge->results_notebook, gc, p);
- else
- gfio_disk_util_show(gc);
- gdk_threads_leave();
-}
-
-extern int sum_stat_clients;
-extern struct thread_stat client_ts;
-extern struct group_run_stats client_gs;
-
-static int sum_stat_nr;
-
-static void gfio_thread_status_op(struct fio_client *client,
- struct fio_net_cmd *cmd)
-{
- struct cmd_ts_pdu *p = (struct cmd_ts_pdu *) cmd->payload;
-
- gfio_display_ts(client, &p->ts, &p->rs);
-
- if (sum_stat_clients == 1)
- return;
-
- sum_thread_stats(&client_ts, &p->ts, sum_stat_nr);
- sum_group_stats(&client_gs, &p->rs);
-
- client_ts.members++;
- client_ts.thread_number = p->ts.thread_number;
- client_ts.groupid = p->ts.groupid;
-
- if (++sum_stat_nr == sum_stat_clients) {
- strcpy(client_ts.name, "All clients");
- gfio_display_ts(client, &client_ts, &client_gs);
- }
-}
-
-static void gfio_group_stats_op(struct fio_client *client,
- struct fio_net_cmd *cmd)
-{
- /* We're ignoring group stats for now */
-}
-
-static gint on_config_drawing_area(GtkWidget *w, GdkEventConfigure *event,
- gpointer data)
-{
- struct gfio_graphs *g = data;
-
- graph_set_size(g->iops_graph, w->allocation.width / 2.0, w->allocation.height);
- graph_set_position(g->iops_graph, w->allocation.width / 2.0, 0.0);
- graph_set_size(g->bandwidth_graph, w->allocation.width / 2.0, w->allocation.height);
- graph_set_position(g->bandwidth_graph, 0, 0);
- return TRUE;
-}
-
-static void draw_graph(struct graph *g, cairo_t *cr)
-{
- line_graph_draw(g, cr);
- cairo_stroke(cr);
-}
-
-static gboolean graph_tooltip(GtkWidget *w, gint x, gint y,
- gboolean keyboard_mode, GtkTooltip *tooltip,
- gpointer data)
-{
- struct gfio_graphs *g = data;
- const char *text = NULL;
-
- if (graph_contains_xy(g->iops_graph, x, y))
- text = graph_find_tooltip(g->iops_graph, x, y);
- else if (graph_contains_xy(g->bandwidth_graph, x, y))
- text = graph_find_tooltip(g->bandwidth_graph, x, y);
-
- if (text) {
- gtk_tooltip_set_text(tooltip, text);
- return TRUE;
- }
-
- return FALSE;
-}
-
-static int on_expose_drawing_area(GtkWidget *w, GdkEvent *event, gpointer p)
-{
- struct gfio_graphs *g = p;
- cairo_t *cr;
-
- cr = gdk_cairo_create(w->window);
-
- if (graph_has_tooltips(g->iops_graph) ||
- graph_has_tooltips(g->bandwidth_graph)) {
- g_object_set(w, "has-tooltip", TRUE, NULL);
- g_signal_connect(w, "query-tooltip", G_CALLBACK(graph_tooltip), g);
- }
-
- cairo_set_source_rgb(cr, 0, 0, 0);
- draw_graph(g->iops_graph, cr);
- draw_graph(g->bandwidth_graph, cr);
- cairo_destroy(cr);
-
- return FALSE;
-}
-
-/*
- * Client specific ETA
- */
-static void gfio_update_client_eta(struct fio_client *client, struct jobs_eta *je)
-{
- struct gfio_client *gc = client->client_data;
- struct gui_entry *ge = gc->ge;
- static int eta_good;
- char eta_str[128];
- char output[256];
- char tmp[32];
- double perc = 0.0;
- int i2p = 0;
-
- gdk_threads_enter();
-
- eta_str[0] = '\0';
- output[0] = '\0';
-
- if (je->eta_sec != INT_MAX && je->elapsed_sec) {
- perc = (double) je->elapsed_sec / (double) (je->elapsed_sec + je->eta_sec);
- eta_to_str(eta_str, je->eta_sec);
- }
-
- sprintf(tmp, "%u", je->nr_running);
- gtk_entry_set_text(GTK_ENTRY(ge->eta.jobs), tmp);
- sprintf(tmp, "%u", je->files_open);
- gtk_entry_set_text(GTK_ENTRY(ge->eta.files), tmp);
-
-#if 0
- if (je->m_rate[0] || je->m_rate[1] || je->t_rate[0] || je->t_rate[1]) {
- if (je->m_rate || je->t_rate) {
- char *tr, *mr;
-
- mr = num2str(je->m_rate, 4, 0, i2p);
- tr = num2str(je->t_rate, 4, 0, i2p);
- gtk_entry_set_text(GTK_ENTRY(ge->eta);
- p += sprintf(p, ", CR=%s/%s KB/s", tr, mr);
- free(tr);
- free(mr);
- } else if (je->m_iops || je->t_iops)
- p += sprintf(p, ", CR=%d/%d IOPS", je->t_iops, je->m_iops);
-
- gtk_entry_set_text(GTK_ENTRY(ge->eta.cr_bw), "---");
- gtk_entry_set_text(GTK_ENTRY(ge->eta.cr_iops), "---");
- gtk_entry_set_text(GTK_ENTRY(ge->eta.cw_bw), "---");
- gtk_entry_set_text(GTK_ENTRY(ge->eta.cw_iops), "---");
-#endif
-
- if (je->eta_sec != INT_MAX && je->nr_running) {
- char *iops_str[2];
- char *rate_str[2];
-
- if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running)
- strcpy(output, "-.-% done");
- else {
- eta_good = 1;
- perc *= 100.0;
- sprintf(output, "%3.1f%% done", perc);
- }
-
- rate_str[0] = num2str(je->rate[0], 5, 10, i2p);
- rate_str[1] = num2str(je->rate[1], 5, 10, i2p);
-
- iops_str[0] = num2str(je->iops[0], 4, 1, 0);
- iops_str[1] = num2str(je->iops[1], 4, 1, 0);
-
- gtk_entry_set_text(GTK_ENTRY(ge->eta.read_bw), rate_str[0]);
- gtk_entry_set_text(GTK_ENTRY(ge->eta.read_iops), iops_str[0]);
- gtk_entry_set_text(GTK_ENTRY(ge->eta.write_bw), rate_str[1]);
- gtk_entry_set_text(GTK_ENTRY(ge->eta.write_iops), iops_str[1]);
-
- graph_add_xy_data(ge->graphs.iops_graph, "Read IOPS", je->elapsed_sec, je->iops[0], iops_str[0]);
- graph_add_xy_data(ge->graphs.iops_graph, "Write IOPS", je->elapsed_sec, je->iops[1], iops_str[1]);
- graph_add_xy_data(ge->graphs.bandwidth_graph, "Read Bandwidth", je->elapsed_sec, je->rate[0], rate_str[0]);
- graph_add_xy_data(ge->graphs.bandwidth_graph, "Write Bandwidth", je->elapsed_sec, je->rate[1], rate_str[1]);
-
- free(rate_str[0]);
- free(rate_str[1]);
- free(iops_str[0]);
- free(iops_str[1]);
- }
-
- if (eta_str[0]) {
- char *dst = output + strlen(output);
-
- sprintf(dst, " - %s", eta_str);
- }
-
- gfio_update_thread_status(ge, output, perc);
- gdk_threads_leave();
-}
-
-/*
- * Update ETA in main window for all clients
- */
-static void gfio_update_all_eta(struct jobs_eta *je)
-{
- struct gui *ui = &main_ui;
- static int eta_good;
- char eta_str[128];
- char output[256];
- double perc = 0.0;
- int i2p = 0;
-
- gdk_threads_enter();
-
- eta_str[0] = '\0';
- output[0] = '\0';
-
- if (je->eta_sec != INT_MAX && je->elapsed_sec) {
- perc = (double) je->elapsed_sec / (double) (je->elapsed_sec + je->eta_sec);
- eta_to_str(eta_str, je->eta_sec);
- }
-
-#if 0
- if (je->m_rate[0] || je->m_rate[1] || je->t_rate[0] || je->t_rate[1]) {
- if (je->m_rate || je->t_rate) {
- char *tr, *mr;
-
- mr = num2str(je->m_rate, 4, 0, i2p);
- tr = num2str(je->t_rate, 4, 0, i2p);
- gtk_entry_set_text(GTK_ENTRY(ui->eta);
- p += sprintf(p, ", CR=%s/%s KB/s", tr, mr);
- free(tr);
- free(mr);
- } else if (je->m_iops || je->t_iops)
- p += sprintf(p, ", CR=%d/%d IOPS", je->t_iops, je->m_iops);
-
- gtk_entry_set_text(GTK_ENTRY(ui->eta.cr_bw), "---");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.cr_iops), "---");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.cw_bw), "---");
- gtk_entry_set_text(GTK_ENTRY(ui->eta.cw_iops), "---");
-#endif
-
- entry_set_int_value(ui->eta.jobs, je->nr_running);
-
- if (je->eta_sec != INT_MAX && je->nr_running) {
- char *iops_str[2];
- char *rate_str[2];
-
- if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running)
- strcpy(output, "-.-% done");
- else {
- eta_good = 1;
- perc *= 100.0;
- sprintf(output, "%3.1f%% done", perc);
- }
-
- rate_str[0] = num2str(je->rate[0], 5, 10, i2p);
- rate_str[1] = num2str(je->rate[1], 5, 10, i2p);
-
- iops_str[0] = num2str(je->iops[0], 4, 1, 0);
- iops_str[1] = num2str(je->iops[1], 4, 1, 0);
-
- gtk_entry_set_text(GTK_ENTRY(ui->eta.read_bw), rate_str[0]);
- gtk_entry_set_text(GTK_ENTRY(ui->eta.read_iops), iops_str[0]);
- gtk_entry_set_text(GTK_ENTRY(ui->eta.write_bw), rate_str[1]);
- gtk_entry_set_text(GTK_ENTRY(ui->eta.write_iops), iops_str[1]);
-
- graph_add_xy_data(ui->graphs.iops_graph, "Read IOPS", je->elapsed_sec, je->iops[0], iops_str[0]);
- graph_add_xy_data(ui->graphs.iops_graph, "Write IOPS", je->elapsed_sec, je->iops[1], iops_str[1]);
- graph_add_xy_data(ui->graphs.bandwidth_graph, "Read Bandwidth", je->elapsed_sec, je->rate[0], rate_str[0]);
- graph_add_xy_data(ui->graphs.bandwidth_graph, "Write Bandwidth", je->elapsed_sec, je->rate[1], rate_str[1]);
-
- free(rate_str[0]);
- free(rate_str[1]);
- free(iops_str[0]);
- free(iops_str[1]);
- }
-
- if (eta_str[0]) {
- char *dst = output + strlen(output);
-
- sprintf(dst, " - %s", eta_str);
- }
-
- gfio_update_thread_status_all(output, perc);
- gdk_threads_leave();
-}
-
-static void gfio_probe_op(struct fio_client *client, struct fio_net_cmd *cmd)
-{
- struct cmd_probe_pdu *probe = (struct cmd_probe_pdu *) cmd->payload;
- struct gfio_client *gc = client->client_data;
- struct gui_entry *ge = gc->ge;
- const char *os, *arch;
- char buf[64];
-
- os = fio_get_os_string(probe->os);
- if (!os)
- os = "unknown";
-
- arch = fio_get_arch_string(probe->arch);
- if (!arch)
- os = "unknown";
-
- if (!client->name)
- client->name = strdup((char *) probe->hostname);
-
- gdk_threads_enter();
-
- gtk_label_set_text(GTK_LABEL(ge->probe.hostname), (char *) probe->hostname);
- gtk_label_set_text(GTK_LABEL(ge->probe.os), os);
- gtk_label_set_text(GTK_LABEL(ge->probe.arch), arch);
- sprintf(buf, "%u.%u.%u", probe->fio_major, probe->fio_minor, probe->fio_patch);
- gtk_label_set_text(GTK_LABEL(ge->probe.fio_ver), buf);
-
- gfio_set_state(ge, GE_STATE_CONNECTED);
-
- gdk_threads_leave();
-}
-
-static void gfio_update_thread_status(struct gui_entry *ge,
- char *status_message, double perc)
-{
- static char message[100];
- const char *m = message;
-
- strncpy(message, status_message, sizeof(message) - 1);
- gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ge->thread_status_pb), m);
- gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ge->thread_status_pb), perc / 100.0);
- gtk_widget_queue_draw(main_ui.window);
-}
-
-static void gfio_update_thread_status_all(char *status_message, double perc)
-{
- struct gui *ui = &main_ui;
- static char message[100];
- const char *m = message;
-
- strncpy(message, status_message, sizeof(message) - 1);
- gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ui->thread_status_pb), m);
- gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ui->thread_status_pb), perc / 100.0);
- gtk_widget_queue_draw(ui->window);
-}
-
-static void gfio_quit_op(struct fio_client *client, struct fio_net_cmd *cmd)
-{
- struct gfio_client *gc = client->client_data;
-
- gdk_threads_enter();
- gfio_set_state(gc->ge, GE_STATE_NEW);
- gdk_threads_leave();