steadystate: bug fixes
authorVincent Fu <Vincent.Fu@sandisk.com>
Thu, 27 Oct 2016 20:36:43 +0000 (16:36 -0400)
committerVincent Fu <Vincent.Fu@sandisk.com>
Tue, 22 Nov 2016 18:53:08 +0000 (13:53 -0500)
1) Fix steadystate option parsing callback bug
2) Re-insert missing multiplier in slope calculation
3) Revert 'attained' in the JSON output to be either 0 or 1

options.c
stat.c
steadystate.c

index 6f3752fab3ef25ca0a7efbd2dedaa4c2ee268f5d..3af604bd86f4d01ac2abd4d6394960bbd8af4a47 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1063,7 +1063,7 @@ static int str_random_distribution_cb(void *data, const char *str)
 
 static int str_steadystate_cb(void *data, const char *str)
 {
 
 static int str_steadystate_cb(void *data, const char *str)
 {
-       struct thread_data *td = data;
+       struct thread_data *td = cb_data_to_td(data);
        double val;
        char *nr;
        char *pct;
        double val;
        char *nr;
        char *pct;
diff --git a/stat.c b/stat.c
index 0eb87bdb42b2c88f6e4069e361d6e8a94124f758..c41ac899829f622be67bec5ed364d78320b64984 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1276,7 +1276,7 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts,
                json_object_add_value_string(tmp, "ss", ss_buf);
                json_object_add_value_int(tmp, "duration", (int)ss->dur);
                json_object_add_value_int(tmp, "steadystate_ramptime", ss->ramp_time / 1000000L);
                json_object_add_value_string(tmp, "ss", ss_buf);
                json_object_add_value_int(tmp, "duration", (int)ss->dur);
                json_object_add_value_int(tmp, "steadystate_ramptime", ss->ramp_time / 1000000L);
-               json_object_add_value_int(tmp, "attained", ss->state & __FIO_SS_ATTAINED);
+               json_object_add_value_int(tmp, "attained", (ss->state & __FIO_SS_ATTAINED) > 0);
 
                snprintf(ss_buf, sizeof(ss_buf), "%f%s", (float) ss->criterion, ss->pct ? "%" : "");
                json_object_add_value_string(tmp, "criterion", ss_buf);
 
                snprintf(ss_buf, sizeof(ss_buf), "%f%s", (float) ss->criterion, ss->pct ? "%" : "");
                json_object_add_value_string(tmp, "criterion", ss_buf);
index 235deac5854fb8a572a9321cb7508ae4fb7d3471..1f53ae46a88b504c225144a13563635422c72657 100644 (file)
@@ -84,9 +84,9 @@ static bool steadystate_slope(unsigned long iops, unsigned long bw,
                                if (j >= ss->dur)
                                        j -= ss->dur;
                                if (ss->state & __FIO_SS_IOPS)
                                if (j >= ss->dur)
                                        j -= ss->dur;
                                if (ss->state & __FIO_SS_IOPS)
-                                       ss->sum_xy += ss->iops_data[j];
+                                       ss->sum_xy += i * ss->iops_data[j];
                                else
                                else
-                                       ss->sum_xy += ss->bw_data[j];
+                                       ss->sum_xy += i * ss->bw_data[j];
                        }
                } else {                /* easy to update the sums */
                        ss->sum_y -= ss->oldest_y;
                        }
                } else {                /* easy to update the sums */
                        ss->sum_y -= ss->oldest_y;