iolog.c: Fix memory leak for blkparse case
[fio.git] / time.c
diff --git a/time.c b/time.c
index 28c20717406029bc584e583810e24416d0cf2457..cd0e2a89144b59a565d88fab6192dda951a8ff2b 100644 (file)
--- a/time.c
+++ b/time.c
@@ -57,6 +57,13 @@ uint64_t usec_sleep(struct thread_data *td, unsigned long usec)
                if (ts >= 1000000) {
                        req.tv_sec = ts / 1000000;
                        ts -= 1000000 * req.tv_sec;
+                       /*
+                        * Limit sleep to ~1 second at most, otherwise we
+                        * don't notice then someone signaled the job to
+                        * exit manually.
+                        */
+                       if (req.tv_sec > 1)
+                               req.tv_sec = 1;
                } else
                        req.tv_sec = 0;
 
@@ -105,7 +112,7 @@ static bool parent_update_ramp(struct thread_data *td)
                return false;
 
        reset_all_stats(parent);
-       parent->ramp_time_over = 1;
+       parent->ramp_time_over = true;
        td_set_runstate(parent, TD_RAMP);
        return true;
 }
@@ -116,8 +123,9 @@ bool ramp_time_over(struct thread_data *td)
                return true;
 
        if (utime_since_now(&td->epoch) >= td->o.ramp_time) {
-               td->ramp_time_over = 1;
+               td->ramp_time_over = true;
                reset_all_stats(td);
+               reset_io_stats(td);
                td_set_runstate(td, TD_RAMP);
 
                /*