Merge branch 'master' of https://github.com/yashi/fio
[fio.git] / steadystate.c
index 05ce029924170cce0bd594fdfd94811d888fccad..2017ca67a896fbaba39e7b9e8a7c24369003d5a1 100644 (file)
@@ -6,6 +6,14 @@
 
 bool steadystate_enabled = false;
 
+void steadystate_free(struct thread_data *td)
+{
+       free(td->ss.iops_data);
+       free(td->ss.bw_data);
+       td->ss.iops_data = NULL;
+       td->ss.bw_data = NULL;
+}
+
 static void steadystate_alloc(struct thread_data *td)
 {
        td->ss.bw_data = calloc(td->ss.dur, sizeof(uint64_t));
@@ -16,8 +24,8 @@ static void steadystate_alloc(struct thread_data *td)
 
 void steadystate_setup(void)
 {
-       int i, prev_groupid;
        struct thread_data *td, *prev_td;
+       int i, prev_groupid;
 
        if (!steadystate_enabled)
                return;
@@ -39,17 +47,15 @@ void steadystate_setup(void)
                }
 
                if (prev_groupid != td->groupid) {
-                       if (prev_td != NULL) {
+                       if (prev_td)
                                steadystate_alloc(prev_td);
-                       }
                        prev_groupid = td->groupid;
                }
                prev_td = td;
        }
 
-       if (prev_td != NULL && prev_td->o.group_reporting) {
+       if (prev_td && prev_td->o.group_reporting)
                steadystate_alloc(prev_td);
-       }
 }
 
 static bool steadystate_slope(uint64_t iops, uint64_t bw,