#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/ipc.h>
+#ifndef FIO_NO_HAVE_SHM_H
#include <sys/shm.h>
+#endif
#include <sys/mman.h>
#include "fio.h"
int groupid = 0;
unsigned int thread_number = 0;
+unsigned int stat_number = 0;
unsigned int nr_process = 0;
unsigned int nr_thread = 0;
int shm_id = 0;
act.sa_flags = SA_RESTART;
sigaction(SIGTERM, &act, NULL);
+/* Windows uses SIGBREAK as a quit signal from other applications */
+#ifdef WIN32
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = sig_int;
+ act.sa_flags = SA_RESTART;
+ sigaction(SIGBREAK, &act, NULL);
+#endif
+
memset(&act, 0, sizeof(act));
act.sa_handler = sig_show_status;
act.sa_flags = SA_RESTART;
int ret2, full;
enum fio_ddir ddir;
- if (td->terminate)
+ if (td->terminate || td->done)
break;
update_tv_cache(td);
if (ret < 0)
break;
- if (!ddir_rw_sum(bytes_done))
+ if (!ddir_rw_sum(bytes_done) && !(td->io_ops->flags & FIO_NOIO))
continue;
if (!in_ramp_time(td) && should_check_rate(td, bytes_done)) {
io_u = flist_entry(entry, struct io_u, list);
flist_del(&io_u->list);
+
+ if (td->io_ops->io_u_free)
+ td->io_ops->io_u_free(td, io_u);
+
fio_memfree(io_u, sizeof(*io_u));
}
io_u->index = i;
io_u->flags = IO_U_F_FREE;
flist_add(&io_u->list, &td->io_u_freelist);
+
+ if (td->io_ops->io_u_init) {
+ int ret = td->io_ops->io_u_init(td, io_u);
+
+ if (ret) {
+ log_err("fio: failed to init engine data: %d\n", ret);
+ return 1;
+ }
+ }
+
p += max_bs;
}
goto err;
}
+#ifdef FIO_HAVE_LIBNUMA
+ /* numa node setup */
+ if (td->o.numa_cpumask_set || td->o.numa_memmask_set) {
+ int ret;
+
+ if (numa_available() < 0) {
+ td_verror(td, errno, "Does not support NUMA API\n");
+ goto err;
+ }
+
+ if (td->o.numa_cpumask_set) {
+ ret = numa_run_on_node_mask(td->o.numa_cpunodesmask);
+ if (ret == -1) {
+ td_verror(td, errno, \
+ "numa_run_on_node_mask failed\n");
+ goto err;
+ }
+ }
+
+ if (td->o.numa_memmask_set) {
+
+ switch (td->o.numa_mem_mode) {
+ case MPOL_INTERLEAVE:
+ numa_set_interleave_mask(td->o.numa_memnodesmask);
+ break;
+ case MPOL_BIND:
+ numa_set_membind(td->o.numa_memnodesmask);
+ break;
+ case MPOL_LOCAL:
+ numa_set_localalloc();
+ break;
+ case MPOL_PREFERRED:
+ numa_set_preferred(td->o.numa_mem_prefer_node);
+ break;
+ case MPOL_DEFAULT:
+ default:
+ break;
+ }
+
+ }
+ }
+#endif
+
/*
* May alter parameters that init_io_u() will use, so we need to
* do this first.
verify_async_exit(td);
close_and_free_files(td);
- close_ioengine(td);
cleanup_io_u(td);
+ close_ioengine(td);
cgroup_shutdown(td, &cgroup_mnt);
if (td->o.cpumask_set) {
if (WIFSIGNALED(status)) {
int sig = WTERMSIG(status);
- if (sig != SIGTERM)
+ if (sig != SIGTERM && sig != SIGUSR2)
log_err("fio: pid=%d, got signal=%d\n",
(int) td->pid, sig);
td->sig = sig;