steadystate: reject job if steadystate options are not consistent within reporting...
authorVincent Fu <Vincent.Fu@sandisk.com>
Fri, 28 Oct 2016 19:19:57 +0000 (15:19 -0400)
committerVincent Fu <Vincent.Fu@sandisk.com>
Tue, 22 Nov 2016 18:53:20 +0000 (13:53 -0500)
TODO
init.c
steadystate.c
steadystate.h

diff --git a/TODO b/TODO
index e20857f4b158803680c4a634cab741301d6bd57d..b542626029d2b36c5b8352f8403833c35364e2fc 100644 (file)
--- a/TODO
+++ b/TODO
@@ -6,11 +6,6 @@ Known issues/TODO (for steady-state)
 
 - Add example job files
 
-- group_reporting must be set for every job in a group
-
-- Undefined behavior when steady state options differ across jobs in a
-  single group
-
 - Allow user to specify the frequency of measurements
 
 - Better documentation for output
diff --git a/init.c b/init.c
index 8d2603aadac55a22dfdf49612fdbc3ce740a02bd..9f69b3c2394667d03053931e2adcb18d78f5cd3a 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1578,7 +1578,8 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
                        log_info("...\n");
        }
 
-       td_steadystate_init(td);
+       if (td_steadystate_init(td))
+               goto err;
 
        /*
         * recurse add identical jobs, clear numjobs and stonewall options
index 1f53ae46a88b504c225144a13563635422c72657..4dd7f4268f410ad852ffbd20938dcbda44ceee2e 100644 (file)
@@ -294,31 +294,52 @@ void steadystate_check(void)
        }
 }
 
-void td_steadystate_init(struct thread_data *td)
+int td_steadystate_init(struct thread_data *td)
 {
        struct steadystate_data *ss = &td->ss;
        struct thread_options *o = &td->o;
+       struct thread_data *td2;
+       int j;
 
        memset(ss, 0, sizeof(*ss));
 
-       if (!o->ss_dur)
-               return;
+       if (o->ss_dur) {
+               steadystate_enabled = true;
+               o->ss_dur /= 1000000L;
+
+               /* put all steady state info in one place */
+               ss->dur = o->ss_dur;
+               ss->limit = o->ss_limit.u.f;
+               ss->ramp_time = o->ss_ramp_time;
+               ss->pct = o->ss_pct;
 
-       steadystate_enabled = true;
-       o->ss_dur /= 1000000L;
+               ss->state = o->ss;
+               if (!td->ss.ramp_time)
+                       ss->state |= __FIO_SS_RAMP_OVER;
 
-       /* put all steady state info in one place */
-       ss->dur = o->ss_dur;
-       ss->limit = o->ss_limit.u.f;
-       ss->ramp_time = o->ss_ramp_time;
-       ss->pct = o->ss_pct;
+               ss->sum_x = o->ss_dur * (o->ss_dur - 1) / 2;
+               ss->sum_x_sq = (o->ss_dur - 1) * (o->ss_dur) * (2*o->ss_dur - 1) / 6;
 
-       ss->state = o->ss;
-       if (!td->ss.ramp_time)
-               ss->state |= __FIO_SS_RAMP_OVER;
+               td->ts.ss = ss;
+       }
 
-       ss->sum_x = o->ss_dur * (o->ss_dur - 1) / 2;
-       ss->sum_x_sq = (o->ss_dur - 1) * (o->ss_dur) * (2*o->ss_dur - 1) / 6;
+       /* make sure that ss options are consistent within reporting group */
+       for_each_td(td2, j) {
+               if (td2->groupid == td->groupid) {
+                       struct steadystate_data *ss2 = &td2->ss;
+
+                       if (ss2->dur != ss->dur ||
+                           ss2->limit != ss->limit ||
+                           ss2->ramp_time != ss->ramp_time ||
+                           ss2->pct != ss->pct ||
+                           ss2->state != ss->state ||
+                           ss2->sum_x != ss->sum_x ||
+                           ss2->sum_x_sq != ss->sum_x_sq) {
+                               td_verror(td, EINVAL, "job rejected: steadystate options must be consistent within reporting groups");
+                               return 1;
+                       }
+               }
+       }
 
-       td->ts.ss = ss;
+       return 0;
 }
index 43670c12b0bb50394431b5d3bacdb4a2d1b80989..209314fbee821039a4af0e29a58d8ee4e88e5f57 100644 (file)
@@ -5,7 +5,7 @@
 
 extern void steadystate_check(void);
 extern void steadystate_setup(void);
-extern void td_steadystate_init(struct thread_data *);
+extern int td_steadystate_init(struct thread_data *);
 
 extern bool steadystate_enabled;