Fix ramp time breakage
authorJens Axboe <axboe@fb.com>
Mon, 6 Jun 2016 15:10:24 +0000 (09:10 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 6 Jun 2016 15:10:24 +0000 (09:10 -0600)
A previous commit inadvertently used ramp_time_over() instead of
in_ramp_time(), which breaks some jobs with ramp time. This is
because the former function has side effects, where we really
just want to check if we're in ramp time or not.

Fixes: a47591e4923f ("Improve logging accuracy")
Signed-off-by: Jens Axboe <axboe@fb.com>
fio_time.h
stat.c
time.c

index cb271c26883adc5aebcec42d0fab9673aeec265d..e31ea0974da5d5168ba4db93b977cb0fd9624a63 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FIO_TIME_H
 #define FIO_TIME_H
 
+#include "lib/types.h"
+
 struct thread_data;
 extern uint64_t utime_since(const struct timeval *,const  struct timeval *);
 extern uint64_t utime_since_now(const struct timeval *);
@@ -14,8 +16,8 @@ extern uint64_t usec_spin(unsigned int);
 extern uint64_t usec_sleep(struct thread_data *, unsigned long);
 extern void fill_start_time(struct timeval *);
 extern void set_genesis_time(void);
-extern int ramp_time_over(struct thread_data *);
-extern int in_ramp_time(struct thread_data *);
+extern bool ramp_time_over(struct thread_data *);
+extern bool in_ramp_time(struct thread_data *);
 extern void fio_time_init(void);
 extern void timeval_add_msec(struct timeval *, unsigned int);
 
diff --git a/stat.c b/stat.c
index 53848843860011441ed60c199e17437199545a6c..2e0b1da00d11242ad459b130b5c3681ccbd53140 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -2393,7 +2393,7 @@ int calc_log_samples(void)
        fio_gettime(&now, NULL);
 
        for_each_td(td, i) {
-               if (!ramp_time_over(td) ||
+               if (!in_ramp_time(td) ||
                    !(td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING)) {
                        next = min(td->o.iops_avg_time, td->o.bw_avg_time);
                        continue;
diff --git a/time.c b/time.c
index 0e64af55ff96b0a9179367f60ca8f3a7ae90f798..f1c5d3fe613e85c4ce0713701aee5c45afdcabdd 100644 (file)
--- a/time.c
+++ b/time.c
@@ -84,7 +84,7 @@ uint64_t utime_since_genesis(void)
        return utime_since_now(&genesis);
 }
 
-int in_ramp_time(struct thread_data *td)
+bool in_ramp_time(struct thread_data *td)
 {
        return td->o.ramp_time && !td->ramp_time_over;
 }
@@ -101,12 +101,12 @@ static void parent_update_ramp(struct thread_data *td)
        td_set_runstate(parent, TD_RAMP);
 }
 
-int ramp_time_over(struct thread_data *td)
+bool ramp_time_over(struct thread_data *td)
 {
        struct timeval tv;
 
        if (!td->o.ramp_time || td->ramp_time_over)
-               return 1;
+               return true;
 
        fio_gettime(&tv, NULL);
        if (utime_since(&td->epoch, &tv) >= td->o.ramp_time) {
@@ -114,10 +114,10 @@ int ramp_time_over(struct thread_data *td)
                reset_all_stats(td);
                td_set_runstate(td, TD_RAMP);
                parent_update_ramp(td);
-               return 1;
+               return true;
        }
 
-       return 0;
+       return false;
 }
 
 void fio_time_init(void)