From: Jens Axboe Date: Fri, 7 Sep 2018 18:04:14 +0000 (-0600) Subject: client: use temp buffer for client text output X-Git-Tag: fio-3.10~14 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=fecea437a7272916e00228b99b74e05ee8e0c957 client: use temp buffer for client text output Don't split it into pieces, log it into a local buffer and then flush it all at once. Signed-off-by: Jens Axboe --- diff --git a/client.c b/client.c index 31c7c649..2d8a2bb1 100644 --- a/client.c +++ b/client.c @@ -1144,13 +1144,16 @@ static void handle_text(struct fio_client *client, struct fio_net_cmd *cmd) const char *buf = (const char *) pdu->buf; const char *name; int fio_unused ret; + struct buf_output out; + + buf_output_init(&out); name = client->name ? client->name : client->hostname; if (!client->skip_newline && !(output_format & FIO_OUTPUT_TERSE)) - fprintf(f_out, "<%s> ", name); - ret = fwrite(buf, pdu->buf_len, 1, f_out); - fflush(f_out); + log_buf(&out, "<%s> ", name); + log_buf(&out, "%s", buf); + log_info_buf(out.buf, out.buflen); client->skip_newline = strchr(buf, '\n') == NULL; }