steadystate: get rid of ->ss_pct and encode this information in ->state via __FIO_SS_PCT
authorVincent Fu <Vincent.Fu@sandisk.com>
Tue, 22 Nov 2016 19:06:32 +0000 (14:06 -0500)
committerVincent Fu <Vincent.Fu@sandisk.com>
Tue, 6 Dec 2016 19:46:18 +0000 (14:46 -0500)
This leaves a 32-bit filler in thread_options_pack that can be removed when it is possible to maintain required byte alignment

cconv.c
options.c
stat.c
steadystate.c
steadystate.h
thread_options.h

diff --git a/cconv.c b/cconv.c
index a795f1e9633011288db6c8f50909b907f84ca5cc..a01475a99e433ae82fa40478a8a16814a18be917 100644 (file)
--- a/cconv.c
+++ b/cconv.c
@@ -215,7 +215,6 @@ void convert_thread_options_to_cpu(struct thread_options *o,
        o->ss_dur = le64_to_cpu(top->ss_dur);
        o->ss_ramp_time = le64_to_cpu(top->ss_ramp_time);
        o->ss = le32_to_cpu(top->ss);
        o->ss_dur = le64_to_cpu(top->ss_dur);
        o->ss_ramp_time = le64_to_cpu(top->ss_ramp_time);
        o->ss = le32_to_cpu(top->ss);
-       o->ss_pct = le32_to_cpu(top->ss_pct);
        o->ss_limit.u.f = fio_uint64_to_double(le64_to_cpu(top->ss_limit.u.i));
        o->zone_range = le64_to_cpu(top->zone_range);
        o->zone_size = le64_to_cpu(top->zone_size);
        o->ss_limit.u.f = fio_uint64_to_double(le64_to_cpu(top->ss_limit.u.i));
        o->zone_range = le64_to_cpu(top->zone_range);
        o->zone_size = le64_to_cpu(top->zone_size);
@@ -521,7 +520,6 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
        top->ss_dur = __cpu_to_le64(top->ss_dur);
        top->ss_ramp_time = __cpu_to_le64(top->ss_ramp_time);
        top->ss = cpu_to_le32(top->ss);
        top->ss_dur = __cpu_to_le64(top->ss_dur);
        top->ss_ramp_time = __cpu_to_le64(top->ss_ramp_time);
        top->ss = cpu_to_le32(top->ss);
-       top->ss_pct = cpu_to_le32(top->ss_pct);
        top->ss_limit.u.i = __cpu_to_le64(fio_double_to_uint64(o->ss_limit.u.f));
        top->zone_range = __cpu_to_le64(o->zone_range);
        top->zone_size = __cpu_to_le64(o->zone_size);
        top->ss_limit.u.i = __cpu_to_le64(fio_double_to_uint64(o->ss_limit.u.f));
        top->zone_range = __cpu_to_le64(o->zone_range);
        top->zone_size = __cpu_to_le64(o->zone_size);
index 3af604bd86f4d01ac2abd4d6394960bbd8af4a47..9d471bbdc8da612d9b5e3637a19eaa2f06d2368e 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1099,7 +1099,7 @@ static int str_steadystate_cb(void *data, const char *str)
                if (parse_dryrun())
                        return 0;
 
                if (parse_dryrun())
                        return 0;
 
-               td->o.ss_pct = true;
+               td->o.ss |= __FIO_SS_PCT;
                td->o.ss_limit.u.f = val;
        } else if (td->o.ss & __FIO_SS_IOPS) {
                if (!str_to_float(nr, &val, 0)) {
                td->o.ss_limit.u.f = val;
        } else if (td->o.ss & __FIO_SS_IOPS) {
                if (!str_to_float(nr, &val, 0)) {
@@ -1113,9 +1113,7 @@ static int str_steadystate_cb(void *data, const char *str)
                if (parse_dryrun())
                        return 0;
 
                if (parse_dryrun())
                        return 0;
 
-               td->o.ss_pct = false;
                td->o.ss_limit.u.f = val;
                td->o.ss_limit.u.f = val;
-
        } else {        /* bandwidth criterion */
                if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
                        log_err("fio: steadystate BW threshold postfix parsing failed\n");
        } else {        /* bandwidth criterion */
                if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
                        log_err("fio: steadystate BW threshold postfix parsing failed\n");
@@ -1128,9 +1126,7 @@ static int str_steadystate_cb(void *data, const char *str)
                if (parse_dryrun())
                        return 0;
 
                if (parse_dryrun())
                        return 0;
 
-               td->o.ss_pct = false;
                td->o.ss_limit.u.f = (double) ll;
                td->o.ss_limit.u.f = (double) ll;
-
        }
 
        td->ss.state = td->o.ss;
        }
 
        td->ss.state = td->o.ss;
diff --git a/stat.c b/stat.c
index c41ac899829f622be67bec5ed364d78320b64984..a42ee9b857f1d1745b9425749c6360f60e25a1e1 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1269,7 +1269,7 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts,
                        ss->state & __FIO_SS_IOPS ? "iops" : "bw",
                        ss->state & __FIO_SS_SLOPE ? "_slope" : "",
                        (float) ss->limit,
                        ss->state & __FIO_SS_IOPS ? "iops" : "bw",
                        ss->state & __FIO_SS_SLOPE ? "_slope" : "",
                        (float) ss->limit,
-                       ss->pct ? "%" : "");
+                       ss->state & __FIO_SS_PCT ? "%" : "");
 
                tmp = json_create_object();
                json_object_add_value_object(root, "steadystate", tmp);
 
                tmp = json_create_object();
                json_object_add_value_object(root, "steadystate", tmp);
