X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=gclient.c;h=609586380da5e613a8d3745615847eeb8557a838;hb=5442cfb01f805ba26d3b8917b85c8e5f7bc50456;hp=ec12d70395ef58555897e529ecddc8cba9def052;hpb=cd0d2db8d4a8863bb48eca8bb197bd73d2f6c9a4;p=fio.git diff --git a/gclient.c b/gclient.c index ec12d703..60958638 100644 --- a/gclient.c +++ b/gclient.c @@ -12,6 +12,7 @@ #include "gerror.h" #include "graph.h" #include "gclient.h" +#include "printing.h" static void gfio_display_ts(struct fio_client *client, struct thread_stat *ts, struct group_run_stats *rs); @@ -33,9 +34,17 @@ static void results_close(GtkWidget *w, gpointer *data) gtk_widget_destroy(ge->results_window); } +static void results_print(GtkWidget *w, gpointer *data) +{ + struct gui_entry *ge = (struct gui_entry *) data; + + gfio_print_results(ge); +} + static GtkActionEntry results_menu_items[] = { { "FileMenuAction", GTK_STOCK_FILE, "File", NULL, NULL, NULL}, { "GraphMenuAction", GTK_STOCK_FILE, "Graph", NULL, NULL, NULL}, + { "PrintFile", GTK_STOCK_PRINT, "Print", "P", NULL, G_CALLBACK(results_print) }, { "CloseFile", GTK_STOCK_CLOSE, "Close", "W", NULL, G_CALLBACK(results_close) }, }; static gint results_nmenu_items = sizeof(results_menu_items) / sizeof(results_menu_items[0]); @@ -44,6 +53,7 @@ static const gchar *results_ui_string = " \ \ \ \ + \ \ \ \ @@ -122,7 +132,7 @@ static void gfio_text_op(struct fio_client *client, struct fio_net_cmd *cmd) 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, 2, log_get_level(p->level), -1); gtk_list_store_set(ui->log_model, &iter, 3, p->buf, -1); if (p->level == FIO_LOG_ERR) @@ -378,8 +388,9 @@ static void gfio_update_client_eta(struct fio_client *client, struct jobs_eta *j #endif if (je->eta_sec != INT_MAX && je->nr_running) { - char *iops_str[2]; - char *rate_str[2]; + char *iops_str[DDIR_RWDIR_CNT]; + char *rate_str[DDIR_RWDIR_CNT]; + int i; if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running) strcpy(output, "-.-% done"); @@ -391,24 +402,30 @@ static void gfio_update_client_eta(struct fio_client *client, struct jobs_eta *j rate_str[0] = num2str(je->rate[0], 5, 10, i2p); rate_str[1] = num2str(je->rate[1], 5, 10, i2p); + rate_str[2] = num2str(je->rate[2], 5, 10, i2p); iops_str[0] = num2str(je->iops[0], 4, 1, 0); iops_str[1] = num2str(je->iops[1], 4, 1, 0); + iops_str[2] = num2str(je->iops[2], 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]); + gtk_entry_set_text(GTK_ENTRY(ge->eta.trim_bw), rate_str[2]); + gtk_entry_set_text(GTK_ENTRY(ge->eta.trim_iops), iops_str[2]); graph_add_xy_data(ge->graphs.iops_graph, ge->graphs.read_iops, je->elapsed_sec, je->iops[0], iops_str[0]); graph_add_xy_data(ge->graphs.iops_graph, ge->graphs.write_iops, je->elapsed_sec, je->iops[1], iops_str[1]); + graph_add_xy_data(ge->graphs.iops_graph, ge->graphs.trim_iops, je->elapsed_sec, je->iops[2], iops_str[2]); graph_add_xy_data(ge->graphs.bandwidth_graph, ge->graphs.read_bw, je->elapsed_sec, je->rate[0], rate_str[0]); graph_add_xy_data(ge->graphs.bandwidth_graph, ge->graphs.write_bw, je->elapsed_sec, je->rate[1], rate_str[1]); + graph_add_xy_data(ge->graphs.bandwidth_graph, ge->graphs.trim_bw, je->elapsed_sec, je->rate[2], rate_str[2]); - free(rate_str[0]); - free(rate_str[1]); - free(iops_str[0]); - free(iops_str[1]); + for (i = 0; i < DDIR_RWDIR_CNT; i++) { + free(rate_str[i]); + free(iops_str[i]); + } } if (eta_str[0]) { @@ -416,7 +433,7 @@ static void gfio_update_client_eta(struct fio_client *client, struct jobs_eta *j sprintf(dst, " - %s", eta_str); } - + gfio_update_thread_status(ge, output, perc); gdk_threads_leave(); } @@ -504,7 +521,7 @@ static void gfio_update_all_eta(struct jobs_eta *je) sprintf(dst, " - %s", eta_str); } - + gfio_update_thread_status_all(ui, output, perc); gdk_threads_leave(); } @@ -515,7 +532,6 @@ static void gfio_probe_op(struct fio_client *client, struct fio_net_cmd *cmd) 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) @@ -528,13 +544,15 @@ static void gfio_probe_op(struct fio_client *client, struct fio_net_cmd *cmd) if (!client->name) client->name = strdup((char *) probe->hostname); + gc->client_cpus = le32_to_cpu(probe->cpus); + gc->client_flags = le64_to_cpu(probe->flags); + 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); + gtk_label_set_text(GTK_LABEL(ge->probe.fio_ver), (char *) probe->fio_version); gfio_set_state(ge, GE_STATE_CONNECTED); @@ -610,6 +628,16 @@ static void gfio_add_job_op(struct fio_client *client, struct fio_net_cmd *cmd) gdk_threads_leave(); } +static void gfio_update_job_op(struct fio_client *client, + struct fio_net_cmd *cmd) +{ + uint32_t *pdu_error = (uint32_t *) cmd->payload; + struct gfio_client *gc = client->client_data; + + gc->update_job_status = le32_to_cpu(*pdu_error); + gc->update_job_done = 1; +} + static void gfio_client_timed_out(struct fio_client *client) { struct gfio_client *gc = client->client_data; @@ -673,7 +701,7 @@ static void gfio_add_total_depths_tree(GtkListStore *model, const int add_mask = 0x17e; int i, j; - stat_calc_dist(ts->io_u_map, ts_total_io_u(ts), io_u_dist); + stat_calc_dist(ts->io_u_map, ddir_rw_sum(ts->total_io_u), io_u_dist); gtk_list_store_append(model, &iter); @@ -953,7 +981,7 @@ static void gfio_show_latency_buckets(struct gfio_client *gc, GtkWidget *vbox, */ if (start == -1U) return; - + tree_view = gfio_output_lat_buckets(&io_u_lat[start], &ranges[start], end - start + 1); ge->lat_bucket_graph = setup_lat_bucket_graph("Latency Buckets", &io_u_lat[start], &ranges[start], end - start + 1, 700.0, 300.0); @@ -969,8 +997,8 @@ static void gfio_show_latency_buckets(struct gfio_client *gc, GtkWidget *vbox, gtk_widget_set_size_request(GTK_WIDGET(drawing_area), 700, 300); gtk_widget_modify_bg(drawing_area, GTK_STATE_NORMAL, &gfio_color_white); gtk_container_add(GTK_CONTAINER(completion_vbox), drawing_area); - g_signal_connect(G_OBJECT(drawing_area), "expose_event", G_CALLBACK(on_expose_lat_drawing_area), ge->lat_bucket_graph); - g_signal_connect(G_OBJECT(drawing_area), "configure_event", G_CALLBACK(on_config_lat_drawing_area), ge->lat_bucket_graph); + g_signal_connect(G_OBJECT(drawing_area), GFIO_DRAW_EVENT, G_CALLBACK(on_expose_lat_drawing_area), ge->lat_bucket_graph); + g_signal_connect(G_OBJECT(drawing_area), "configure_event", G_CALLBACK(on_config_lat_drawing_area), ge->lat_bucket_graph); gtk_box_pack_start(GTK_BOX(hbox), tree_view, TRUE, TRUE, 3); } @@ -1125,7 +1153,7 @@ static void gfio_show_clat_percentiles(struct gfio_client *gc, gtk_widget_set_size_request(GTK_WIDGET(drawing_area), 700, 300); gtk_widget_modify_bg(drawing_area, GTK_STATE_NORMAL, &gfio_color_white); gtk_container_add(GTK_CONTAINER(completion_vbox), drawing_area); - g_signal_connect(G_OBJECT(drawing_area), "expose_event", G_CALLBACK(on_expose_lat_drawing_area), ge->clat_graph); + g_signal_connect(G_OBJECT(drawing_area), GFIO_DRAW_EVENT, G_CALLBACK(on_expose_lat_drawing_area), ge->clat_graph); g_signal_connect(G_OBJECT(drawing_area), "configure_event", G_CALLBACK(on_config_lat_drawing_area), ge->clat_graph); gtk_box_pack_start(GTK_BOX(hbox), tree_view, TRUE, TRUE, 3); @@ -1353,6 +1381,7 @@ struct client_ops gfio_client_ops = { .probe = gfio_probe_op, .quit = gfio_quit_op, .add_job = gfio_add_job_op, + .update_job = gfio_update_job_op, .timed_out = gfio_client_timed_out, .stop = gfio_client_stop, .start = gfio_client_start,