X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=gclient.c;h=d7d9616e4ef00d297055032fa6e600c3f28247d2;hp=4955ad4717bfceb6cfff76c81d2cb808210b34a6;hb=188ee5700edeeec87fbf67b1b9948685c776fd0f;hpb=40c605169e60d32fc321a2f9f465e76cba745489 diff --git a/gclient.c b/gclient.c index 4955ad47..d7d9616e 100644 --- a/gclient.c +++ b/gclient.c @@ -13,6 +13,7 @@ #include "graph.h" #include "gclient.h" #include "printing.h" +#include "lib/pow2.h" static void gfio_display_ts(struct fio_client *client, struct thread_stat *ts, struct group_run_stats *rs); @@ -195,39 +196,39 @@ static int __gfio_disk_util_show(GtkWidget *res_notebook, vbox = gtk_hbox_new(TRUE, 3); gtk_container_add(GTK_CONTAINER(frame), vbox); entry = new_info_entry_in_frame(vbox, "IOs"); - entry_set_int_value(entry, p->dus.ios[0]); + entry_set_int_value(entry, p->dus.s.ios[0]); entry = new_info_entry_in_frame(vbox, "Merges"); - entry_set_int_value(entry, p->dus.merges[0]); + entry_set_int_value(entry, p->dus.s.merges[0]); entry = new_info_entry_in_frame(vbox, "Sectors"); - entry_set_int_value(entry, p->dus.sectors[0]); + entry_set_int_value(entry, p->dus.s.sectors[0]); entry = new_info_entry_in_frame(vbox, "Ticks"); - entry_set_int_value(entry, p->dus.ticks[0]); + entry_set_int_value(entry, p->dus.s.ticks[0]); frame = gtk_frame_new("Write"); gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 2); vbox = gtk_hbox_new(TRUE, 3); gtk_container_add(GTK_CONTAINER(frame), vbox); entry = new_info_entry_in_frame(vbox, "IOs"); - entry_set_int_value(entry, p->dus.ios[1]); + entry_set_int_value(entry, p->dus.s.ios[1]); entry = new_info_entry_in_frame(vbox, "Merges"); - entry_set_int_value(entry, p->dus.merges[1]); + entry_set_int_value(entry, p->dus.s.merges[1]); entry = new_info_entry_in_frame(vbox, "Sectors"); - entry_set_int_value(entry, p->dus.sectors[1]); + entry_set_int_value(entry, p->dus.s.sectors[1]); entry = new_info_entry_in_frame(vbox, "Ticks"); - entry_set_int_value(entry, p->dus.ticks[1]); + entry_set_int_value(entry, p->dus.s.ticks[1]); frame = gtk_frame_new("Shared"); gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 2); vbox = gtk_hbox_new(TRUE, 3); gtk_container_add(GTK_CONTAINER(frame), vbox); entry = new_info_entry_in_frame(vbox, "IO ticks"); - entry_set_int_value(entry, p->dus.io_ticks); + entry_set_int_value(entry, p->dus.s.io_ticks); entry = new_info_entry_in_frame(vbox, "Time in queue"); - entry_set_int_value(entry, p->dus.time_in_queue); + entry_set_int_value(entry, p->dus.s.time_in_queue); util = 0.0; - if (p->dus.msec) - util = (double) 100 * p->dus.io_ticks / (double) p->dus.msec; + if (p->dus.s.msec) + util = (double) 100 * p->dus.s.io_ticks / (double) p->dus.s.msec; if (util > 100.0) util = 100.0; @@ -388,8 +389,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"); @@ -399,26 +401,32 @@ static void gfio_update_client_eta(struct fio_client *client, struct jobs_eta *j sprintf(output, "%3.1f%% done", perc); } - rate_str[0] = num2str(je->rate[0], 5, 10, i2p); - rate_str[1] = num2str(je->rate[1], 5, 10, i2p); + rate_str[0] = num2str(je->rate[0], 5, 10, i2p, 0); + rate_str[1] = num2str(je->rate[1], 5, 10, i2p, 0); + rate_str[2] = num2str(je->rate[2], 5, 10, i2p, 0); - iops_str[0] = num2str(je->iops[0], 4, 1, 0); - iops_str[1] = num2str(je->iops[1], 4, 1, 0); + iops_str[0] = num2str(je->iops[0], 4, 1, 0, 0); + iops_str[1] = num2str(je->iops[1], 4, 1, 0, 0); + iops_str[2] = num2str(je->iops[2], 4, 1, 0, 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]) { @@ -441,7 +449,7 @@ static void gfio_update_all_eta(struct jobs_eta *je) char eta_str[128]; char output[256]; double perc = 0.0; - int i2p = 0; + int i, i2p = 0; gdk_threads_enter(); @@ -476,8 +484,8 @@ static void gfio_update_all_eta(struct jobs_eta *je) entry_set_int_value(ui->eta.jobs, je->nr_running); if (je->eta_sec != INT_MAX && je->nr_running) { - char *iops_str[2]; - char *rate_str[2]; + char *iops_str[3]; + char *rate_str[3]; if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running) strcpy(output, "-.-% done"); @@ -487,26 +495,32 @@ static void gfio_update_all_eta(struct jobs_eta *je) sprintf(output, "%3.1f%% done", perc); } - rate_str[0] = num2str(je->rate[0], 5, 10, i2p); - rate_str[1] = num2str(je->rate[1], 5, 10, i2p); + rate_str[0] = num2str(je->rate[0], 5, 10, i2p, 0); + rate_str[1] = num2str(je->rate[1], 5, 10, i2p, 0); + rate_str[2] = num2str(je->rate[2], 5, 10, i2p, 0); - iops_str[0] = num2str(je->iops[0], 4, 1, 0); - iops_str[1] = num2str(je->iops[1], 4, 1, 0); + iops_str[0] = num2str(je->iops[0], 4, 1, 0, 0); + iops_str[1] = num2str(je->iops[1], 4, 1, 0, 0); + iops_str[2] = num2str(je->iops[2], 4, 1, 0, 0); gtk_entry_set_text(GTK_ENTRY(ui->eta.read_bw), rate_str[0]); gtk_entry_set_text(GTK_ENTRY(ui->eta.read_iops), iops_str[0]); gtk_entry_set_text(GTK_ENTRY(ui->eta.write_bw), rate_str[1]); gtk_entry_set_text(GTK_ENTRY(ui->eta.write_iops), iops_str[1]); + gtk_entry_set_text(GTK_ENTRY(ui->eta.trim_bw), rate_str[2]); + gtk_entry_set_text(GTK_ENTRY(ui->eta.trim_iops), iops_str[2]); graph_add_xy_data(ui->graphs.iops_graph, ui->graphs.read_iops, je->elapsed_sec, je->iops[0], iops_str[0]); graph_add_xy_data(ui->graphs.iops_graph, ui->graphs.write_iops, je->elapsed_sec, je->iops[1], iops_str[1]); + graph_add_xy_data(ui->graphs.iops_graph, ui->graphs.trim_iops, je->elapsed_sec, je->iops[2], iops_str[2]); graph_add_xy_data(ui->graphs.bandwidth_graph, ui->graphs.read_bw, je->elapsed_sec, je->rate[0], rate_str[0]); graph_add_xy_data(ui->graphs.bandwidth_graph, ui->graphs.write_bw, je->elapsed_sec, je->rate[1], rate_str[1]); + graph_add_xy_data(ui->graphs.bandwidth_graph, ui->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]) { @@ -521,11 +535,10 @@ static void gfio_update_all_eta(struct jobs_eta *je) static void gfio_probe_op(struct fio_client *client, struct fio_net_cmd *cmd) { - struct cmd_probe_pdu *probe = (struct cmd_probe_pdu *) cmd->payload; + struct cmd_probe_reply_pdu *probe = (struct cmd_probe_reply_pdu *) cmd->payload; 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) @@ -538,13 +551,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); @@ -626,7 +641,8 @@ static void gfio_update_job_op(struct fio_client *client, uint32_t *pdu_error = (uint32_t *) cmd->payload; struct gfio_client *gc = client->client_data; - *pdu_error = le32_to_cpu(*pdu_error); + gc->update_job_status = le32_to_cpu(*pdu_error); + gc->update_job_done = 1; } static void gfio_client_timed_out(struct fio_client *client) @@ -679,7 +695,7 @@ static void gfio_client_job_start(struct fio_client *client, struct fio_net_cmd static void gfio_client_iolog(struct fio_client *client, struct cmd_iolog_pdu *pdu) { - printf("got iolog: name=%s, type=%u, entries=%u\n", pdu->name, pdu->log_type, pdu->nr_samples); + printf("got iolog: name=%s, type=%u, entries=%lu\n", pdu->name, pdu->log_type, (unsigned long) pdu->nr_samples); free(pdu); } @@ -692,7 +708,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); @@ -1005,8 +1021,8 @@ static void gfio_show_lat(GtkWidget *vbox, const char *name, unsigned long min, if (!usec_to_msec(&min, &max, &mean, &dev)) base = "(msec)"; - minp = num2str(min, 6, 1, 0); - maxp = num2str(max, 6, 1, 0); + minp = num2str(min, 6, 1, 0, 0); + maxp = num2str(max, 6, 1, 0, 0); sprintf(tmp, "%s %s", name, base); frame = gtk_frame_new(tmp); @@ -1161,7 +1177,7 @@ static void gfio_show_ddir_status(struct gfio_client *gc, GtkWidget *mbox, struct group_run_stats *rs, struct thread_stat *ts, int ddir) { - const char *ddir_label[2] = { "Read", "Write" }; + const char *ddir_label[3] = { "Read", "Write", "Trim" }; GtkWidget *frame, *label, *box, *vbox, *main_vbox; unsigned long min[3], max[3], runt; unsigned long long bw, iops; @@ -1177,11 +1193,11 @@ static void gfio_show_ddir_status(struct gfio_client *gc, GtkWidget *mbox, runt = ts->runtime[ddir]; bw = (1000 * ts->io_bytes[ddir]) / runt; - io_p = num2str(ts->io_bytes[ddir], 6, 1, i2p); - bw_p = num2str(bw, 6, 1, i2p); + io_p = num2str(ts->io_bytes[ddir], 6, 1, i2p, 8); + bw_p = num2str(bw, 6, 1, i2p, ts->unit_base); iops = (1000 * (uint64_t)ts->total_io_u[ddir]) / runt; - iops_p = num2str(iops, 6, 1, 0); + iops_p = num2str(iops, 6, 1, 0, 0); box = gtk_hbox_new(FALSE, 3); gtk_box_pack_start(GTK_BOX(mbox), box, TRUE, FALSE, 3); @@ -1280,6 +1296,7 @@ static void __gfio_display_end_results(GtkWidget *win, struct gfio_client *gc, struct group_run_stats *rs) { GtkWidget *box, *vbox, *entry, *scroll; + int i; scroll = gtk_scrolled_window_new(NULL, NULL); gtk_container_set_border_width(GTK_CONTAINER(scroll), 5); @@ -1309,10 +1326,10 @@ static void __gfio_display_end_results(GtkWidget *win, struct gfio_client *gc, entry = new_info_entry_in_frame(box, "PID"); entry_set_int_value(entry, ts->pid); - if (ts->io_bytes[DDIR_READ]) - gfio_show_ddir_status(gc, vbox, rs, ts, DDIR_READ); - if (ts->io_bytes[DDIR_WRITE]) - gfio_show_ddir_status(gc, vbox, rs, ts, DDIR_WRITE); + for (i = 0; i < DDIR_RWDIR_CNT; i++) { + if (ts->io_bytes[i]) + gfio_show_ddir_status(gc, vbox, rs, ts, i); + } gfio_show_latency_buckets(gc, vbox, ts); gfio_show_cpu_usage(vbox, ts);