@@ -1278,7 +1278,8 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts,
                json_object_add_value_int(tmp, "steadystate_ramptime", ss->ramp_time / 1000000L);
                json_object_add_value_int(tmp, "attained", (ss->state & __FIO_SS_ATTAINED) > 0);
 
                json_object_add_value_int(tmp, "steadystate_ramptime", ss->ramp_time / 1000000L);
                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 ? "%" : "");
+               snprintf(ss_buf, sizeof(ss_buf), "%f%s", (float) ss->criterion,
+                       ss->state & __FIO_SS_PCT ? "%" : "");
                json_object_add_value_string(tmp, "criterion", ss_buf);
                json_object_add_value_float(tmp, "max_deviation", ss->deviation);
                json_object_add_value_float(tmp, "slope", ss->slope);
                json_object_add_value_string(tmp, "criterion", ss_buf);
                json_object_add_value_float(tmp, "max_deviation", ss->deviation);
                json_object_add_value_float(tmp, "slope", ss->slope);
index f5d804624d1ccca86ffebdc4254236e1542cad36..696ad164ac2fe159d180a7744d9b4d8a6fd0f323 100644 (file)
@@ -107,7 +107,7 @@ static bool steadystate_slope(unsigned long iops, unsigned long bw,
                 */
                ss->slope = (ss->sum_xy - (double) ss->sum_x * ss->sum_y / ss->dur) /
                                (ss->sum_x_sq - (double) ss->sum_x * ss->sum_x / ss->dur);
                 */
                ss->slope = (ss->sum_xy - (double) ss->sum_x * ss->sum_y / ss->dur) /
                                (ss->sum_x_sq - (double) ss->sum_x * ss->sum_x / ss->dur);
-               if (ss->pct)
+               if (ss->state & __FIO_SS_PCT)
                        ss->criterion = 100.0 * ss->slope / (ss->sum_y / ss->dur);
                else
                        ss->criterion = ss->slope;
                        ss->criterion = 100.0 * ss->slope / (ss->sum_y / ss->dur);
                else
                        ss->criterion = ss->slope;
@@ -172,7 +172,7 @@ static bool steadystate_deviation(unsigned long iops, unsigned long bw,
                        ss->deviation = max(ss->deviation, diff * (diff < 0.0 ? -1.0 : 1.0));
                }
 
                        ss->deviation = max(ss->deviation, diff * (diff < 0.0 ? -1.0 : 1.0));
                }
 
