return sec + usec;
}
+static unsigned long mtime_since_now(struct timeval *s)
+{
+ struct timeval t;
+
+ gettimeofday(&t, NULL);
+ return mtime_since(s, &t);
+}
+
static inline unsigned long msec_now(struct timeval *s)
{
return s->tv_sec * 1000 + s->tv_usec / 1000;
static void *thread_main(int shm_id, int offset, char *argv[])
{
struct thread_data *td;
- struct timeval end;
void *data, *ptr = NULL;
struct stat st;
int ret = 1, flags;
do_async_io(td);
}
- gettimeofday(&end, NULL);
- td->runtime = mtime_since(&td->start, &end);
-
+ td->runtime = mtime_since_now(&td->start);
ret = 0;
-
err:
shutdown_stat_file(td);
if (td->use_aio)
static void run_threads(char *argv[])
{
- struct timeval genesis, now;
+ struct timeval genesis;
struct thread_data *td;
unsigned long spent;
int i, todo, nr_running, m_rate, t_rate;
}
if (td->start_delay) {
- gettimeofday(&now, NULL);
- spent = mtime_since(&genesis, &now);
+ spent = mtime_since_now(&genesis);
if (td->start_delay * 1000 > spent)
continue;