Skip to content

Commit

Permalink
Merge branch 'nanosecond-2stage' of https://github.com/vincentkfu/fio
Browse files Browse the repository at this point in the history
…into nsec

Pull the nsec branch from Vincent.
  • Loading branch information
axboe committed Jun 22, 2017
2 parents b2fcbe0 + 52830b2 commit 84e893f
Show file tree
Hide file tree
Showing 43 changed files with 1,123 additions and 342 deletions.
2 changes: 1 addition & 1 deletion HOWTO
Original file line number Diff line number Diff line change
Expand Up @@ -3189,7 +3189,7 @@ Split up, the format is as follows:

Total IO (KiB), bandwidth (KiB/sec), IOPS, runtime (msec)
Submission latency: min, max, mean, stdev (usec)
Completion latency: min, max, mean, stdev(usec)
Completion latency: min, max, mean, stdev (usec)
Completion latency percentiles: 20 fields (see below)
Total latency: min, max, mean, stdev (usec)
Bw (KiB/s): min, max, aggregate percentage of total, mean, stdev
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ T_PIPE_ASYNC_PROGS = t/read-to-pipe-async
T_MEMLOCK_OBJS = t/memlock.o
T_MEMLOCK_PROGS = t/memlock

T_TT_OBJS = t/time-test.o
T_TT_PROGS = t/time-test

T_OBJS = $(T_SMALLOC_OBJS)
T_OBJS += $(T_IEEE_OBJS)
T_OBJS += $(T_ZIPF_OBJS)
Expand All @@ -261,6 +264,7 @@ T_OBJS += $(T_DEDUPE_OBJS)
T_OBJS += $(T_VS_OBJS)
T_OBJS += $(T_PIPE_ASYNC_OBJS)
T_OBJS += $(T_MEMLOCK_OBJS)
T_OBJS += $(T_TT_OBJS)

ifneq (,$(findstring CYGWIN,$(CONFIG_TARGET_OS)))
T_DEDUPE_OBJS += os/windows/posix.o lib/hweight.o
Expand Down Expand Up @@ -434,6 +438,9 @@ t/fio-dedupe: $(T_DEDUPE_OBJS)
t/fio-verify-state: $(T_VS_OBJS)
$(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_VS_OBJS) $(LIBS)

t/time-test: $(T_TT_OBJS)
$(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_TT_OBJS) $(LIBS)

