fio_client_dec_jobs_eta(client->eta_in_flight, client->ops->eta);
}
+ close(client->fd);
+ client->fd = -1;
+
+ if (client->ops->removed)
+ client->ops->removed(client);
+
nr_clients--;
sum_stat_clients--;
return 0;
}
-void fio_client_terminate(struct fio_client *client)
+int fio_client_terminate(struct fio_client *client)
{
- fio_net_send_simple_cmd(client->fd, FIO_NET_CMD_QUIT, 0, NULL);
+ return fio_net_send_quit(client->fd);
}
void fio_clients_terminate(void)
{
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]);
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) {
unsigned long total;
z_stream stream;
void *p;
+ int i;
stream.zalloc = Z_NULL;
stream.zfree = Z_NULL;
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);
- stream.avail_in = cmd->pdu_len - sizeof(pdu->nr_samples);
- stream.next_in = (void *) pdu + sizeof(pdu->nr_samples);
+ p = (void *) ret + sizeof(*pdu);
+
+ 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;
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;
}
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;
convert_stop(cmd);
client->state = Client_stopped;
- client->error = pdu->error;
+ client->error = le32_to_cpu(pdu->error);
+ client->signal = le32_to_cpu(pdu->signal);
ops->stop(client, cmd);
free(cmd);
break;