X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=gclient.c;h=c59bcfe2f6f3c501bfedb0fa0de3140490f7b25f;hp=64324177ef1a8bb747346adf12f65a2e1a1de2b9;hb=HEAD;hpb=36833fb04b5f9a734e96a571dfb52fc54b5b95e7;ds=sidebyside diff --git a/gclient.c b/gclient.c index 64324177..73f64b3b 100644 --- a/gclient.c +++ b/gclient.c @@ -48,7 +48,7 @@ static GtkActionEntry results_menu_items[] = { { "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 = ARRAY_SIZE(results_menu_items); +static gint results_nmenu_items = FIO_ARRAY_SIZE(results_menu_items); static const gchar *results_ui_string = " \ \ @@ -292,7 +292,7 @@ static void gfio_thread_status_op(struct fio_client *client, if (sum_stat_clients == 1) return; - sum_thread_stats(&client_ts, &p->ts, sum_stat_nr == 1); + sum_thread_stats(&client_ts, &p->ts); sum_group_stats(&client_gs, &p->rs); client_ts.members++; @@ -330,7 +330,7 @@ static void gfio_update_thread_status_all(struct gui *ui, char *status_message, static char message[100]; const char *m = message; - strncpy(message, sizeof(message), "%s", status_message); + snprintf(message, sizeof(message), "%s", status_message); 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); @@ -553,12 +553,15 @@ static void gfio_quit_op(struct fio_client *client, struct fio_net_cmd *cmd) } static struct thread_options *gfio_client_add_job(struct gfio_client *gc, - struct thread_options_pack *top) + struct thread_options_pack *top, size_t top_sz) { struct gfio_client_options *gco; gco = calloc(1, sizeof(*gco)); - convert_thread_options_to_cpu(&gco->o, top); + if (convert_thread_options_to_cpu(&gco->o, top, top_sz)) { + dprint(FD_NET, "client: failed parsing add_job command\n"); + return NULL; + } INIT_FLIST_HEAD(&gco->list); flist_add_tail(&gco->list, &gc->o_list); gc->o_list_nr = 1; @@ -577,7 +580,10 @@ static void gfio_add_job_op(struct fio_client *client, struct fio_net_cmd *cmd) p->thread_number = le32_to_cpu(p->thread_number); p->groupid = le32_to_cpu(p->groupid); - o = gfio_client_add_job(gc, &p->top); + o = gfio_client_add_job(gc, &p->top, + cmd->pdu_len - offsetof(struct cmd_add_job_pdu, top)); + if (o == NULL) + return; gdk_threads_enter(); @@ -755,7 +761,7 @@ static void gfio_show_io_depths(GtkWidget *vbox, struct thread_stat *ts) GtkListStore *model; int i; const char *labels[] = { "Depth", "0", "1", "2", "4", "8", "16", "32", "64", ">= 64" }; - const int nr_labels = ARRAY_SIZE(labels); + const int nr_labels = FIO_ARRAY_SIZE(labels); GType types[nr_labels]; frame = gtk_frame_new("IO depths"); @@ -1097,10 +1103,9 @@ static struct graph *setup_clat_graph(char *title, unsigned long long *ovals, static void gfio_show_clat_percentiles(struct gfio_client *gc, GtkWidget *vbox, struct thread_stat *ts, - int ddir) + int ddir, uint64_t *io_u_plat, + unsigned long long nr, const char *type) { - uint64_t *io_u_plat = ts->io_u_plat[ddir]; - unsigned long long nr = ts->clat_stat[ddir].samples; fio_fp64_t *plist = ts->percentile_list; unsigned int len, scale_down; unsigned long long *ovals, minv, maxv; @@ -1128,10 +1133,7 @@ static void gfio_show_clat_percentiles(struct gfio_client *gc, base = "nsec"; } - if (ts->clat_percentiles) - sprintf(tmp, "Completion percentiles (%s)", base); - else - sprintf(tmp, "Latency percentiles (%s)", base); + sprintf(tmp, "%s latency percentiles (%s)", type, base); tree_view = gfio_output_clat_percentiles(ovals, plist, len, base, scale_down); ge->clat_graph = setup_clat_graph(tmp, ovals, plist, len, 700.0, 300.0); @@ -1285,8 +1287,21 @@ static void gfio_show_ddir_status(struct gfio_client *gc, GtkWidget *mbox, gfio_show_lat(vbox, "Total latency", min[2], max[2], mean[2], dev[2]); } - if (ts->clat_percentiles) - gfio_show_clat_percentiles(gc, main_vbox, ts, ddir); + if (ts->slat_percentiles && flags & GFIO_SLAT) + gfio_show_clat_percentiles(gc, main_vbox, ts, ddir, + ts->io_u_plat[FIO_SLAT][ddir], + ts->slat_stat[ddir].samples, + "Submission"); + if (ts->clat_percentiles && flags & GFIO_CLAT) + gfio_show_clat_percentiles(gc, main_vbox, ts, ddir, + ts->io_u_plat[FIO_CLAT][ddir], + ts->clat_stat[ddir].samples, + "Completion"); + if (ts->lat_percentiles && flags & GFIO_LAT) + gfio_show_clat_percentiles(gc, main_vbox, ts, ddir, + ts->io_u_plat[FIO_LAT][ddir], + ts->lat_stat[ddir].samples, + "Total"); free(io_p); free(bw_p);