Use 0 instead of DDIR_READ to iterate from 0 to DDIR_RWDIR_CNT
[fio.git] / steadystate.c
index bce35b9718f237512597cba8a7710d890d705280..98f027cee4013ac4f75db7a4ade31c8d5f8056fa 100644 (file)
@@ -8,13 +8,8 @@ bool steadystate_enabled = false;
 
 static void steadystate_alloc(struct thread_data *td)
 {
-       int i;
-
-       td->ss.bw_data = malloc(td->ss.dur * sizeof(uint64_t));
-       td->ss.iops_data = malloc(td->ss.dur * sizeof(uint64_t));
-       /* initialize so that it is obvious if the cache is not full in the output */
-       for (i = 0; i < td->ss.dur; i++)
-               td->ss.iops_data[i] = td->ss.bw_data[i] = 0;
+       td->ss.bw_data = calloc(td->ss.dur, sizeof(uint64_t));
+       td->ss.iops_data = calloc(td->ss.dur, sizeof(uint64_t));
 
        td->ss.state |= __FIO_SS_DATA;
 }
@@ -236,7 +231,7 @@ void steadystate_check(void)
                }
 
                td_io_u_lock(td);
-               for (ddir = DDIR_READ; ddir < DDIR_RWDIR_CNT; ddir++) {
+               for (ddir = 0; ddir < DDIR_RWDIR_CNT; ddir++) {
                        td_iops += td->io_blocks[ddir];
                        td_bytes += td->io_bytes[ddir];
                }
@@ -278,7 +273,7 @@ void steadystate_check(void)
                                        (unsigned long long) group_bw,
                                        ss->head, ss->tail);
 
-               if (td->o.ss & __FIO_SS_SLOPE)
+               if (ss->state & __FIO_SS_SLOPE)
                        ret = steadystate_slope(group_iops, group_bw, td);
                else
                        ret = steadystate_deviation(group_iops, group_bw, td);
@@ -317,7 +312,7 @@ int td_steadystate_init(struct thread_data *td)
                ss->limit = o->ss_limit.u.f;
                ss->ramp_time = o->ss_ramp_time;
 
-               ss->state = o->ss;
+               ss->state = o->ss_state;
                if (!td->ss.ramp_time)
                        ss->state |= __FIO_SS_RAMP_OVER;