X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=client.c;h=c72f034a429a5b5da2120082d9e9c89d802c5fdb;hp=7f035c7d7804e764e1557c1fee1af1641d971038;hb=b7017e324de0484b5b4db881bdb280611523cf7e;hpb=38fdef226f1a1fa053ab53005abbc184143bff65 diff --git a/client.c b/client.c index 7f035c7d..c72f034a 100644 --- a/client.c +++ b/client.c @@ -41,6 +41,7 @@ struct fio_client { int skip_newline; int is_sock; + int disk_stats_shown; struct flist_head eta_list; struct client_eta *eta_in_flight; @@ -601,6 +602,54 @@ static void handle_gs(struct fio_net_cmd *cmd) show_group_stats(gs); } +static void convert_agg(struct disk_util_agg *agg) +{ + int i; + + for (i = 0; i < 2; i++) { + agg->ios[i] = le32_to_cpu(agg->ios[i]); + agg->merges[i] = le32_to_cpu(agg->merges[i]); + agg->sectors[i] = le64_to_cpu(agg->sectors[i]); + agg->ticks[i] = le32_to_cpu(agg->ticks[i]); + } + + agg->io_ticks = le32_to_cpu(agg->io_ticks); + agg->time_in_queue = le32_to_cpu(agg->time_in_queue); + agg->slavecount = le32_to_cpu(agg->slavecount); + agg->max_util.u.f = __le64_to_cpu(fio_uint64_to_double(agg->max_util.u.i)); +} + +static void convert_dus(struct disk_util_stat *dus) +{ + int i; + + for (i = 0; i < 2; i++) { + dus->ios[i] = le32_to_cpu(dus->ios[i]); + dus->merges[i] = le32_to_cpu(dus->merges[i]); + dus->sectors[i] = le64_to_cpu(dus->sectors[i]); + dus->ticks[i] = le32_to_cpu(dus->ticks[i]); + } + + dus->io_ticks = le32_to_cpu(dus->io_ticks); + dus->time_in_queue = le32_to_cpu(dus->time_in_queue); + dus->msec = le64_to_cpu(dus->msec); +} + +static void handle_du(struct fio_client *client, struct fio_net_cmd *cmd) +{ + struct cmd_du_pdu *du = (struct cmd_du_pdu *) cmd->payload; + + convert_dus(&du->dus); + convert_agg(&du->agg); + + if (!client->disk_stats_shown) { + client->disk_stats_shown = 1; + log_info("\nDisk stats (read/write):\n"); + } + + print_disk_util(&du->dus, &du->agg, terse_output); +} + static void convert_jobs_eta(struct jobs_eta *je) { int i; @@ -699,7 +748,8 @@ static void handle_eta(struct fio_client *client, struct fio_net_cmd *cmd) static void handle_probe(struct fio_client *client, struct fio_net_cmd *cmd) { struct cmd_probe_pdu *probe = (struct cmd_probe_pdu *) cmd->payload; - const char *os, *arch, *bit; + const char *os, *arch; + char bit[16]; os = fio_get_os_string(probe->os); if (!os) @@ -709,14 +759,7 @@ static void handle_probe(struct fio_client *client, struct fio_net_cmd *cmd) if (!arch) os = "unknown"; - if (probe->bpp == 2) - bit = "16-bit"; - else if (probe->bpp == 4) - bit = "32-bit"; - else if (probe->bpp == 8) - bit = "64-bit"; - else - bit = "unknown"; + sprintf(bit, "%d-bit", probe->bpp * 8); log_info("hostname=%s, be=%u, %s, os=%s, arch=%s, fio=%u.%u.%u\n", probe->hostname, probe->bigendian, bit, os, arch, @@ -759,6 +802,10 @@ static int handle_client(struct fio_client *client) free(cmd); break; } + case FIO_NET_CMD_DU: + handle_du(client, cmd); + free(cmd); + break; case FIO_NET_CMD_TS: handle_ts(cmd); free(cmd);