X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=client.c;h=6230a66e032258f338c55fa8c05e72bf4d6ad833;hb=789f4ccdf725e6da8bde98afd004c31e16241cfd;hp=c49e9a198455d72fabe318841f0f8022add89a1e;hpb=1b42725f06f8906b9b99381da3490484f59df28a;p=fio.git diff --git a/client.c b/client.c index c49e9a19..6230a66e 100644 --- a/client.c +++ b/client.c @@ -628,10 +628,11 @@ static void convert_ts(struct thread_stat *dst, struct thread_stat *src) { int i, j; - dst->error = le32_to_cpu(src->error); - dst->groupid = le32_to_cpu(src->groupid); - dst->pid = le32_to_cpu(src->pid); - dst->members = le32_to_cpu(src->members); + dst->error = le32_to_cpu(src->error); + dst->thread_number = le32_to_cpu(src->thread_number); + dst->groupid = le32_to_cpu(src->groupid); + dst->pid = le32_to_cpu(src->pid); + dst->members = le32_to_cpu(src->members); for (i = 0; i < 2; i++) { convert_io_stat(&dst->clat_stat[i], &src->clat_stat[i]); @@ -719,6 +720,7 @@ static void handle_ts(struct fio_client *client, struct fio_net_cmd *cmd) sum_group_stats(&client_gs, &p->rs); client_ts.members++; + client_ts.thread_number = p->ts.thread_number; client_ts.groupid = p->ts.groupid; if (++sum_stat_nr == sum_stat_clients) { @@ -963,6 +965,7 @@ static struct cmd_iolog_pdu *convert_iolog(struct fio_net_cmd *cmd) unsigned long total; z_stream stream; void *p; + int i; stream.zalloc = Z_NULL; stream.zfree = Z_NULL; @@ -974,17 +977,21 @@ static struct cmd_iolog_pdu *convert_iolog(struct fio_net_cmd *cmd) return NULL; /* - * Everything beyond the first entry is compressed. + * Get header first, it's not compressed */ nr_samples = le32_to_cpu(pdu->nr_samples); - total = sizeof(*pdu) + nr_samples * sizeof(struct io_sample); - ret = malloc(total); + total = nr_samples * sizeof(struct io_sample); + ret = malloc(total + sizeof(*pdu)); + ret->thread_number = le32_to_cpu(pdu->thread_number); ret->nr_samples = nr_samples; - p = (void *) ret + sizeof(pdu->nr_samples); + ret->log_type = le32_to_cpu(pdu->log_type); + strcpy((char *) ret->name, (char *) pdu->name); + + p = (void *) ret + sizeof(*pdu); - stream.avail_in = cmd->pdu_len - sizeof(pdu->nr_samples); - stream.next_in = (void *) pdu + sizeof(pdu->nr_samples); + stream.avail_in = cmd->pdu_len - sizeof(*pdu); + stream.next_in = (void *) pdu + sizeof(*pdu); while (stream.avail_in) { unsigned int this_chunk = 65536; unsigned int this_len; @@ -996,8 +1003,11 @@ static struct cmd_iolog_pdu *convert_iolog(struct fio_net_cmd *cmd) stream.avail_out = this_chunk; stream.next_out = p; err = inflate(&stream, Z_NO_FLUSH); - if (err != Z_OK) { + /* may be Z_OK, or Z_STREAM_END */ + if (err < 0) { log_err("fio: inflate error %d\n", err); + free(ret); + ret = NULL; goto out; } @@ -1006,7 +1016,15 @@ static struct cmd_iolog_pdu *convert_iolog(struct fio_net_cmd *cmd) total -= this_len; } - ret->log_type = cpu_to_le32(ret->log_type); + for (i = 0; i < ret->nr_samples; i++) { + struct io_sample *s = &ret->samples[i]; + + s->time = le64_to_cpu(s->time); + s->val = le64_to_cpu(s->val); + s->ddir = le32_to_cpu(s->ddir); + s->bs = le32_to_cpu(s->bs); + } + out: inflateEnd(&stream); return ret;