steadystate: cleanups
[fio.git] / init.c
diff --git a/init.c b/init.c
index 7f91c04819153a8a1159d47e94db719e920611f7..9113865027528f56b1d546c2f29a031c011943db 100644 (file)
--- a/init.c
+++ b/init.c
@@ -81,8 +81,6 @@ unsigned int *fio_debug_jobp = NULL;
 static char cmd_optstr[256];
 static int did_arg;
 
-bool steadystate = false;
-
 #define FIO_CLIENT_FLAG                (1 << 16)
 
 /*
@@ -1586,35 +1584,22 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
 
                /* put all steady state info in one place */
                td->ss.dur = o->ss_dur;
-               td->ss.limit = o->ss_limit.u.f; 
+               td->ss.limit = o->ss_limit.u.f;
                td->ss.ramp_time = o->ss_ramp_time;
                td->ss.pct = o->ss_pct;
 
-               if (o->ss == FIO_STEADYSTATE_IOPS_SLOPE || o->ss == FIO_STEADYSTATE_BW_SLOPE) {
+               if (steadystate_check_slope(o))
                        td->ss.check_slope = true;
-                       td->ss.evaluate = &steadystate_slope;
-               } else {
+               else
                        td->ss.check_slope = false;
-                       td->ss.evaluate = &steadystate_deviation;
-               }
 
                if (o->ss == FIO_STEADYSTATE_IOPS || o->ss == FIO_STEADYSTATE_IOPS_SLOPE)
                        td->ss.check_iops = true;
                else
                        td->ss.check_iops = false;
 
-
-               /* when group reporting is enabled only the cache allocated for the final td is actually used */
-               td->ss.cache = malloc(o->ss_dur * sizeof(*(td->ss.cache)));
-               if (td->ss.cache == NULL)
-               {
-                       log_err("fio: unable to allocate memory for steadystate cache\n");
-                       goto err;
-               }
-               for (i = 0; i < td->ss.dur; i++)
-                       td->ss.cache[i] = 0;
-               /* initialize so that it is obvious if the cache is not full in the output */
-
+               td->ss.bw_data = NULL;
+               td->ss.iops_data = NULL;
                td->ss.ramp_time_over = (td->ss.ramp_time == 0);
                td->ss.attained = 0;
                td->ss.last_in_group = 0;
@@ -1627,9 +1612,10 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
                td->ss.sum_y = 0;
                td->ss.oldest_y = 0;
                td->ss.criterion = 0.0;
+               td->ss.slope = 0.0;
+               td->ss.deviation = 0.0;
                td->ts.ss = &td->ss;
-       }
-       else
+       } else
                td->ts.ss = NULL;
 
        /*
@@ -2195,6 +2181,10 @@ struct debug_level debug_levels[] = {
          .help = "Steady state detection logging",
          .shift = FD_STEADYSTATE,
        },
+       { .name = "helperthread",
+         .help = "Helper thread logging",
+         .shift = FD_HELPERTHREAD,
+       },
        { .name = NULL, },
 };