-               if (ss->pct)
+               if (ss->state & __FIO_SS_PCT)
                        ss->criterion = 100.0 * ss->deviation / mean;
                else
                        ss->criterion = ss->deviation;
                        ss->criterion = 100.0 * ss->deviation / mean;
                else
                        ss->criterion = ss->deviation;
@@ -311,7 +311,6 @@ int td_steadystate_init(struct thread_data *td)
                ss->dur = o->ss_dur;
                ss->limit = o->ss_limit.u.f;
                ss->ramp_time = o->ss_ramp_time;
                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->state = o->ss;
                if (!td->ss.ramp_time)
 
                ss->state = o->ss;
                if (!td->ss.ramp_time)
@@ -331,7 +330,6 @@ int td_steadystate_init(struct thread_data *td)
                        if (ss2->dur != ss->dur ||
                            ss2->limit != ss->limit ||
                            ss2->ramp_time != ss->ramp_time ||
                        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) {
                            ss2->state != ss->state ||
                            ss2->sum_x != ss->sum_x ||
                            ss2->sum_x_sq != ss->sum_x_sq) {
index aea8969b6d342d847878d083d66098d9e8ebc888..a23c45ba9efff266891eaecbe5c050d888e471e1 100644 (file)
@@ -16,7 +16,6 @@ struct steadystate_data {
        double limit;
        unsigned long long dur;
        unsigned long long ramp_time;
        double limit;
        unsigned long long dur;
        unsigned long long ramp_time;
-       bool pct;
 
        unsigned int state;
 
 
        unsigned int state;
 
@@ -47,6 +46,7 @@ enum {
        __FIO_SS_ATTAINED       = 8,
        __FIO_SS_RAMP_OVER      = 16,
        __FIO_SS_DATA           = 32,
        __FIO_SS_ATTAINED       = 8,
        __FIO_SS_RAMP_OVER      = 16,
        __FIO_SS_DATA           = 32,
+       __FIO_SS_PCT            = 64,
 
        FIO_SS_IOPS             = __FIO_SS_IOPS,
        FIO_SS_IOPS_SLOPE       = __FIO_SS_IOPS | __FIO_SS_SLOPE,
 
        FIO_SS_IOPS             = __FIO_SS_IOPS,
        FIO_SS_IOPS_SLOPE       = __FIO_SS_IOPS | __FIO_SS_SLOPE,
index f15ebef8710361a3b2677621b16f98003d91ea94..e28c59d01bccfe2b8db9d934310c9686a09db3a2 100644 (file)
@@ -170,7 +170,6 @@ struct thread_options {
        unsigned long long timeout;
        unsigned long long ramp_time;
        unsigned int ss;
        unsigned long long timeout;
        unsigned long long ramp_time;
        unsigned int ss;
-       bool ss_pct;
        fio_fp64_t ss_limit;
        unsigned long long ss_dur;
        unsigned long long ss_ramp_time;
        fio_fp64_t ss_limit;
        unsigned long long ss_dur;
        unsigned long long ss_ramp_time;
@@ -433,7 +432,6 @@ struct thread_options_pack {
        uint64_t ss_dur;
        uint64_t ss_ramp_time;
        uint32_t ss;
        uint64_t ss_dur;
        uint64_t ss_ramp_time;
        uint32_t ss;
-       uint32_t ss_pct;
        fio_fp64_t ss_limit;
        uint32_t overwrite;
        uint32_t bw_avg_time;
        fio_fp64_t ss_limit;
        uint32_t overwrite;
        uint32_t bw_avg_time;
@@ -495,6 +493,7 @@ struct thread_options_pack {
        uint64_t trim_backlog;
        uint32_t clat_percentiles;
        uint32_t percentile_precision;
        uint64_t trim_backlog;
        uint32_t clat_percentiles;
        uint32_t percentile_precision;
+       uint32_t padding;       /* REMOVE ME when possible to maintain alignment */
        fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
 
        uint8_t read_iolog_file[FIO_TOP_STR_MAX];
        fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
 
        uint8_t read_iolog_file[FIO_TOP_STR_MAX];