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 struct client_ops gfio_client_ops = {
324 .text_op = gfio_text_op,
325 .disk_util = gfio_disk_util_op,
326 .thread_status = gfio_thread_status_op,
327 .group_stats = gfio_group_stats_op,
329 .probe = gfio_probe_op,
330 .quit = gfio_quit_op,
331 .add_job = gfio_add_job_op,
335 static void quit_clicked(__attribute__((unused)) GtkWidget *widget,
336 __attribute__((unused)) gpointer data)
341 static void *job_thread(void *arg)
343 printf("job thread starts\n");
344 fio_handle_clients(&gfio_client_ops);
345 printf("job thread exits\n");
349 static int send_job_files(struct gui *ui)
353 for (i = 0; i < ui->nr_job_files; i++) {
354 ret = fio_clients_send_ini(ui->job_files[i]);
358 free(ui->job_files[i]);
359 ui->job_files[i] = NULL;
361 while (i < ui->nr_job_files) {
362 free(ui->job_files[i]);
363 ui->job_files[i] = NULL;
370 static void start_job_thread(struct gui *ui)
372 if (send_job_files(ui)) {
373 printf("Yeah, I didn't really like those options too much.\n");
374 gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 1);
379 static void start_job_clicked(__attribute__((unused)) GtkWidget *widget,
382 struct gui *ui = data;
384 gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 0);
385 start_job_thread(ui);
388 static void connect_clicked(__attribute__((unused)) GtkWidget *widget,
391 struct gui *ui = data;
393 if (!ui->connected) {
394 fio_clients_connect();
395 pthread_create(&ui->t, NULL, job_thread, NULL);
396 gfio_set_connected(ui, 1);
398 gfio_set_connected(ui, 0);
401 static void add_button(struct gui *ui, int i, GtkWidget *buttonbox,
402 struct button_spec *buttonspec)
404 ui->button[i] = gtk_button_new_with_label(buttonspec->buttontext);
405 g_signal_connect(ui->button[i], "clicked", G_CALLBACK (buttonspec->f), ui);
406 gtk_box_pack_start(GTK_BOX (ui->buttonbox), ui->button[i], FALSE, FALSE, 3);
407 gtk_widget_set_tooltip_text(ui->button[i], buttonspeclist[i].tooltiptext);
408 gtk_widget_set_sensitive(ui->button[i], !buttonspec->start_insensitive);
411 static void add_buttons(struct gui *ui,
412 struct button_spec *buttonlist,
417 for (i = 0; i < nbuttons; i++)
418 add_button(ui, i, ui->buttonbox, &buttonlist[i]);
421 static void on_info_bar_response(GtkWidget *widget, gint response,
424 if (response == GTK_RESPONSE_OK) {
425 gtk_widget_destroy(widget);
426 ui.error_info_bar = NULL;
430 void report_error(GError* error)
432 if (ui.error_info_bar == NULL) {
433 ui.error_info_bar = gtk_info_bar_new_with_buttons(GTK_STOCK_OK,
436 g_signal_connect(ui.error_info_bar, "response", G_CALLBACK(on_info_bar_response), NULL);
437 gtk_info_bar_set_message_type(GTK_INFO_BAR(ui.error_info_bar),
440 ui.error_label = gtk_label_new(error->message);
441 GtkWidget *container = gtk_info_bar_get_content_area(GTK_INFO_BAR(ui.error_info_bar));
442 gtk_container_add(GTK_CONTAINER(container), ui.error_label);
444 gtk_box_pack_start(GTK_BOX(ui.vbox), ui.error_info_bar, FALSE, FALSE, 0);
445 gtk_widget_show_all(ui.vbox);
448 snprintf(buffer, sizeof(buffer), "Failed to open file.");
449 gtk_label_set(GTK_LABEL(ui.error_label), buffer);
453 static void file_open(GtkWidget *w, gpointer data)
456 GSList *filenames, *fn_glist;
457 GtkFileFilter *filter;
459 dialog = gtk_file_chooser_dialog_new("Open File",
460 GTK_WINDOW(ui.window),
461 GTK_FILE_CHOOSER_ACTION_OPEN,
462 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
463 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
465 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE);
467 filter = gtk_file_filter_new();
468 gtk_file_filter_add_pattern(filter, "*.fio");
469 gtk_file_filter_add_pattern(filter, "*.job");
470 gtk_file_filter_add_mime_type(filter, "text/fio");
471 gtk_file_filter_set_name(filter, "Fio job file");
472 gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
474 if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_ACCEPT) {
475 gtk_widget_destroy(dialog);
479 fn_glist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
480 filenames = fn_glist;
481 while (filenames != NULL) {
482 const char *hostname;
487 ui.job_files = realloc(ui.job_files, (ui.nr_job_files + 1) * sizeof(char *));
488 ui.job_files[ui.nr_job_files] = strdup(filenames->data);
491 hostname = gtk_entry_get_text(GTK_ENTRY(ui.hostname_entry));
492 port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ui.port_button));
493 typeentry = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(ui.hostname_combo_box));
494 if (!typeentry || !strncmp(typeentry, "IPv4", 4))
495 type = Fio_client_ipv4;
496 else if (!strncmp(typeentry, "IPv6", 4))
497 type = Fio_client_ipv6;
499 type = Fio_client_socket;
502 ui.client = fio_client_add_explicit(hostname, type, port);
503 ui.client->client_data = &ui;
512 g_free(filenames->data);
513 filenames = g_slist_next(filenames);
515 g_slist_free(fn_glist);
516 gtk_widget_destroy(dialog);
519 static void file_save(GtkWidget *w, gpointer data)
523 dialog = gtk_file_chooser_dialog_new("Save File",
524 GTK_WINDOW(ui.window),
525 GTK_FILE_CHOOSER_ACTION_SAVE,
526 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
527 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
530 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
531 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), "Untitled document");
533 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
536 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
537 // save_job_file(filename);
540 gtk_widget_destroy(dialog);
543 static void about_dialog(GtkWidget *w, gpointer data)
545 gtk_show_about_dialog(NULL,
546 "program-name", "gfio",
547 "comments", "Gtk2 UI for fio",
549 "version", fio_version_string,
550 "copyright", "Jens Axboe <axboe@kernel.dk> 2012",
551 "logo-icon-name", "fio",
557 static GtkActionEntry menu_items[] = {
558 { "FileMenuAction", GTK_STOCK_FILE, "File", NULL, NULL, NULL},
559 { "HelpMenuAction", GTK_STOCK_HELP, "Help", NULL, NULL, NULL},
560 { "OpenFile", GTK_STOCK_OPEN, NULL, "<Control>O", NULL, G_CALLBACK(file_open) },
561 { "SaveFile", GTK_STOCK_SAVE, NULL, "<Control>S", NULL, G_CALLBACK(file_save) },
562 { "Quit", GTK_STOCK_QUIT, NULL, "<Control>Q", NULL, G_CALLBACK(quit_clicked) },
563 { "About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(about_dialog) },
565 static gint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
567 static const gchar *ui_string = " \
569 <menubar name=\"MainMenu\"> \
570 <menu name=\"FileMenu\" action=\"FileMenuAction\"> \
571 <menuitem name=\"Open\" action=\"OpenFile\" /> \
572 <menuitem name=\"Save\" action=\"SaveFile\" /> \
573 <separator name=\"Separator\"/> \
574 <menuitem name=\"Quit\" action=\"Quit\" /> \
576 <menu name=\"Help\" action=\"HelpMenuAction\"> \
577 <menuitem name=\"About\" action=\"About\" /> \
583 static GtkWidget *get_menubar_menu(GtkWidget *window, GtkUIManager *ui_manager)
585 GtkActionGroup *action_group = gtk_action_group_new("Menu");
588 action_group = gtk_action_group_new("Menu");
589 gtk_action_group_add_actions(action_group, menu_items, nmenu_items, 0);
591 gtk_ui_manager_insert_action_group(ui_manager, action_group, 0);
592 gtk_ui_manager_add_ui_from_string(GTK_UI_MANAGER(ui_manager), ui_string, -1, &error);
594 gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(ui_manager));
595 return gtk_ui_manager_get_widget(ui_manager, "/MainMenu");
598 void gfio_ui_setup(GtkSettings *settings, GtkWidget *menubar,
599 GtkWidget *vbox, GtkUIManager *ui_manager)
601 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
604 static GtkWidget *new_info_label_in_frame(GtkWidget *box, const char *label)
606 GtkWidget *label_widget;
609 frame = gtk_frame_new(label);
610 label_widget = gtk_label_new(NULL);
611 gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 3);
612 gtk_container_add(GTK_CONTAINER(frame), label_widget);
617 static GtkWidget *create_text_entry(GtkWidget *hbox, GtkWidget *label, const char *defval)
619 GtkWidget *text, *box;
621 gtk_container_add(GTK_CONTAINER(hbox), label);
623 box = gtk_hbox_new(FALSE, 3);
624 gtk_container_add(GTK_CONTAINER(hbox), box);
626 text = gtk_entry_new();
627 gtk_box_pack_start(GTK_BOX(box), text, TRUE, TRUE, 0);
628 gtk_entry_set_text(GTK_ENTRY(text), "localhost");
633 static GtkWidget *create_spinbutton(GtkWidget *hbox, GtkWidget *label, double min, double max, double defval)
635 GtkWidget *button, *box;
637 gtk_container_add(GTK_CONTAINER(hbox), label);
639 box = gtk_hbox_new(FALSE, 3);
640 gtk_container_add(GTK_CONTAINER(hbox), box);
642 button = gtk_spin_button_new_with_range(min, max, 1.0);
643 gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
645 gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(button), GTK_UPDATE_IF_VALID);
646 gtk_spin_button_set_value(GTK_SPIN_BUTTON(button), defval);
651 static void init_ui(int *argc, char **argv[], struct gui *ui)
653 GtkSettings *settings;
654 GtkUIManager *uimanager;
655 GtkWidget *menu, *probe, *probe_frame, *probe_box;
657 memset(ui, 0, sizeof(*ui));
659 /* Magical g*thread incantation, you just need this thread stuff.
660 * Without it, the update that happens in gfio_update_thread_status
661 * doesn't really happen in a timely fashion, you need expose events
663 if (!g_thread_supported ())
667 gtk_init(argc, argv);
668 settings = gtk_settings_get_default();
669 gtk_settings_set_long_property(settings, "gtk_tooltip_timeout", 10, "gfio setting");
672 ui->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
673 gtk_window_set_title(GTK_WINDOW(ui->window), "fio");
674 gtk_window_set_default_size(GTK_WINDOW(ui->window), 700, 500);
676 g_signal_connect(ui->window, "delete-event", G_CALLBACK(quit_clicked), NULL);
677 g_signal_connect(ui->window, "destroy", G_CALLBACK(quit_clicked), NULL);
679 ui->vbox = gtk_vbox_new(FALSE, 0);
680 gtk_container_add(GTK_CONTAINER (ui->window), ui->vbox);
682 uimanager = gtk_ui_manager_new();
683 menu = get_menubar_menu(ui->window, uimanager);
684 gfio_ui_setup(settings, menu, ui->vbox, uimanager);
687 * Set up alignments for widgets at the top of ui,
688 * align top left, expand horizontally but not vertically
690 ui->topalign = gtk_alignment_new(0, 0, 1, 0);
691 ui->topvbox = gtk_vbox_new(FALSE, 3);
692 gtk_container_add(GTK_CONTAINER(ui->topalign), ui->topvbox);
693 gtk_box_pack_start(GTK_BOX(ui->vbox), ui->topalign, FALSE, FALSE, 0);
696 * Set up hostname label + entry, port label + entry,
698 ui->hostname_hbox = gtk_hbox_new(FALSE, 0);
700 ui->hostname_label = gtk_label_new("Hostname:");
701 ui->hostname_entry = create_text_entry(ui->hostname_hbox, ui->hostname_label, "localhost");
703 ui->port_label = gtk_label_new("Port:");
704 ui->port_button = create_spinbutton(ui->hostname_hbox, ui->port_label, 1, 65535, FIO_NET_PORT);
707 * Set up combo box for address type
709 ui->hostname_combo_box = gtk_combo_box_text_new();
710 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ui->hostname_combo_box), "IPv4");
711 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ui->hostname_combo_box), "IPv6");
712 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ui->hostname_combo_box), "local socket");
713 gtk_combo_box_set_active(GTK_COMBO_BOX(ui->hostname_combo_box), 0);
715 gtk_container_add(GTK_CONTAINER(ui->hostname_hbox), ui->hostname_combo_box);
716 gtk_container_add(GTK_CONTAINER(ui->topvbox), ui->hostname_hbox);
718 probe = gtk_frame_new("Job");
719 gtk_box_pack_start(GTK_BOX(ui->topvbox), probe, TRUE, FALSE, 3);
720 probe_frame = gtk_vbox_new(FALSE, 3);
721 gtk_container_add(GTK_CONTAINER(probe), probe_frame);
723 probe_box = gtk_hbox_new(FALSE, 3);
724 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
725 ui->probe.hostname = new_info_label_in_frame(probe_box, "Host");
726 ui->probe.os = new_info_label_in_frame(probe_box, "OS");
727 ui->probe.arch = new_info_label_in_frame(probe_box, "Architecture");
728 ui->probe.fio_ver = new_info_label_in_frame(probe_box, "Fio version");
730 probe_box = gtk_hbox_new(FALSE, 3);
731 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
733 ui->eta.name = new_info_label_in_frame(probe_box, "Name");
734 ui->eta.iotype = new_info_label_in_frame(probe_box, "IO");
735 ui->eta.ioengine = new_info_label_in_frame(probe_box, "IO Engine");
736 ui->eta.iodepth = new_info_label_in_frame(probe_box, "IO Depth");
737 ui->eta.jobs = new_info_label_in_frame(probe_box, "Jobs");
738 ui->eta.files = new_info_label_in_frame(probe_box, "Open files");
740 probe_box = gtk_hbox_new(FALSE, 3);
741 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
742 ui->eta.read_bw = new_info_label_in_frame(probe_box, "Read BW");
743 ui->eta.read_iops = new_info_label_in_frame(probe_box, "IOPS");
744 ui->eta.write_bw = new_info_label_in_frame(probe_box, "Write BW");
745 ui->eta.write_iops = new_info_label_in_frame(probe_box, "IOPS");
748 * Only add this if we have a commit rate
751 probe_box = gtk_hbox_new(FALSE, 3);
752 gtk_box_pack_start(GTK_BOX(probe_frame), probe_box, TRUE, FALSE, 3);
754 ui->eta.cr_bw = new_info_label_in_frame(probe_box, "Commit BW");
755 ui->eta.cr_iops = new_info_label_in_frame(probe_box, "Commit IOPS");
757 ui->eta.cw_bw = new_info_label_in_frame(probe_box, "Commit BW");
758 ui->eta.cw_iops = new_info_label_in_frame(probe_box, "Commit IOPS");
762 * Add a text box for text op messages
764 ui->textview = gtk_text_view_new();
765 ui->text = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui->textview));
766 gtk_text_buffer_set_text(ui->text, "", -1);
767 gtk_text_view_set_editable(GTK_TEXT_VIEW(ui->textview), FALSE);
768 gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(ui->textview), FALSE);
769 ui->scrolled_window = gtk_scrolled_window_new(NULL, NULL);
770 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ui->scrolled_window),
771 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
772 gtk_container_add(GTK_CONTAINER(ui->scrolled_window), ui->textview);
773 gtk_box_pack_start(GTK_BOX(ui->vbox), ui->scrolled_window,
777 * Set up alignments for widgets at the bottom of ui,
778 * align bottom left, expand horizontally but not vertically
780 ui->bottomalign = gtk_alignment_new(0, 1, 1, 0);
781 ui->buttonbox = gtk_hbox_new(FALSE, 0);
782 gtk_container_add(GTK_CONTAINER(ui->bottomalign), ui->buttonbox);
783 gtk_box_pack_start(GTK_BOX(ui->vbox), ui->bottomalign,
786 add_buttons(ui, buttonspeclist, ARRAYSIZE(buttonspeclist));
789 * Set up thread status progress bar
791 ui->thread_status_pb = gtk_progress_bar_new();
792 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ui->thread_status_pb), 0.0);
793 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ui->thread_status_pb), "No jobs running");
794 gtk_container_add(GTK_CONTAINER(ui->buttonbox), ui->thread_status_pb);
797 gtk_widget_show_all(ui->window);
800 int main(int argc, char *argv[], char *envp[])
802 if (initialize_fio(envp))
804 if (fio_init_options())
808 init_ui(&argc, &argv, &ui);