X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=steadystate.c;h=45d4f5d2eeb928306c1b312e20f960b6f9b53506;hp=951376f86796bebea605d80a3c8b279caa4040d2;hb=403bb450a8b48885b05d235ef6bf613561c94bbf;hpb=c7334fa3f3be87854354044615b0c0e473c50713 diff --git a/steadystate.c b/steadystate.c index 951376f8..45d4f5d2 100644 --- a/steadystate.c +++ b/steadystate.c @@ -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; } @@ -201,7 +196,7 @@ void steadystate_check(void) int i, j, ddir, prev_groupid, group_ramp_time_over = 0; unsigned long rate_time; struct thread_data *td, *td2; - struct timeval now; + struct timespec now; uint64_t group_bw = 0, group_iops = 0; uint64_t td_iops, td_bytes; bool ret; @@ -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]; }