2 * gfio - gui front end for fio - the flexible io tester
4 * Copyright (C) 2012 Stephen M. Cameron <stephenmcameron@gmail.com>
6 * The license below covers all files distributed with fio unless otherwise
7 * noted in the file itself.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 static void gfio_update_thread_status(char *status_message, double perc);
33 #define ARRAYSIZE(x) (sizeof((x)) / (sizeof((x)[0])))
35 typedef void (*clickfunction)(GtkWidget *widget, gpointer data);
37 static void connect_clicked(GtkWidget *widget, gpointer data);
38 static void start_job_clicked(GtkWidget *widget, gpointer data);
40 static struct button_spec {
41 const char *buttontext;
43 const char *tooltiptext;
44 const int start_insensitive;
45 } buttonspeclist[] = {
46 #define CONNECT_BUTTON 0
47 #define START_JOB_BUTTON 1
48 { "Connect", connect_clicked, "Connect to host", 0 },
51 "Send current fio job to fio server to be executed", 1 },
69 GtkWidget *write_iops;
79 GtkWidget *bottomalign;
80 GtkWidget *thread_status_pb;
82 GtkWidget *button[ARRAYSIZE(buttonspeclist)];
83 GtkWidget *hostname_hbox;
84 GtkWidget *hostname_label;
85 GtkWidget *hostname_entry;
86 GtkWidget *port_button;
87 GtkWidget *port_label;
88 GtkWidget *hostname_combo_box; /* ipv4, ipv6 or socket */
89 GtkWidget *scrolled_window;
91 GtkWidget *error_info_bar;
92 GtkWidget *error_label;
94 struct probe_widget probe;
95 struct eta_widget eta;
99 struct fio_client *client;
104 static void gfio_set_connected(struct gui *ui, int connected)
107 gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 1);
109 gtk_button_set_label(GTK_BUTTON(ui->button[CONNECT_BUTTON]), "Disconnect");
112 gtk_button_set_label(GTK_BUTTON(ui->button[CONNECT_BUTTON]), "Connect");
113 gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 0);
117 static void gfio_text_op(struct fio_client *client,
118 FILE *f, __u16 pdu_len, const char *buf)
120 GtkTextBuffer *buffer;
123 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui.textview));
125 gtk_text_buffer_get_end_iter(buffer, &end);
126 gtk_text_buffer_insert(buffer, &end, buf, -1);
128 gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(ui.textview),
129 &end, 0.0, FALSE, 0.0,0.0);
132 static void gfio_disk_util_op(struct fio_client *client, struct fio_net_cmd *cmd)
134 printf("gfio_disk_util_op called\n");
135 fio_client_ops.disk_util(client, cmd);
138 static void gfio_thread_status_op(struct fio_net_cmd *cmd)
140 printf("gfio_thread_status_op called\n");
141 fio_client_ops.thread_status(cmd);
144 static void gfio_group_stats_op(struct fio_net_cmd *cmd)
146 printf("gfio_group_stats_op called\n");
147 fio_client_ops.group_stats(cmd);
150 static void gfio_update_eta(struct jobs_eta *je)
162 if (je->eta_sec != INT_MAX && je->elapsed_sec) {
163 perc = (double) je->elapsed_sec / (double) (je->elapsed_sec + je->eta_sec);
164 eta_to_str(eta_str, je->eta_sec);
167 sprintf(tmp, "%u", je->nr_running);
168 gtk_label_set_text(GTK_LABEL(ui.eta.jobs), tmp);
169 sprintf(tmp, "%u", je->files_open);
170 gtk_label_set_text(GTK_LABEL(ui.eta.files), tmp);
173 if (je->m_rate[0] || je->m_rate[1] || je->t_rate[0] || je->t_rate[1]) {
174 if (je->m_rate || je->t_rate) {
177 mr = num2str(je->m_rate, 4, 0, i2p);
178 tr = num2str(je->t_rate, 4, 0, i2p);
179 gtk_label_set_text(GTK_LABEL(ui.eta.
180 p += sprintf(p, ", CR=%s/%s KB/s", tr, mr);
183 } else if (je->m_iops || je->t_iops)
184 p += sprintf(p, ", CR=%d/%d IOPS", je->t_iops, je->m_iops);
186 gtk_label_set_text(GTK_LABEL(ui.eta.cr_bw), "---");
187 gtk_label_set_text(GTK_LABEL(ui.eta.cr_iops), "---");
188 gtk_label_set_text(GTK_LABEL(ui.eta.cw_bw), "---");
189 gtk_label_set_text(GTK_LABEL(ui.eta.cw_iops), "---");
192 if (je->eta_sec != INT_MAX && je->nr_running) {
196 if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running)
197 strcpy(output, "-.-% done");
201 sprintf(output, "%3.1f%% done", perc);
204 rate_str[0] = num2str(je->rate[0], 5, 10, i2p);
205 rate_str[1] = num2str(je->rate[1], 5, 10, i2p);
207 iops_str[0] = num2str(je->iops[0], 4, 1, 0);
208 iops_str[1] = num2str(je->iops[1], 4, 1, 0);
210 gtk_label_set_text(GTK_LABEL(ui.eta.read_bw), rate_str[0]);
211 gtk_label_set_text(GTK_LABEL(ui.eta.read_iops), iops_str[0]);
212 gtk_label_set_text(GTK_LABEL(ui.eta.write_bw), rate_str[1]);
213 gtk_label_set_text(GTK_LABEL(ui.eta.write_iops), iops_str[1]);
222 char *dst = output + strlen(output);
224 sprintf(dst, " - %s", eta_str);
227 gfio_update_thread_status(output, perc);
230 static void gfio_eta_op(struct fio_client *client, struct fio_net_cmd *cmd)
232 struct jobs_eta *je = (struct jobs_eta *) cmd->payload;
233 struct client_eta *eta = (struct client_eta *) (uintptr_t) cmd->tag;
235 client->eta_in_flight = NULL;
236 flist_del_init(&client->eta_list);
238 fio_client_convert_jobs_eta(je);
239 fio_client_sum_jobs_eta(&eta->eta, je);
240 fio_client_dec_jobs_eta(eta, gfio_update_eta);
243 static void gfio_probe_op(struct fio_client *client, struct fio_net_cmd *cmd)
245 struct cmd_probe_pdu *probe = (struct cmd_probe_pdu *) cmd->payload;
246 const char *os, *arch;
249 os = fio_get_os_string(probe->os);
253 arch = fio_get_arch_string(probe->arch);
258 client->name = strdup((char *) probe->hostname);
260 gtk_label_set_text(GTK_LABEL(ui.probe.hostname), (char *) probe->hostname);
261 gtk_label_set_text(GTK_LABEL(ui.probe.os), os);
262 gtk_label_set_text(GTK_LABEL(ui.probe.arch), arch);
263 sprintf(buf, "%u.%u.%u", probe->fio_major, probe->fio_minor, probe->fio_patch);
264 gtk_label_set_text(GTK_LABEL(ui.probe.fio_ver), buf);
267 static void gfio_update_thread_status(char *status_message, double perc)
269 static char message[100];
270 const char *m = message;
272 strncpy(message, status_message, sizeof(message) - 1);
273 gtk_progress_bar_set_text(
274 GTK_PROGRESS_BAR(ui.thread_status_pb), m);
275 gtk_progress_bar_set_fraction(
276 GTK_PROGRESS_BAR(ui.thread_status_pb), perc / 100.0);
278 gtk_widget_queue_draw(ui.window);
282 static void gfio_quit_op(struct fio_client *client)
284 struct gui *ui = client->client_data;
286 gfio_set_connected(ui, 0);
289 struct client_ops gfio_client_ops = {
290 .text_op = gfio_text_op,
291 .disk_util = gfio_disk_util_op,
292 .thread_status = gfio_thread_status_op,
293 .group_stats = gfio_group_stats_op,
295 .probe = gfio_probe_op,
296 .quit = gfio_quit_op,
300 static void quit_clicked(__attribute__((unused)) GtkWidget *widget,
301 __attribute__((unused)) gpointer data)
306 static void *job_thread(void *arg)
308 printf("job thread starts\n");
309 fio_handle_clients(&gfio_client_ops);
310 printf("job thread exits\n");
314 static int send_job_files(struct gui *ui)
318 for (i = 0; i < ui->nr_job_files; i++) {
319 ret = fio_clients_send_ini(ui->job_files[i]);
323 free(ui->job_files[i]);
324 ui->job_files[i] = NULL;
326 while (i < ui->nr_job_files) {
327 free(ui->job_files[i]);
328 ui->job_files[i] = NULL;
335 static void start_job_thread(struct gui *ui)
337 if (send_job_files(ui)) {
338 printf("Yeah, I didn't really like those options too much.\n");
339 gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 1);
344 static void start_job_clicked(__attribute__((unused)) GtkWidget *widget,
347 struct gui *ui = data;
349 gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 0);
350 start_job_thread(ui);
353 static void connect_clicked(__attribute__((unused)) GtkWidget *widget,
356 struct gui *ui = data;
358 if (!ui->connected) {
359 fio_clients_connect();
360 pthread_create(&ui->t, NULL, job_thread, NULL);
361 gfio_set_connected(ui, 1);
363 gfio_set_connected(ui, 0);
366 static void add_button(struct gui *ui, int i, GtkWidget *buttonbox,
367 struct button_spec *buttonspec)
369 ui->button[i] = gtk_button_new_with_label(buttonspec->buttontext);
370 g_signal_connect(ui->button[i], "clicked", G_CALLBACK (buttonspec->f), ui);
371 gtk_box_pack_start(GTK_BOX (ui->buttonbox), ui->button[i], FALSE, FALSE, 3);
372 gtk_widget_set_tooltip_text(ui->button[i], buttonspeclist[i].tooltiptext);
373 gtk_widget_set_sensitive(ui->button[i], !buttonspec->start_insensitive);
376 static void add_buttons(struct gui *ui,
377 struct button_spec *buttonlist,
382 for (i = 0; i < nbuttons; i++)
383 add_button(ui, i, ui->buttonbox, &buttonlist[i]);
386 static void on_info_bar_response(GtkWidget *widget, gint response,
389 if (response == GTK_RESPONSE_OK) {
390 gtk_widget_destroy(widget);
391 ui.error_info_bar = NULL;
395 void report_error(GError* error)
397 if (ui.error_info_bar == NULL) {
398 ui.error_info_bar = gtk_info_bar_new_with_buttons(GTK_STOCK_OK,
401 g_signal_connect(ui.error_info_bar, "response", G_CALLBACK(on_info_bar_response), NULL);
402 gtk_info_bar_set_message_type(GTK_INFO_BAR(ui.error_info_bar),
405 ui.error_label = gtk_label_new(error->message);
406 GtkWidget *container = gtk_info_bar_get_content_area(GTK_INFO_BAR(ui.error_info_bar));
407 gtk_container_add(GTK_CONTAINER(container), ui.error_label);
409 gtk_box_pack_start(GTK_BOX(ui.vbox), ui.error_info_bar, FALSE, FALSE, 0);
410 gtk_widget_show_all(ui.vbox);
413 snprintf(buffer, sizeof(buffer), "Failed to open file.");
414 gtk_label_set(GTK_LABEL(ui.error_label), buffer);
418 static void file_open(GtkWidget *w, gpointer data)
421 GSList *filenames, *fn_glist;
422 GtkFileFilter *filter;
424 dialog = gtk_file_chooser_dialog_new("Open File",
425 GTK_WINDOW(ui.window),
426 GTK_FILE_CHOOSER_ACTION_OPEN,
427 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
428 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
430 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE);
432 filter = gtk_file_filter_new();
433 gtk_file_filter_add_pattern(filter, "*.fio");
434 gtk_file_filter_add_pattern(filter, "*.job");
435 gtk_file_filter_add_mime_type(filter, "text/fio");
436 gtk_file_filter_set_name(filter, "Fio job file");
437 gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
439 if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_ACCEPT) {
440 gtk_widget_destroy(dialog);
444 fn_glist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
445 filenames = fn_glist;
446 while (filenames != NULL) {
447 const char *hostname;
452 ui.job_files = realloc(ui.job_files, (ui.nr_job_files + 1) * sizeof(char *));
453 ui.job_files[ui.nr_job_files] = strdup(filenames->data);
456 hostname = gtk_entry_get_text(GTK_ENTRY(ui.hostname_entry));
457 port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ui.port_button));
458 typeentry = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(ui.hostname_combo_box));
459 if (!typeentry || !strncmp(typeentry, "IPv4", 4))
460 type = Fio_client_ipv4;
461 else if (!strncmp(typeentry, "IPv6", 4))
462 type = Fio_client_ipv6;
464 type = Fio_client_socket;
467 ui.client = fio_client_add_explicit(hostname, type, port);
468 ui.client->client_data = &ui;
477 g_free(filenames->data);
478 filenames = g_slist_next(filenames);
480 g_slist_free(fn_glist);
481 gtk_widget_destroy(dialog);
484 static void file_save(GtkWidget *w, gpointer data)
488 dialog = gtk_file_chooser_dialog_new("Save File",
489 GTK_WINDOW(ui.window),
490 GTK_FILE_CHOOSER_ACTION_SAVE,
491 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
492 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
495 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
496 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), "Untitled document");
498 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
501 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
502 // save_job_file(filename);
505 gtk_widget_destroy(dialog);
508 static void about_dialog(GtkWidget *w, gpointer data)
510 gtk_show_about_dialog(NULL,
511 "program-name", "gfio",
512 "comments", "Gtk2 UI for fio",
514 "version", fio_version_string,
515 "copyright", "Jens Axboe <axboe@kernel.dk> 2012",
516 "logo-icon-name", "fio",
522 static GtkActionEntry menu_items[] = {
523 { "FileMenuAction", GTK_STOCK_FILE, "File", NULL, NULL, NULL},
524 { "HelpMenuAction", GTK_STOCK_HELP, "Help", NULL, NULL, NULL},
525 { "OpenFile", GTK_STOCK_OPEN, NULL, "<Control>O", NULL, G_CALLBACK(file_open) },
526 { "SaveFile", GTK_STOCK_SAVE, NULL, "<Control>S", NULL, G_CALLBACK(file_save) },
527 { "Quit", GTK_STOCK_QUIT, NULL, "<Control>Q", NULL, G_CALLBACK(quit_clicked) },
528 { "About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(about_dialog) },
530 static gint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
532 static const gchar *ui_string = " \
534 <menubar name=\"MainMenu\"> \
535 <menu name=\"FileMenu\" action=\"FileMenuAction\"> \
536 <menuitem name=\"Open\" action=\"OpenFile\" /> \
537 <menuitem name=\"Save\" action=\"SaveFile\" /> \
538 <separator name=\"Separator\"/> \
539 <menuitem name=\"Quit\" action=\"Quit\" /> \
541 <menu name=\"Help\" action=\"HelpMenuAction\"> \
542 <menuitem name=\"About\" action=\"About\" /> \
548 static GtkWidget *get_menubar_menu(GtkWidget *window, GtkUIManager *ui_manager)
550 GtkActionGroup *action_group = gtk_action_group_new("Menu");
553 action_group = gtk_action_group_new("Menu");
554 gtk_action_group_add_actions(action_group, menu_items, nmenu_items, 0);
556 gtk_ui_manager_insert_action_group(ui_manager, action_group, 0);
557 gtk_ui_manager_add_ui_from_string(GTK_UI_MANAGER(ui_manager), ui_string, -1, &error);
559 gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(ui_manager));
560 return gtk_ui_manager_get_widget(ui_manager, "/MainMenu");
563 void gfio_ui_setup(GtkSettings *settings, GtkWidget *menubar,
564 GtkWidget *vbox, GtkUIManager *ui_manager)
566 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
569 static GtkWidget *new_info_label_in_frame(GtkWidget *box, const char *label)
571 GtkWidget *label_widget;
574 frame = gtk_frame_new(label);
575 label_widget = gtk_label_new(NULL);
576 gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 3);
577 gtk_container_add(GTK_CONTAINER(frame), label_widget);
582 static GtkWidget *create_text_entry(GtkWidget *hbox, GtkWidget *label, const char *defval)
584 GtkWidget *text, *box;
586 gtk_container_add(GTK_CONTAINER(hbox), label);
588 box = gtk_hbox_new(FALSE, 3);
589 gtk_container_add(GTK_CONTAINER(hbox), box);
591 text = gtk_entry_new();
592 gtk_box_pack_start(GTK_BOX(box), text, TRUE, TRUE, 0);
593 gtk_entry_set_text(GTK_ENTRY(text), "localhost");
598 static GtkWidget *create_spinbutton(GtkWidget *hbox, GtkWidget *label, double min, double max, double defval)
600 GtkWidget *button, *box;
602 gtk_container_add(GTK_CONTAINER(hbox), label);
604 box = gtk_hbox_new(FALSE, 3);
605 gtk_container_add(GTK_CONTAINER(hbox), box);
607 button = gtk_spin_button_new_with_range(min, max, 1.0);
608 gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
610 gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(button), GTK_UPDATE_IF_VALID);
611 gtk_spin_button_set_value(GTK_SPIN_BUTTON(button), defval);
616 static void init_ui(int *argc, char **argv[], struct gui *ui)
618 GtkSettings *settings;
619 GtkUIManager *uimanager;
620 GtkWidget *menu, *probe, *probe_frame, *probe_box;
622 memset(ui, 0, sizeof(*ui));
624 /* Magical g*thread incantation, you just need this thread stuff.
625 * Without it, the update that happens in gfio_update_thread_status
626 * doesn't really happen in a timely fashion, you need expose events
628 if (!g_thread_supported ())
632 gtk_init(argc, argv);
633 settings = gtk_settings_get_default();
634 gtk_settings_set_long_property(settings, "gtk_tooltip_timeout", 10, "gfio setting");
637 ui->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
638 gtk_window_set_title(GTK_WINDOW(ui->window), "fio");
639 gtk_window_set_default_size(GTK_WINDOW(ui->window), 700, 500);
641 g_signal_connect(ui->window, "delete-event", G_CALLBACK(quit_clicked), NULL);
642 g_signal_connect(ui->window, "destroy", G_CALLBACK(quit_clicked), NULL);
644 ui->vbox = gtk_vbox_new(FALSE, 0);
645 gtk_container_add(GTK_CONTAINER (ui->window), ui->vbox);
647 uimanager = gtk_ui_manager_new();
648 menu = get_menubar_menu(ui->window, uimanager);
649 gfio_ui_setup(settings, menu, ui->vbox, uimanager);
652 * Set up alignments for widgets at the top of ui,
653 * align top left, expand horizontally but not vertically
655 ui->topalign = gtk_alignment_new(0, 0, 1, 0);
656 ui->topvbox = gtk_vbox_new(FALSE, 3);
657 gtk_container_add(GTK_CONTAINER(ui->topalign), ui->topvbox);
658 gtk_box_pack_start(GTK_BOX(ui->vbox), ui->topalign, FALSE, FALSE, 0);
661 * Set up hostname label + entry, port label + entry,
663 ui->hostname_hbox = gtk_hbox_new(FALSE, 0);
665 ui->hostname_label = gtk_label_new("Hostname:");
666 ui->hostname_entry = create_text_entry(ui->hostname_hbox, ui->hostname_label, "localhost");
668 ui->port_label = gtk_label_new("Port:");
669 ui->port_button = create_spinbutton(ui->hostname_hbox, ui->port_label, 1, 65535, FIO_NET_PORT);
672 * Set up combo box for address type
674 ui->hostname_combo_box = gtk_combo_box_text_new();
675 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ui->hostname_combo_box), "IPv4");
676 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ui->hostname_combo_box), "IPv6");
677 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ui->hostname_combo_box), "local socket");
678 gtk_combo_box_set_active(GTK_COMBO_BOX(ui->hostname_combo_box), 0);
680 gtk_container_add(GTK_CONTAINER(ui->hostname_hbox), ui->hostname_combo_box);
681 gtk_container_add(GTK_CONTAINER(ui->topvbox), ui->hostname_hbox);
683 probe = gtk_frame_new("Job");
684 gtk_box_pack_start(GTK_BOX(ui->topvbox), probe, TRUE, FALSE, 3);
685 probe_frame = gtk_vbox_new(FALSE, 3);
686 gtk_container_add(GTK_CONTAINER(probe), probe_frame);
688 probe_box = gtk_hbox_new(FALSE, 3);
689 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
690 ui->probe.hostname = new_info_label_in_frame(probe_box, "Host");
691 ui->probe.os = new_info_label_in_frame(probe_box, "OS");
692 ui->probe.arch = new_info_label_in_frame(probe_box, "Architecture");
693 ui->probe.fio_ver = new_info_label_in_frame(probe_box, "Fio version");
695 probe_box = gtk_hbox_new(FALSE, 3);
696 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
697 ui->eta.jobs = new_info_label_in_frame(probe_box, "Jobs");
698 ui->eta.files = new_info_label_in_frame(probe_box, "Open files");
700 probe_box = gtk_hbox_new(FALSE, 3);
701 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
702 ui->eta.read_bw = new_info_label_in_frame(probe_box, "Read BW");
703 ui->eta.read_iops = new_info_label_in_frame(probe_box, "IOPS");
704 ui->eta.cr_bw = new_info_label_in_frame(probe_box, "Commit BW");
705 ui->eta.cr_iops = new_info_label_in_frame(probe_box, "Commit IOPS");
707 probe_box = gtk_hbox_new(FALSE, 3);
708 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
709 ui->eta.write_bw = new_info_label_in_frame(probe_box, "Write BW");
710 ui->eta.write_iops = new_info_label_in_frame(probe_box, "IOPS");
711 ui->eta.cw_bw = new_info_label_in_frame(probe_box, "Commit BW");
712 ui->eta.cw_iops = new_info_label_in_frame(probe_box, "Commit IOPS");
715 * Add a text box for text op messages
717 ui->textview = gtk_text_view_new();
718 ui->text = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui->textview));
719 gtk_text_buffer_set_text(ui->text, "", -1);
720 gtk_text_view_set_editable(GTK_TEXT_VIEW(ui->textview), FALSE);
721 gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(ui->textview), FALSE);
722 ui->scrolled_window = gtk_scrolled_window_new(NULL, NULL);
723 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ui->scrolled_window),
724 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
725 gtk_container_add(GTK_CONTAINER(ui->scrolled_window), ui->textview);
726 gtk_box_pack_start(GTK_BOX(ui->vbox), ui->scrolled_window,
730 * Set up alignments for widgets at the bottom of ui,
731 * align bottom left, expand horizontally but not vertically
733 ui->bottomalign = gtk_alignment_new(0, 1, 1, 0);
734 ui->buttonbox = gtk_hbox_new(FALSE, 0);
735 gtk_container_add(GTK_CONTAINER(ui->bottomalign), ui->buttonbox);
736 gtk_box_pack_start(GTK_BOX(ui->vbox), ui->bottomalign,
739 add_buttons(ui, buttonspeclist, ARRAYSIZE(buttonspeclist));
742 * Set up thread status progress bar
744 ui->thread_status_pb = gtk_progress_bar_new();
745 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ui->thread_status_pb), 0.0);
746 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ui->thread_status_pb), "No jobs running");
747 gtk_container_add(GTK_CONTAINER(ui->buttonbox), ui->thread_status_pb);
750 gtk_widget_show_all(ui->window);
753 int main(int argc, char *argv[], char *envp[])
755 if (initialize_fio(envp))
757 if (fio_init_options())
761 init_ui(&argc, &argv, &ui);