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 },
73 GtkWidget *write_iops;
83 GtkWidget *bottomalign;
84 GtkWidget *thread_status_pb;
86 GtkWidget *button[ARRAYSIZE(buttonspeclist)];
87 GtkWidget *hostname_hbox;
88 GtkWidget *hostname_label;
89 GtkWidget *hostname_entry;
90 GtkWidget *port_button;
91 GtkWidget *port_label;
92 GtkWidget *hostname_combo_box; /* ipv4, ipv6 or socket */
93 GtkWidget *scrolled_window;
95 GtkWidget *error_info_bar;
96 GtkWidget *error_label;
98 struct probe_widget probe;
99 struct eta_widget eta;
103 struct fio_client *client;
108 static void gfio_set_connected(struct gui *ui, int connected)
111 gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 1);
113 gtk_button_set_label(GTK_BUTTON(ui->button[CONNECT_BUTTON]), "Disconnect");
116 gtk_button_set_label(GTK_BUTTON(ui->button[CONNECT_BUTTON]), "Connect");
117 gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 0);
121 static void gfio_text_op(struct fio_client *client,
122 FILE *f, __u16 pdu_len, const char *buf)
125 GtkTextBuffer *buffer;
128 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui.textview));
130 gtk_text_buffer_get_end_iter(buffer, &end);
131 gtk_text_buffer_insert(buffer, &end, buf, -1);
133 gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(ui.textview),
134 &end, 0.0, FALSE, 0.0,0.0);
136 fio_client_ops.text_op(client, f, pdu_len, buf);
140 static void gfio_disk_util_op(struct fio_client *client, struct fio_net_cmd *cmd)
142 printf("gfio_disk_util_op called\n");
143 fio_client_ops.disk_util(client, cmd);
146 static void gfio_thread_status_op(struct fio_net_cmd *cmd)
148 printf("gfio_thread_status_op called\n");
149 fio_client_ops.thread_status(cmd);
152 static void gfio_group_stats_op(struct fio_net_cmd *cmd)
154 printf("gfio_group_stats_op called\n");
155 fio_client_ops.group_stats(cmd);
158 static void gfio_update_eta(struct jobs_eta *je)
170 if (je->eta_sec != INT_MAX && je->elapsed_sec) {
171 perc = (double) je->elapsed_sec / (double) (je->elapsed_sec + je->eta_sec);
172 eta_to_str(eta_str, je->eta_sec);
175 sprintf(tmp, "%u", je->nr_running);
176 gtk_label_set_text(GTK_LABEL(ui.eta.jobs), tmp);
177 sprintf(tmp, "%u", je->files_open);
178 gtk_label_set_text(GTK_LABEL(ui.eta.files), tmp);
181 if (je->m_rate[0] || je->m_rate[1] || je->t_rate[0] || je->t_rate[1]) {
182 if (je->m_rate || je->t_rate) {
185 mr = num2str(je->m_rate, 4, 0, i2p);
186 tr = num2str(je->t_rate, 4, 0, i2p);
187 gtk_label_set_text(GTK_LABEL(ui.eta.
188 p += sprintf(p, ", CR=%s/%s KB/s", tr, mr);
191 } else if (je->m_iops || je->t_iops)
192 p += sprintf(p, ", CR=%d/%d IOPS", je->t_iops, je->m_iops);
194 gtk_label_set_text(GTK_LABEL(ui.eta.cr_bw), "---");
195 gtk_label_set_text(GTK_LABEL(ui.eta.cr_iops), "---");
196 gtk_label_set_text(GTK_LABEL(ui.eta.cw_bw), "---");
197 gtk_label_set_text(GTK_LABEL(ui.eta.cw_iops), "---");
200 if (je->eta_sec != INT_MAX && je->nr_running) {
204 if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running)
205 strcpy(output, "-.-% done");
209 sprintf(output, "%3.1f%% done", perc);
212 rate_str[0] = num2str(je->rate[0], 5, 10, i2p);
213 rate_str[1] = num2str(je->rate[1], 5, 10, i2p);
215 iops_str[0] = num2str(je->iops[0], 4, 1, 0);
216 iops_str[1] = num2str(je->iops[1], 4, 1, 0);
218 gtk_label_set_text(GTK_LABEL(ui.eta.read_bw), rate_str[0]);
219 gtk_label_set_text(GTK_LABEL(ui.eta.read_iops), iops_str[0]);
220 gtk_label_set_text(GTK_LABEL(ui.eta.write_bw), rate_str[1]);
221 gtk_label_set_text(GTK_LABEL(ui.eta.write_iops), iops_str[1]);
230 char *dst = output + strlen(output);
232 sprintf(dst, " - %s", eta_str);
235 gfio_update_thread_status(output, perc);
238 static void gfio_eta_op(struct fio_client *client, struct fio_net_cmd *cmd)
240 struct jobs_eta *je = (struct jobs_eta *) cmd->payload;
241 struct client_eta *eta = (struct client_eta *) (uintptr_t) cmd->tag;
243 client->eta_in_flight = NULL;
244 flist_del_init(&client->eta_list);
246 fio_client_convert_jobs_eta(je);
247 fio_client_sum_jobs_eta(&eta->eta, je);
248 fio_client_dec_jobs_eta(eta, gfio_update_eta);
251 static void gfio_probe_op(struct fio_client *client, struct fio_net_cmd *cmd)
253 struct cmd_probe_pdu *probe = (struct cmd_probe_pdu *) cmd->payload;
254 const char *os, *arch;
257 os = fio_get_os_string(probe->os);
261 arch = fio_get_arch_string(probe->arch);
266 client->name = strdup((char *) probe->hostname);
268 gtk_label_set_text(GTK_LABEL(ui.probe.hostname), (char *) probe->hostname);
269 gtk_label_set_text(GTK_LABEL(ui.probe.os), os);
270 gtk_label_set_text(GTK_LABEL(ui.probe.arch), arch);
271 sprintf(buf, "%u.%u.%u", probe->fio_major, probe->fio_minor, probe->fio_patch);
272 gtk_label_set_text(GTK_LABEL(ui.probe.fio_ver), buf);
275 static void gfio_update_thread_status(char *status_message, double perc)
277 static char message[100];
278 const char *m = message;
280 strncpy(message, status_message, sizeof(message) - 1);
281 gtk_progress_bar_set_text(
282 GTK_PROGRESS_BAR(ui.thread_status_pb), m);
283 gtk_progress_bar_set_fraction(
284 GTK_PROGRESS_BAR(ui.thread_status_pb), perc / 100.0);
286 gtk_widget_queue_draw(ui.window);
290 static void gfio_quit_op(struct fio_client *client)
292 struct gui *ui = client->client_data;
294 gfio_set_connected(ui, 0);
297 static void gfio_add_job_op(struct fio_client *client, struct fio_net_cmd *cmd)
299 struct cmd_add_job_pdu *p = (struct cmd_add_job_pdu *) cmd->payload;
300 struct gui *ui = client->client_data;
304 p->iodepth = le32_to_cpu(p->iodepth);
305 p->rw = le32_to_cpu(p->rw);
307 for (i = 0; i < 2; i++) {
308 p->min_bs[i] = le32_to_cpu(p->min_bs[i]);
309 p->max_bs[i] = le32_to_cpu(p->max_bs[i]);
312 p->numjobs = le32_to_cpu(p->numjobs);
313 p->group_reporting = le32_to_cpu(p->group_reporting);
315 gtk_label_set_text(GTK_LABEL(ui->eta.name), (gchar *) p->jobname);
316 gtk_label_set_text(GTK_LABEL(ui->eta.iotype), ddir_str(p->rw));
317 gtk_label_set_text(GTK_LABEL(ui->eta.ioengine), (gchar *) p->ioengine);
319 sprintf(tmp, "%u", p->iodepth);
320 gtk_label_set_text(GTK_LABEL(ui->eta.iodepth), tmp);
323 static void gfio_client_timed_out(struct fio_client *client)
325 struct gui *ui = client->client_data;
326 GtkWidget *dialog, *label, *content;
331 gfio_set_connected(ui, 0);
333 sprintf(buf, "Client %s: timeout talking to server.\n", client->hostname);
335 dialog = gtk_dialog_new_with_buttons("Timed out!",
336 GTK_WINDOW(ui->window),
337 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
338 GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
340 content = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
341 label = gtk_label_new((const gchar *) buf);
342 gtk_container_add(GTK_CONTAINER(content), label);
343 gtk_widget_show_all(dialog);
344 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
346 gtk_dialog_run(GTK_DIALOG(dialog));
347 gtk_widget_destroy(dialog);
352 struct client_ops gfio_client_ops = {
353 .text_op = gfio_text_op,
354 .disk_util = gfio_disk_util_op,
355 .thread_status = gfio_thread_status_op,
356 .group_stats = gfio_group_stats_op,
358 .probe = gfio_probe_op,
359 .quit = gfio_quit_op,
360 .add_job = gfio_add_job_op,
361 .timed_out = gfio_client_timed_out,
365 static void quit_clicked(__attribute__((unused)) GtkWidget *widget,
366 __attribute__((unused)) gpointer data)
371 static void *job_thread(void *arg)
373 fio_handle_clients(&gfio_client_ops);
377 static int send_job_files(struct gui *ui)
381 for (i = 0; i < ui->nr_job_files; i++) {
382 ret = fio_clients_send_ini(ui->job_files[i]);
386 free(ui->job_files[i]);
387 ui->job_files[i] = NULL;
389 while (i < ui->nr_job_files) {
390 free(ui->job_files[i]);
391 ui->job_files[i] = NULL;
398 static void start_job_thread(struct gui *ui)
400 if (send_job_files(ui)) {
401 printf("Yeah, I didn't really like those options too much.\n");
402 gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 1);
407 static void start_job_clicked(__attribute__((unused)) GtkWidget *widget,
410 struct gui *ui = data;
412 gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 0);
413 start_job_thread(ui);
416 static void connect_clicked(__attribute__((unused)) GtkWidget *widget,
419 struct gui *ui = data;
421 if (!ui->connected) {
422 fio_clients_connect();
423 pthread_create(&ui->t, NULL, job_thread, NULL);
424 gfio_set_connected(ui, 1);
426 gfio_set_connected(ui, 0);
429 static void add_button(struct gui *ui, int i, GtkWidget *buttonbox,
430 struct button_spec *buttonspec)
432 ui->button[i] = gtk_button_new_with_label(buttonspec->buttontext);
433 g_signal_connect(ui->button[i], "clicked", G_CALLBACK (buttonspec->f), ui);
434 gtk_box_pack_start(GTK_BOX (ui->buttonbox), ui->button[i], FALSE, FALSE, 3);
435 gtk_widget_set_tooltip_text(ui->button[i], buttonspeclist[i].tooltiptext);
436 gtk_widget_set_sensitive(ui->button[i], !buttonspec->start_insensitive);
439 static void add_buttons(struct gui *ui,
440 struct button_spec *buttonlist,
445 for (i = 0; i < nbuttons; i++)
446 add_button(ui, i, ui->buttonbox, &buttonlist[i]);
449 static void on_info_bar_response(GtkWidget *widget, gint response,
452 if (response == GTK_RESPONSE_OK) {
453 gtk_widget_destroy(widget);
454 ui.error_info_bar = NULL;
458 void report_error(GError* error)
460 if (ui.error_info_bar == NULL) {
461 ui.error_info_bar = gtk_info_bar_new_with_buttons(GTK_STOCK_OK,
464 g_signal_connect(ui.error_info_bar, "response", G_CALLBACK(on_info_bar_response), NULL);
465 gtk_info_bar_set_message_type(GTK_INFO_BAR(ui.error_info_bar),
468 ui.error_label = gtk_label_new(error->message);
469 GtkWidget *container = gtk_info_bar_get_content_area(GTK_INFO_BAR(ui.error_info_bar));
470 gtk_container_add(GTK_CONTAINER(container), ui.error_label);
472 gtk_box_pack_start(GTK_BOX(ui.vbox), ui.error_info_bar, FALSE, FALSE, 0);
473 gtk_widget_show_all(ui.vbox);
476 snprintf(buffer, sizeof(buffer), "Failed to open file.");
477 gtk_label_set(GTK_LABEL(ui.error_label), buffer);
481 static void file_open(GtkWidget *w, gpointer data)
484 GSList *filenames, *fn_glist;
485 GtkFileFilter *filter;
487 dialog = gtk_file_chooser_dialog_new("Open File",
488 GTK_WINDOW(ui.window),
489 GTK_FILE_CHOOSER_ACTION_OPEN,
490 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
491 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
493 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE);
495 filter = gtk_file_filter_new();
496 gtk_file_filter_add_pattern(filter, "*.fio");
497 gtk_file_filter_add_pattern(filter, "*.job");
498 gtk_file_filter_add_mime_type(filter, "text/fio");
499 gtk_file_filter_set_name(filter, "Fio job file");
500 gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
502 if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_ACCEPT) {
503 gtk_widget_destroy(dialog);
507 fn_glist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
508 filenames = fn_glist;
509 while (filenames != NULL) {
510 const char *hostname;
515 ui.job_files = realloc(ui.job_files, (ui.nr_job_files + 1) * sizeof(char *));
516 ui.job_files[ui.nr_job_files] = strdup(filenames->data);
519 hostname = gtk_entry_get_text(GTK_ENTRY(ui.hostname_entry));
520 port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ui.port_button));
521 typeentry = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(ui.hostname_combo_box));
522 if (!typeentry || !strncmp(typeentry, "IPv4", 4))
523 type = Fio_client_ipv4;
524 else if (!strncmp(typeentry, "IPv6", 4))
525 type = Fio_client_ipv6;
527 type = Fio_client_socket;
530 ui.client = fio_client_add_explicit(hostname, type, port);
531 ui.client->client_data = &ui;
540 g_free(filenames->data);
541 filenames = g_slist_next(filenames);
543 g_slist_free(fn_glist);
544 gtk_widget_destroy(dialog);
547 static void file_save(GtkWidget *w, gpointer data)
551 dialog = gtk_file_chooser_dialog_new("Save File",
552 GTK_WINDOW(ui.window),
553 GTK_FILE_CHOOSER_ACTION_SAVE,
554 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
555 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
558 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
559 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), "Untitled document");
561 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
564 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
565 // save_job_file(filename);
568 gtk_widget_destroy(dialog);
571 static void about_dialog(GtkWidget *w, gpointer data)
573 gtk_show_about_dialog(NULL,
574 "program-name", "gfio",
575 "comments", "Gtk2 UI for fio",
577 "version", fio_version_string,
578 "copyright", "Jens Axboe <axboe@kernel.dk> 2012",
579 "logo-icon-name", "fio",
585 static GtkActionEntry menu_items[] = {
586 { "FileMenuAction", GTK_STOCK_FILE, "File", NULL, NULL, NULL},
587 { "HelpMenuAction", GTK_STOCK_HELP, "Help", NULL, NULL, NULL},
588 { "OpenFile", GTK_STOCK_OPEN, NULL, "<Control>O", NULL, G_CALLBACK(file_open) },
589 { "SaveFile", GTK_STOCK_SAVE, NULL, "<Control>S", NULL, G_CALLBACK(file_save) },
590 { "Quit", GTK_STOCK_QUIT, NULL, "<Control>Q", NULL, G_CALLBACK(quit_clicked) },
591 { "About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(about_dialog) },
593 static gint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
595 static const gchar *ui_string = " \
597 <menubar name=\"MainMenu\"> \
598 <menu name=\"FileMenu\" action=\"FileMenuAction\"> \
599 <menuitem name=\"Open\" action=\"OpenFile\" /> \
600 <menuitem name=\"Save\" action=\"SaveFile\" /> \
601 <separator name=\"Separator\"/> \
602 <menuitem name=\"Quit\" action=\"Quit\" /> \
604 <menu name=\"Help\" action=\"HelpMenuAction\"> \
605 <menuitem name=\"About\" action=\"About\" /> \
611 static GtkWidget *get_menubar_menu(GtkWidget *window, GtkUIManager *ui_manager)
613 GtkActionGroup *action_group = gtk_action_group_new("Menu");
616 action_group = gtk_action_group_new("Menu");
617 gtk_action_group_add_actions(action_group, menu_items, nmenu_items, 0);
619 gtk_ui_manager_insert_action_group(ui_manager, action_group, 0);
620 gtk_ui_manager_add_ui_from_string(GTK_UI_MANAGER(ui_manager), ui_string, -1, &error);
622 gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(ui_manager));
623 return gtk_ui_manager_get_widget(ui_manager, "/MainMenu");
626 void gfio_ui_setup(GtkSettings *settings, GtkWidget *menubar,
627 GtkWidget *vbox, GtkUIManager *ui_manager)
629 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
632 static GtkWidget *new_info_label_in_frame(GtkWidget *box, const char *label)
634 GtkWidget *label_widget;
637 frame = gtk_frame_new(label);
638 label_widget = gtk_label_new(NULL);
639 gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 3);
640 gtk_container_add(GTK_CONTAINER(frame), label_widget);
645 static GtkWidget *create_text_entry(GtkWidget *hbox, GtkWidget *label, const char *defval)
647 GtkWidget *text, *box;
649 gtk_container_add(GTK_CONTAINER(hbox), label);
651 box = gtk_hbox_new(FALSE, 3);
652 gtk_container_add(GTK_CONTAINER(hbox), box);
654 text = gtk_entry_new();
655 gtk_box_pack_start(GTK_BOX(box), text, TRUE, TRUE, 0);
656 gtk_entry_set_text(GTK_ENTRY(text), "localhost");
661 static GtkWidget *create_spinbutton(GtkWidget *hbox, GtkWidget *label, double min, double max, double defval)
663 GtkWidget *button, *box;
665 gtk_container_add(GTK_CONTAINER(hbox), label);
667 box = gtk_hbox_new(FALSE, 3);
668 gtk_container_add(GTK_CONTAINER(hbox), box);
670 button = gtk_spin_button_new_with_range(min, max, 1.0);
671 gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
673 gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(button), GTK_UPDATE_IF_VALID);
674 gtk_spin_button_set_value(GTK_SPIN_BUTTON(button), defval);
679 static void init_ui(int *argc, char **argv[], struct gui *ui)
681 GtkSettings *settings;
682 GtkUIManager *uimanager;
683 GtkWidget *menu, *probe, *probe_frame, *probe_box;
685 memset(ui, 0, sizeof(*ui));
687 /* Magical g*thread incantation, you just need this thread stuff.
688 * Without it, the update that happens in gfio_update_thread_status
689 * doesn't really happen in a timely fashion, you need expose events
691 if (!g_thread_supported())
695 gtk_init(argc, argv);
696 settings = gtk_settings_get_default();
697 gtk_settings_set_long_property(settings, "gtk_tooltip_timeout", 10, "gfio setting");
700 ui->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
701 gtk_window_set_title(GTK_WINDOW(ui->window), "fio");
702 gtk_window_set_default_size(GTK_WINDOW(ui->window), 700, 500);
704 g_signal_connect(ui->window, "delete-event", G_CALLBACK(quit_clicked), NULL);
705 g_signal_connect(ui->window, "destroy", G_CALLBACK(quit_clicked), NULL);
707 ui->vbox = gtk_vbox_new(FALSE, 0);
708 gtk_container_add(GTK_CONTAINER (ui->window), ui->vbox);
710 uimanager = gtk_ui_manager_new();
711 menu = get_menubar_menu(ui->window, uimanager);
712 gfio_ui_setup(settings, menu, ui->vbox, uimanager);
715 * Set up alignments for widgets at the top of ui,
716 * align top left, expand horizontally but not vertically
718 ui->topalign = gtk_alignment_new(0, 0, 1, 0);
719 ui->topvbox = gtk_vbox_new(FALSE, 3);
720 gtk_container_add(GTK_CONTAINER(ui->topalign), ui->topvbox);
721 gtk_box_pack_start(GTK_BOX(ui->vbox), ui->topalign, FALSE, FALSE, 0);
724 * Set up hostname label + entry, port label + entry,
726 ui->hostname_hbox = gtk_hbox_new(FALSE, 0);
728 ui->hostname_label = gtk_label_new("Hostname:");
729 ui->hostname_entry = create_text_entry(ui->hostname_hbox, ui->hostname_label, "localhost");
731 ui->port_label = gtk_label_new("Port:");
732 ui->port_button = create_spinbutton(ui->hostname_hbox, ui->port_label, 1, 65535, FIO_NET_PORT);
735 * Set up combo box for address type
737 ui->hostname_combo_box = gtk_combo_box_text_new();
738 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ui->hostname_combo_box), "IPv4");
739 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ui->hostname_combo_box), "IPv6");
740 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ui->hostname_combo_box), "local socket");
741 gtk_combo_box_set_active(GTK_COMBO_BOX(ui->hostname_combo_box), 0);
743 gtk_container_add(GTK_CONTAINER(ui->hostname_hbox), ui->hostname_combo_box);
744 gtk_container_add(GTK_CONTAINER(ui->topvbox), ui->hostname_hbox);
746 probe = gtk_frame_new("Job");
747 gtk_box_pack_start(GTK_BOX(ui->topvbox), probe, TRUE, FALSE, 3);
748 probe_frame = gtk_vbox_new(FALSE, 3);
749 gtk_container_add(GTK_CONTAINER(probe), probe_frame);
751 probe_box = gtk_hbox_new(FALSE, 3);
752 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
753 ui->probe.hostname = new_info_label_in_frame(probe_box, "Host");
754 ui->probe.os = new_info_label_in_frame(probe_box, "OS");
755 ui->probe.arch = new_info_label_in_frame(probe_box, "Architecture");
756 ui->probe.fio_ver = new_info_label_in_frame(probe_box, "Fio version");
758 probe_box = gtk_hbox_new(FALSE, 3);
759 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
761 ui->eta.name = new_info_label_in_frame(probe_box, "Name");
762 ui->eta.iotype = new_info_label_in_frame(probe_box, "IO");
763 ui->eta.ioengine = new_info_label_in_frame(probe_box, "IO Engine");
764 ui->eta.iodepth = new_info_label_in_frame(probe_box, "IO Depth");
765 ui->eta.jobs = new_info_label_in_frame(probe_box, "Jobs");
766 ui->eta.files = new_info_label_in_frame(probe_box, "Open files");
768 probe_box = gtk_hbox_new(FALSE, 3);
769 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
770 ui->eta.read_bw = new_info_label_in_frame(probe_box, "Read BW");
771 ui->eta.read_iops = new_info_label_in_frame(probe_box, "IOPS");
772 ui->eta.write_bw = new_info_label_in_frame(probe_box, "Write BW");
773 ui->eta.write_iops = new_info_label_in_frame(probe_box, "IOPS");
776 * Only add this if we have a commit rate
779 probe_box = gtk_hbox_new(FALSE, 3);
780 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
782 ui->eta.cr_bw = new_info_label_in_frame(probe_box, "Commit BW");
783 ui->eta.cr_iops = new_info_label_in_frame(probe_box, "Commit IOPS");
785 ui->eta.cw_bw = new_info_label_in_frame(probe_box, "Commit BW");
786 ui->eta.cw_iops = new_info_label_in_frame(probe_box, "Commit IOPS");
790 * Add a text box for text op messages
792 ui->textview = gtk_text_view_new();
793 ui->text = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui->textview));
794 gtk_text_buffer_set_text(ui->text, "", -1);
795 gtk_text_view_set_editable(GTK_TEXT_VIEW(ui->textview), FALSE);
796 gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(ui->textview), FALSE);
797 ui->scrolled_window = gtk_scrolled_window_new(NULL, NULL);
798 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ui->scrolled_window),
799 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
800 gtk_container_add(GTK_CONTAINER(ui->scrolled_window), ui->textview);
801 gtk_box_pack_start(GTK_BOX(ui->vbox), ui->scrolled_window,
805 * Set up alignments for widgets at the bottom of ui,
806 * align bottom left, expand horizontally but not vertically
808 ui->bottomalign = gtk_alignment_new(0, 1, 1, 0);
809 ui->buttonbox = gtk_hbox_new(FALSE, 0);
810 gtk_container_add(GTK_CONTAINER(ui->bottomalign), ui->buttonbox);
811 gtk_box_pack_start(GTK_BOX(ui->vbox), ui->bottomalign,
814 add_buttons(ui, buttonspeclist, ARRAYSIZE(buttonspeclist));
817 * Set up thread status progress bar
819 ui->thread_status_pb = gtk_progress_bar_new();
820 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ui->thread_status_pb), 0.0);
821 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ui->thread_status_pb), "No jobs running");
822 gtk_container_add(GTK_CONTAINER(ui->buttonbox), ui->thread_status_pb);
825 gtk_widget_show_all(ui->window);
828 int main(int argc, char *argv[], char *envp[])
830 if (initialize_fio(envp))
832 if (fio_init_options())
836 init_ui(&argc, &argv, &ui);