clean: FORCE
@rm -f .depend $(FIO_OBJS) $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) $(T_TEST_PROGS) core.* core gfio FIO-VERSION-FILE *.d lib/*.d oslib/*.d crc/*.d engines/*.d profiles/*.d t/*.d config-host.mak config-host.h y.tab.[ch] lex.yy.c exp/*.[do] lexer.h
@rm -rf doc/output
Expand Down
42 changes: 21 additions & 21 deletions backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static void set_sig_handlers(void)
/*
* Check if we are above the minimum rate given.
*/
static bool __check_min_rate(struct thread_data *td, struct timeval *now,
static bool __check_min_rate(struct thread_data *td, struct timespec *now,
enum fio_ddir ddir)
{
unsigned long long bytes = 0;
Expand Down Expand Up @@ -223,7 +223,7 @@ static bool __check_min_rate(struct thread_data *td, struct timeval *now,
return false;
}

static bool check_min_rate(struct thread_data *td, struct timeval *now)
static bool check_min_rate(struct thread_data *td, struct timespec *now)
{
bool ret = false;

Expand Down Expand Up @@ -335,18 +335,18 @@ static int fio_file_fsync(struct thread_data *td, struct fio_file *f)
return ret;
}

static inline void __update_tv_cache(struct thread_data *td)
static inline void __update_ts_cache(struct thread_data *td)
{
fio_gettime(&td->tv_cache, NULL);
fio_gettime(&td->ts_cache, NULL);
}

static inline void update_tv_cache(struct thread_data *td)
static inline void update_ts_cache(struct thread_data *td)
{
if ((++td->tv_cache_nr & td->tv_cache_mask) == td->tv_cache_mask)
__update_tv_cache(td);
if ((++td->ts_cache_nr & td->ts_cache_mask) == td->ts_cache_mask)
__update_ts_cache(td);
}

static inline bool runtime_exceeded(struct thread_data *td, struct timeval *t)
static inline bool runtime_exceeded(struct thread_data *td, struct timespec *t)
{
if (in_ramp_time(td))
return false;
Expand Down Expand Up @@ -430,7 +430,7 @@ static void check_update_rusage(struct thread_data *td)
}
}

static int wait_for_completions(struct thread_data *td, struct timeval *time)
static int wait_for_completions(struct thread_data *td, struct timespec *time)
{
const int full = queue_full(td);
int min_evts = 0;
Expand Down Expand Up @@ -462,7 +462,7 @@ static int wait_for_completions(struct thread_data *td, struct timeval *time)

int io_queue_event(struct thread_data *td, struct io_u *io_u, int *ret,
enum fio_ddir ddir, uint64_t *bytes_issued, int from_verify,
struct timeval *comp_time)
struct timespec *comp_time)
{
int ret2;

Expand Down Expand Up @@ -633,12 +633,12 @@ static void do_verify(struct thread_data *td, uint64_t verify_bytes)
enum fio_ddir ddir;
int full;

update_tv_cache(td);
update_ts_cache(td);
check_update_rusage(td);

if (runtime_exceeded(td, &td->tv_cache)) {
__update_tv_cache(td);
if (runtime_exceeded(td, &td->tv_cache)) {
if (runtime_exceeded(td, &td->ts_cache)) {
__update_ts_cache(td);
if (runtime_exceeded(td, &td->ts_cache)) {
fio_mark_td_terminate(td);
break;
}
Expand Down Expand Up @@ -874,7 +874,7 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
while ((td->o.read_iolog_file && !flist_empty(&td->io_log_list)) ||
(!flist_empty(&td->trim_list)) || !io_issue_bytes_exceeded(td) ||
td->o.time_based) {
struct timeval comp_time;
struct timespec comp_time;
struct io_u *io_u;
int full;
enum fio_ddir ddir;
Expand All @@ -884,11 +884,11 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
if (td->terminate || td->done)
break;

update_tv_cache(td);
update_ts_cache(td);

if (runtime_exceeded(td, &td->tv_cache)) {
__update_tv_cache(td);
if (runtime_exceeded(td, &td->tv_cache)) {
if (runtime_exceeded(td, &td->ts_cache)) {
__update_ts_cache(td);
if (runtime_exceeded(td, &td->ts_cache)) {
fio_mark_td_terminate(td);
break;
}
Expand Down Expand Up @@ -1686,7 +1686,7 @@ static void *thread_main(void *data)
uint64_t verify_bytes;

fio_gettime(&td->start, NULL);
memcpy(&td->tv_cache, &td->start, sizeof(td->start));
memcpy(&td->ts_cache, &td->start, sizeof(td->start));

if (clear_state) {
clear_io_state(td, 0);
Expand Down Expand Up @@ -2202,7 +2202,7 @@ static void run_threads(struct sk_out *sk_out)

while (todo) {
struct thread_data *map[REAL_MAX_JOBS];
struct timeval this_start;
struct timespec this_start;
int this_jobs = 0, left;
struct fork_data *fd;

Expand Down
24 changes: 13 additions & 11 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct client_ops fio_client_ops = {
.client_type = FIO_CLIENT_TYPE_CLI,
};

static struct timeval eta_tv;
static struct timespec eta_ts;

static FLIST_HEAD(client_list);
static FLIST_HEAD(eta_list);
Expand Down Expand Up @@ -908,6 +908,8 @@ static void convert_ts(struct thread_stat *dst, struct thread_stat *src)
dst->io_u_complete[i] = le32_to_cpu(src->io_u_complete[i]);
}

for (i = 0; i < FIO_IO_U_LAT_N_NR; i++)
dst->io_u_lat_n[i] = le32_to_cpu(src->io_u_lat_n[i]);
for (i = 0; i < FIO_IO_U_LAT_U_NR; i++)
dst->io_u_lat_u[i] = le32_to_cpu(src->io_u_lat_u[i]);
for (i = 0; i < FIO_IO_U_LAT_M_NR; i++)
Expand Down Expand Up @@ -1869,7 +1871,7 @@ static int handle_cmd_timeout(struct fio_client *client,
}

static int client_check_cmd_timeout(struct fio_client *client,
struct timeval *now)
struct timespec *now)
{
struct fio_net_cmd_reply *reply;
struct flist_head *entry, *tmp;
Expand All @@ -1878,7 +1880,7 @@ static int client_check_cmd_timeout(struct fio_client *client,
flist_for_each_safe(entry, tmp, &client->cmd_list) {
reply = flist_entry(entry, struct fio_net_cmd_reply, list);

if (mtime_since(&reply->tv, now) < FIO_NET_CLIENT_TIMEOUT)
if (mtime_since(&reply->ts, now) < FIO_NET_CLIENT_TIMEOUT)
continue;

if (!handle_cmd_timeout(client, reply))
Expand All @@ -1896,18 +1898,18 @@ static int fio_check_clients_timed_out(void)
{
struct fio_client *client;
struct flist_head *entry, *tmp;
struct timeval tv;
struct timespec ts;
int ret = 0;

fio_gettime(&tv, NULL);
fio_gettime(&ts, NULL);

flist_for_each_safe(entry, tmp, &client_list) {
client = flist_entry(entry, struct fio_client, list);

if (flist_empty(&client->cmd_list))
continue;

if (!client_check_cmd_timeout(client, &tv))
if (!client_check_cmd_timeout(client, &ts))
continue;

if (client->ops->timed_out)
Expand All @@ -1928,7 +1930,7 @@ int fio_handle_clients(struct client_ops *ops)
struct pollfd *pfds;
int i, ret = 0, retval = 0;

fio_gettime(&eta_tv, NULL);
fio_gettime(&eta_ts, NULL);

pfds = malloc(nr_clients * sizeof(struct pollfd));

Expand Down Expand Up @@ -1960,13 +1962,13 @@ int fio_handle_clients(struct client_ops *ops)
assert(i == nr_clients);

do {
struct timeval tv;
struct timespec ts;
int timeout;

fio_gettime(&tv, NULL);
if (mtime_since(&eta_tv, &tv) >= 900) {
fio_gettime(&ts, NULL);
if (mtime_since(&eta_ts, &ts) >= 900) {
request_client_etas(ops);
memcpy(&eta_tv, &tv, sizeof(tv));
memcpy(&eta_ts, &ts, sizeof(ts));

if (fio_check_clients_timed_out())
break;
Expand Down
6 changes: 3 additions & 3 deletions crc/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ int fio_crctest(const char *type)
fill_random_buf(&state, buf, CHUNK);

for (i = 0; t[i].name; i++) {
struct timeval tv;
struct timespec ts;
double mb_sec;
uint64_t usec;
char pre[3];
Expand All @@ -409,9 +409,9 @@ int fio_crctest(const char *type)
t[i].fn(&t[i], buf, CHUNK);
}

fio_gettime(&tv, NULL);
fio_gettime(&ts, NULL);
t[i].fn(&t[i], buf, CHUNK);
usec = utime_since_now(&tv);
usec = utime_since_now(&ts);

if (usec) {
mb_sec = (double) mb / (double) usec;
Expand Down
2 changes: 1 addition & 1 deletion diskutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int get_io_ticks(struct disk_util *du, struct disk_util_stat *dus)
static void update_io_tick_disk(struct disk_util *du)
{
struct disk_util_stat __dus, *dus, *ldus;
struct timeval t;
struct timespec t;

if (!du->users)
return;
Expand Down
2 changes: 1 addition & 1 deletion diskutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct disk_util {
*/
struct flist_head slaves;

struct timeval time;
struct timespec time;

struct fio_mutex *lock;
unsigned long users;
Expand Down
2 changes: 1 addition & 1 deletion engines/guasi.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static void fio_guasi_queued(struct thread_data *td, struct io_u **io_us, int nr
{
int i;
struct io_u *io_u;
struct timeval now;
struct timespec now;

if (!fio_fill_issue_time(td))
return;
Expand Down
8 changes: 4 additions & 4 deletions engines/libaio.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
static void fio_libaio_queued(struct thread_data *td, struct io_u **io_us,
unsigned int nr)
{
struct timeval now;
struct timespec now;
unsigned int i;

if (!fio_fill_issue_time(td))
Expand All @@ -241,7 +241,7 @@ static int fio_libaio_commit(struct thread_data *td)
struct libaio_data *ld = td->io_ops_data;
struct iocb **iocbs;
struct io_u **io_us;
struct timeval tv;
struct timespec ts;
int ret, wait_start = 0;

if (!ld->queued)
Expand Down Expand Up @@ -282,9 +282,9 @@ static int fio_libaio_commit(struct thread_data *td)
break;
}
if (!wait_start) {
fio_gettime(&tv, NULL);
fio_gettime(&ts, NULL);
wait_start = 1;
} else if (mtime_since_now(&tv) > 30000) {
} else if (mtime_since_now(&ts) > 30000) {
log_err("fio: aio appears to be stalled, giving up\n");
break;
}
Expand Down
2 changes: 1 addition & 1 deletion engines/rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ static void fio_rdmaio_queued(struct thread_data *td, struct io_u **io_us,
unsigned int nr)
{
struct rdmaio_data *rd = td->io_ops_data;
struct timeval now;
struct timespec now;
unsigned int i;

if (!fio_fill_issue_time(td))
Expand Down
6 changes: 3 additions & 3 deletions eta.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,12 @@ bool calc_thread_status(struct jobs_eta *je, int force)
uint64_t rate_time, disp_time, bw_avg_time, *eta_secs;
unsigned long long io_bytes[DDIR_RWDIR_CNT];
unsigned long long io_iops[DDIR_RWDIR_CNT];
struct timeval now;
struct timespec now;

static unsigned long long rate_io_bytes[DDIR_RWDIR_CNT];
static unsigned long long disp_io_bytes[DDIR_RWDIR_CNT];
static unsigned long long disp_io_iops[DDIR_RWDIR_CNT];
static struct timeval rate_prev_time, disp_prev_time;
static struct timespec rate_prev_time, disp_prev_time;

if (!force) {
if (!(output_format & FIO_OUTPUT_NORMAL) &&
Expand Down Expand Up @@ -511,7 +511,7 @@ bool calc_thread_status(struct jobs_eta *je, int force)

void display_thread_status(struct jobs_eta *je)
{
static struct timeval disp_eta_new_line;
static struct timespec disp_eta_new_line;
static int eta_new_line_init, eta_new_line_pending;
static int linelen_last;
static int eta_good;
Expand Down
Loading

0 comments on commit 84e893f

Please sign in to comment.