"ADD_JOB",
"CMD_RUN",
"CMD_IOLOG",
+ "CMD_UPDATE_JOB",
+ "CMD_LOAD_FILE",
};
const char *fio_server_op(unsigned int op)
fio_server_check_fork_items(conn_list);
}
+static int handle_load_file_cmd(struct fio_net_cmd *cmd)
+{
+ struct cmd_load_file_pdu *pdu = (struct cmd_load_file_pdu *) cmd->payload;
+ void *file_name = pdu->file;
+ struct cmd_start_pdu spdu;
+
+ dprint(FD_NET, "server: loading local file %s\n", (char *) file_name);
+
+ pdu->name_len = le16_to_cpu(pdu->name_len);
+ pdu->client_type = le16_to_cpu(pdu->client_type);
+
+ if (parse_jobs_ini(file_name, 0, 0, pdu->client_type)) {
+ fio_net_send_quit(server_fd);
+ return -1;
+ }
+
+ spdu.jobs = cpu_to_le32(thread_number);
+ spdu.stat_outputs = cpu_to_le32(stat_number);
+ fio_net_send_cmd(server_fd, FIO_NET_CMD_START, &spdu, sizeof(spdu), NULL, NULL);
+ return 0;
+}
+
static int handle_run_cmd(struct flist_head *job_list, struct fio_net_cmd *cmd)
{
pid_t pid;
static int handle_send_eta_cmd(struct fio_net_cmd *cmd)
{
struct jobs_eta *je;
- size_t size;
uint64_t tag = cmd->tag;
+ size_t size;
int i;
- if (!thread_number)
- return 0;
-
- size = sizeof(*je) + thread_number * sizeof(char) + 1;
- je = malloc(size);
- memset(je, 0, size);
-
- if (!calc_thread_status(je, 1)) {
- free(je);
+ je = get_jobs_eta(1, &size);
+ if (!je)
return 0;
- }
dprint(FD_NET, "server sending status\n");
case FIO_NET_CMD_EXIT:
exit_backend = 1;
return -1;
+ case FIO_NET_CMD_LOAD_FILE:
+ ret = handle_load_file_cmd(cmd);
+ break;
case FIO_NET_CMD_JOB:
ret = handle_job_cmd(cmd);
break;
for (i = 0; i < DDIR_RWDIR_CNT; i++) {
p.ts.total_io_u[i] = cpu_to_le64(ts->total_io_u[i]);
p.ts.short_io_u[i] = cpu_to_le64(ts->short_io_u[i]);
+ p.ts.drop_io_u[i] = cpu_to_le64(ts->drop_io_u[i]);
}
p.ts.total_submit = cpu_to_le64(ts->total_submit);
}
stream.next_in = (void *) log->log;
- stream.avail_in = log->nr_samples * sizeof(struct io_sample);
+ stream.avail_in = log->nr_samples * log_entry_sz(log);
do {
unsigned int this_len, flags = 0;
struct cmd_iolog_pdu pdu;
int i, ret = 0;
+ pdu.nr_samples = cpu_to_le64(log->nr_samples);
pdu.thread_number = cpu_to_le32(td->thread_number);
- pdu.nr_samples = __cpu_to_le32(log->nr_samples);
pdu.log_type = cpu_to_le32(log->log_type);
pdu.compressed = cpu_to_le32(use_zlib);
pdu.name[FIO_NET_NAME_MAX - 1] = '\0';
for (i = 0; i < log->nr_samples; i++) {
- struct io_sample *s = &log->log[i];
+ struct io_sample *s = get_sample(log, i);
- s->time = cpu_to_le64(s->time);
- s->val = cpu_to_le64(s->val);
- s->ddir = cpu_to_le32(s->ddir);
- s->bs = cpu_to_le32(s->bs);
+ s->time = cpu_to_le64(s->time);
+ s->val = cpu_to_le64(s->val);
+ s->__ddir = cpu_to_le32(s->__ddir);
+ s->bs = cpu_to_le32(s->bs);
+
+ if (log->log_offset) {
+ struct io_sample_offset *so = (void *) s;
+
+ so->offset = cpu_to_le64(so->offset);
+ }
}
/*
return fio_send_iolog_gz(&pdu, log);
return fio_send_cmd_ext_pdu(server_fd, FIO_NET_CMD_IOLOG, log->log,
- log->nr_samples * sizeof(struct io_sample), 0, 0);
+ log->nr_samples * log_entry_sz(log), 0, 0);
}
void fio_server_send_add_job(struct thread_data *td)
int ret = write_pid(pid, pidfile);
free(pidfile);
- exit(ret);
+ _exit(ret);
}
setsid();