X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=client.c;h=a77dc9350e0d1d57ffcc2c7f065204b3f9b5b254;hb=5d7793aa2b1dc1044b1918d829a1bcd4c9a19196;hp=b0ccad0481699fa1fc54178ebff6672618cf9e52;hpb=5121a9aa0299a2c23b3c50bf110ab4a05677c740;p=fio.git diff --git a/client.c b/client.c index b0ccad04..a77dc935 100644 --- a/client.c +++ b/client.c @@ -26,12 +26,14 @@ static void handle_ts(struct fio_client *client, struct fio_net_cmd *cmd); static void handle_gs(struct fio_client *client, struct fio_net_cmd *cmd); static void handle_probe(struct fio_client *client, struct fio_net_cmd *cmd); static void handle_text(struct fio_client *client, struct fio_net_cmd *cmd); +static void handle_stop(struct fio_client *client, struct fio_net_cmd *cmd); struct client_ops fio_client_ops = { .text_op = handle_text, .disk_util = handle_du, .thread_status = handle_ts, .group_stats = handle_gs, + .stop = handle_stop, .eta = display_thread_status, .probe = handle_probe, }; @@ -52,9 +54,10 @@ static FLIST_HEAD(eta_list); static FLIST_HEAD(arg_list); -static struct thread_stat client_ts; -static struct group_run_stats client_gs; -static int sum_stat_clients; +struct thread_stat client_ts; +struct group_run_stats client_gs; +int sum_stat_clients; + static int sum_stat_nr; #define FIO_CLIENT_HASH_BITS 7 @@ -744,6 +747,7 @@ static void convert_jobs_eta(struct jobs_eta *je) je->elapsed_sec = le64_to_cpu(je->elapsed_sec); je->eta_sec = le64_to_cpu(je->eta_sec); + je->nr_threads = le32_to_cpu(je->nr_threads); } void fio_client_sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je) @@ -768,6 +772,9 @@ void fio_client_sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je) if (je->eta_sec > dst->eta_sec) dst->eta_sec = je->eta_sec; + + dst->nr_threads += je->nr_threads; + /* we need to handle je->run_str too ... */ } void fio_client_dec_jobs_eta(struct client_eta *eta, client_eta_op eta_fn) @@ -852,15 +859,17 @@ static void handle_start(struct fio_client *client, struct fio_net_cmd *cmd) static void handle_stop(struct fio_client *client, struct fio_net_cmd *cmd) { - struct cmd_end_pdu *pdu = (struct cmd_end_pdu *) cmd->payload; - - client->state = Client_stopped; - client->error = le32_to_cpu(pdu->error); - if (client->error) log_info("client <%s>: exited with error %d\n", client->hostname, client->error); } +static void convert_stop(struct fio_net_cmd *cmd) +{ + struct cmd_end_pdu *pdu = (struct cmd_end_pdu *) cmd->payload; + + pdu->error = le32_to_cpu(pdu->error); +} + static void convert_text(struct fio_net_cmd *cmd) { struct cmd_text_pdu *pdu = (struct cmd_text_pdu *) cmd->payload; @@ -940,7 +949,7 @@ int fio_handle_client(struct fio_client *client) ops->probe(client, cmd); free(cmd); break; - case FIO_NET_CMD_RUN: + case FIO_NET_CMD_SERVER_START: client->state = Client_running; free(cmd); break; @@ -948,10 +957,16 @@ int fio_handle_client(struct fio_client *client) handle_start(client, cmd); free(cmd); break; - case FIO_NET_CMD_STOP: - handle_stop(client, cmd); + case FIO_NET_CMD_STOP: { + struct cmd_end_pdu *pdu = (struct cmd_end_pdu *) cmd->payload; + + convert_stop(cmd); + client->state = Client_stopped; + client->error = pdu->error; + ops->stop(client, cmd); free(cmd); break; + } case FIO_NET_CMD_ADD_JOB: if (ops->add_job) ops->add_job(client, cmd);