X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=server.c;h=e4793f7bcb41cfcaf892254463c183a02c19de61;hp=db9d8594c8b84c59003cf0d58270bbca197c8fb5;hb=d09a64a01a6c807596e9286c93f6c6f30fd2ea26;hpb=7b8216842eb888ff626f616c2770a2548b0b0bf9 diff --git a/server.c b/server.c index db9d8594..e4793f7b 100644 --- a/server.c +++ b/server.c @@ -46,7 +46,8 @@ static const char *fio_server_ops[FIO_NET_CMD_NR] = { "ETA", "PROBE", "START", - "STOP" + "STOP", + "DISK_UTIL", }; const char *fio_server_op(unsigned int op) @@ -299,7 +300,7 @@ int fio_net_send_simple_cmd(int sk, uint16_t opcode, uint64_t tag, cmd = malloc(sizeof(*cmd)); - fio_init_net_cmd(&cmd->cmd, opcode, NULL, 0, (uint64_t) cmd); + fio_init_net_cmd(&cmd->cmd, opcode, NULL, 0, (uintptr_t) cmd); fio_net_cmd_crc(&cmd->cmd); INIT_FLIST_HEAD(&cmd->list); @@ -398,6 +399,8 @@ static int handle_probe_cmd(struct fio_net_cmd *cmd) probe.os = FIO_OS; probe.arch = FIO_ARCH; + probe.bpp = sizeof(void *); + return fio_net_send_cmd(server_fd, FIO_NET_CMD_PROBE, &probe, sizeof(probe), cmd->tag); } @@ -407,7 +410,10 @@ static int handle_send_eta_cmd(struct fio_net_cmd *cmd) size_t size; int i; - size = sizeof(*je) + thread_number * sizeof(char); + if (!thread_number) + return 0; + + size = sizeof(*je) + thread_number * sizeof(char) + 1; je = malloc(size); memset(je, 0, size); @@ -666,9 +672,10 @@ void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs) p.ts.clat_percentiles = cpu_to_le64(ts->clat_percentiles); for (i = 0; i < FIO_IO_U_LIST_MAX_LEN; i++) { - fio_fp64_t *fp = &p.ts.percentile_list[i]; + fio_fp64_t *src = &ts->percentile_list[i]; + fio_fp64_t *dst = &p.ts.percentile_list[i]; - fp->u.i = __cpu_to_le64(fio_double_to_uint64(fp->u.f)); + dst->u.i = __cpu_to_le64(fio_double_to_uint64(src->u.f)); } for (i = 0; i < FIO_IO_U_MAP_NR; i++) { @@ -720,6 +727,59 @@ void fio_server_send_gs(struct group_run_stats *rs) fio_net_send_cmd(server_fd, FIO_NET_CMD_GS, &gs, sizeof(gs), 0); } +static void convert_agg(struct disk_util_agg *dst, struct disk_util_agg *src) +{ + int i; + + for (i = 0; i < 2; i++) { + dst->ios[i] = cpu_to_le32(src->ios[i]); + dst->merges[i] = cpu_to_le32(src->merges[i]); + dst->sectors[i] = cpu_to_le64(src->sectors[i]); + dst->ticks[i] = cpu_to_le32(src->ticks[i]); + } + + dst->io_ticks = cpu_to_le32(src->io_ticks); + dst->time_in_queue = cpu_to_le32(src->time_in_queue); + dst->slavecount = cpu_to_le32(src->slavecount); + dst->max_util.u.i = __cpu_to_le64(fio_double_to_uint64(src->max_util.u.f)); +} + +static void convert_dus(struct disk_util_stat *dst, struct disk_util_stat *src) +{ + int i; + + strcpy((char *) dst->name, (char *) src->name); + + for (i = 0; i < 2; i++) { + dst->ios[i] = cpu_to_le32(src->ios[i]); + dst->merges[i] = cpu_to_le32(src->merges[i]); + dst->sectors[i] = cpu_to_le64(src->sectors[i]); + dst->ticks[i] = cpu_to_le32(src->ticks[i]); + } + + dst->io_ticks = cpu_to_le32(src->io_ticks); + dst->time_in_queue = cpu_to_le32(src->time_in_queue); + dst->msec = cpu_to_le64(src->msec); +} + +void fio_server_send_du(void) +{ + struct disk_util *du; + struct flist_head *entry; + struct cmd_du_pdu pdu; + + dprint(FD_NET, "server: sending disk_util %d\n", !flist_empty(&disk_list)); + + flist_for_each(entry, &disk_list) { + du = flist_entry(entry, struct disk_util, list); + + convert_dus(&pdu.dus, &du->dus); + convert_agg(&pdu.agg, &du->agg); + + fio_net_send_cmd(server_fd, FIO_NET_CMD_DU, &pdu, sizeof(pdu), 0); + } +} + int fio_server_log(const char *format, ...) { char buffer[1024];