From 94f218f6e5ef1eb2bc9190f72df5c8d105e0bac3 Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Thu, 27 Oct 2016 16:36:43 -0400 Subject: [PATCH] steadystate: bug fixes 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 | 2 +- stat.c | 2 +- steadystate.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/options.c b/options.c index 6f3752fa..3af604bd 100644 --- 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 0eb87bdb..c41ac899 100644 --- 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); diff --git a/steadystate.c b/steadystate.c index 235deac5..1f53ae46 100644 --- a/steadystate.c +++ b/steadystate.c @@ -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; -- 2.25.1