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 6f3752f..3af604b 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)
 {
-       struct thread_data *td = data;
+       struct thread_data *td = cb_data_to_td(data);
        double val;
        char *nr;
        char *pct;
diff --git a/stat.c b/stat.c
index 0eb87bd..c41ac89 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_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);
index 235deac..1f53ae4 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)
-                                       ss->sum_xy += ss->iops_data[j];
+                                       ss->sum_xy += i * ss->iops_data[j];
                                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;