fio: better distinguish between high and low priority
authorVincent Fu <vincent.fu@wdc.com>
Thu, 30 Jan 2020 22:37:05 +0000 (17:37 -0500)
committerVincent Fu <vincent.fu@wdc.com>
Tue, 4 Feb 2020 15:14:04 +0000 (10:14 -0500)
Change the variable names for the low priority latency variables to
explicity distinguish them from the high priority latency variables.
Also rename the JSON objects to do the same. This reduces the mental
effort required to read the code and output.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
client.c
init.c
server.c
stat.c
stat.h

index e8f6fd4..b757559 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1037,10 +1037,10 @@ static void convert_ts(struct thread_stat *dst, struct thread_stat *src)
        for (i = 0; i < DDIR_RWDIR_CNT; i++) {
                for (j = 0; j < FIO_IO_U_PLAT_NR; j++) {
                        dst->io_u_plat_high_prio[i][j] = le64_to_cpu(src->io_u_plat_high_prio[i][j]);
-                       dst->io_u_plat_prio[i][j] = le64_to_cpu(src->io_u_plat_prio[i][j]);
+                       dst->io_u_plat_low_prio[i][j] = le64_to_cpu(src->io_u_plat_low_prio[i][j]);
                }
                convert_io_stat(&dst->clat_high_prio_stat[i], &src->clat_high_prio_stat[i]);
-               convert_io_stat(&dst->clat_prio_stat[i], &src->clat_prio_stat[i]);
+               convert_io_stat(&dst->clat_low_prio_stat[i], &src->clat_low_prio_stat[i]);
        }
 
        dst->ss_dur             = le64_to_cpu(src->ss_dur);
diff --git a/init.c b/init.c
index e231336..b531533 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1509,7 +1509,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
                td->ts.bw_stat[i].min_val = ULONG_MAX;
                td->ts.iops_stat[i].min_val = ULONG_MAX;
                td->ts.clat_high_prio_stat[i].min_val = ULONG_MAX;
-               td->ts.clat_prio_stat[i].min_val = ULONG_MAX;
+               td->ts.clat_low_prio_stat[i].min_val = ULONG_MAX;
        }
        td->ts.sync_stat.min_val = ULONG_MAX;
        td->ddir_seq_nr = o->ddir_seq_nr;
index 558c599..248a2d4 100644 (file)
--- a/server.c
+++ b/server.c
@@ -1579,10 +1579,10 @@ void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs)
        for (i = 0; i < DDIR_RWDIR_CNT; i++) {
                for (j = 0; j < FIO_IO_U_PLAT_NR; j++) {
                        p.ts.io_u_plat_high_prio[i][j] = cpu_to_le64(ts->io_u_plat_high_prio[i][j]);
-                       p.ts.io_u_plat_prio[i][j] = cpu_to_le64(ts->io_u_plat_prio[i][j]);
+                       p.ts.io_u_plat_low_prio[i][j] = cpu_to_le64(ts->io_u_plat_low_prio[i][j]);
                }
                convert_io_stat(&p.ts.clat_high_prio_stat[i], &ts->clat_high_prio_stat[i]);
-               convert_io_stat(&p.ts.clat_prio_stat[i], &ts->clat_prio_stat[i]);
+               convert_io_stat(&p.ts.clat_low_prio_stat[i], &ts->clat_low_prio_stat[i]);
        }
 
        convert_gs(&p.rs, rs);
diff --git a/stat.c b/stat.c
index 778cc4a..55f2d8b 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -514,7 +514,7 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
 
                /* Only print this if some high and low priority stats were collected */
                if (ts->clat_high_prio_stat[ddir].samples > 0 &&
-                       ts->clat_prio_stat[ddir].samples > 0)
+                       ts->clat_low_prio_stat[ddir].samples > 0)
                {
                        sprintf(prio_name, "high prio (%.2f%%) %s",
                                        100. * (double) ts->clat_high_prio_stat[ddir].samples / (double) samples,
@@ -525,10 +525,10 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
                                                ts->percentile_precision, prio_name, out);
 
                        sprintf(prio_name, "low prio (%.2f%%) %s",
-                                       100. * (double) ts->clat_prio_stat[ddir].samples / (double) samples,
+                                       100. * (double) ts->clat_low_prio_stat[ddir].samples / (double) samples,
                                        name);
-                       show_clat_percentiles(ts->io_u_plat_prio[ddir],
-                                               ts->clat_prio_stat[ddir].samples,
+                       show_clat_percentiles(ts->io_u_plat_low_prio[ddir],
+                                               ts->clat_low_prio_stat[ddir].samples,
                                                ts->percentile_list,
                                                ts->percentile_precision, prio_name, out);
                }
@@ -1355,10 +1355,10 @@ static void add_ddir_status_json(struct thread_stat *ts,
                const char *high, *low;
 
                if (ts->lat_percentiles) {
-                       high = "lat_prio";
+                       high = "lat_high_prio";
                        low = "lat_low_prio";
                } else {
-                       high = "clat_prio";
+                       high = "clat_high_prio";
                        low = "clat_low_prio";
                }
 
@@ -1367,7 +1367,7 @@ static void add_ddir_status_json(struct thread_stat *ts,
                json_object_add_value_object(dir_object, high, tmp_object);
 
                tmp_object = add_ddir_lat_json(ts, ts->clat_percentiles | ts->lat_percentiles,
-                               &ts->clat_prio_stat[ddir], ts->io_u_plat_prio[ddir]);
+                               &ts->clat_low_prio_stat[ddir], ts->io_u_plat_low_prio[ddir]);
                json_object_add_value_object(dir_object, low, tmp_object);
        }
 
@@ -1876,7 +1876,7 @@ void sum_thread_stats(struct thread_stat *dst, struct thread_stat *src,
                if (!dst->unified_rw_rep) {
                        sum_stat(&dst->clat_stat[l], &src->clat_stat[l], first, false);
                        sum_stat(&dst->clat_high_prio_stat[l], &src->clat_high_prio_stat[l], first, false);
-                       sum_stat(&dst->clat_prio_stat[l], &src->clat_prio_stat[l], first, false);
+                       sum_stat(&dst->clat_low_prio_stat[l], &src->clat_low_prio_stat[l], first, false);
                        sum_stat(&dst->slat_stat[l], &src->slat_stat[l], first, false);
                        sum_stat(&dst->lat_stat[l], &src->lat_stat[l], first, false);
                        sum_stat(&dst->bw_stat[l], &src->bw_stat[l], first, true);
@@ -1889,7 +1889,7 @@ void sum_thread_stats(struct thread_stat *dst, struct thread_stat *src,
                } else {
                        sum_stat(&dst->clat_stat[0], &src->clat_stat[l], first, false);
                        sum_stat(&dst->clat_high_prio_stat[l], &src->clat_high_prio_stat[l], first, false);
-                       sum_stat(&dst->clat_prio_stat[l], &src->clat_prio_stat[l], first, false);
+                       sum_stat(&dst->clat_low_prio_stat[l], &src->clat_low_prio_stat[l], first, false);
                        sum_stat(&dst->slat_stat[0], &src->slat_stat[l], first, false);
                        sum_stat(&dst->lat_stat[0], &src->lat_stat[l], first, false);
                        sum_stat(&dst->bw_stat[0], &src->bw_stat[l], first, true);
@@ -1957,10 +1957,10 @@ void sum_thread_stats(struct thread_stat *dst, struct thread_stat *src,
                for (m = 0; m < FIO_IO_U_PLAT_NR; m++) {
                        if (!dst->unified_rw_rep) {
                                dst->io_u_plat_high_prio[k][m] += src->io_u_plat_high_prio[k][m];
-                               dst->io_u_plat_prio[k][m] += src->io_u_plat_prio[k][m];
+                               dst->io_u_plat_low_prio[k][m] += src->io_u_plat_low_prio[k][m];
                        } else {
                                dst->io_u_plat_high_prio[0][m] += src->io_u_plat_high_prio[k][m];
-                               dst->io_u_plat_prio[0][m] += src->io_u_plat_prio[k][m];
+                               dst->io_u_plat_low_prio[0][m] += src->io_u_plat_low_prio[k][m];
                        }
 
                }
@@ -1996,7 +1996,7 @@ void init_thread_stat(struct thread_stat *ts)
                ts->bw_stat[j].min_val = -1UL;
                ts->iops_stat[j].min_val = -1UL;
                ts->clat_high_prio_stat[j].min_val = -1UL;
-               ts->clat_prio_stat[j].min_val = -1UL;
+               ts->clat_low_prio_stat[j].min_val = -1UL;
        }
        ts->sync_stat.min_val = -1UL;
        ts->groupid = -1;
@@ -2626,7 +2626,7 @@ void reset_io_stats(struct thread_data *td)
 
        for (i = 0; i < DDIR_RWDIR_CNT; i++) {
                reset_io_stat(&ts->clat_high_prio_stat[i]);
-               reset_io_stat(&ts->clat_prio_stat[i]);
+               reset_io_stat(&ts->clat_low_prio_stat[i]);
                reset_io_stat(&ts->clat_stat[i]);
                reset_io_stat(&ts->slat_stat[i]);
                reset_io_stat(&ts->lat_stat[i]);
@@ -2641,7 +2641,7 @@ void reset_io_stats(struct thread_data *td)
 
                for (j = 0; j < FIO_IO_U_PLAT_NR; j++) {
                        ts->io_u_plat_high_prio[i][j] = 0;
-                       ts->io_u_plat_prio[i][j] = 0;
+                       ts->io_u_plat_low_prio[i][j] = 0;
                        if (!i)
                                ts->io_u_sync_plat[j] = 0;
                }
@@ -2808,7 +2808,7 @@ static void add_lat_percentile_sample(struct thread_stat *ts,
        add_lat_percentile_sample_noprio(ts, nsec, ddir, lat);
 
        if (!priority_bit)
-               ts->io_u_plat_prio[ddir][idx]++;
+               ts->io_u_plat_low_prio[ddir][idx]++;
        else
                ts->io_u_plat_high_prio[ddir][idx]++;
 }
@@ -2831,7 +2831,7 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
                if (priority_bit)
                        add_stat_sample(&ts->clat_high_prio_stat[ddir], nsec);
                else
-                       add_stat_sample(&ts->clat_prio_stat[ddir], nsec);
+                       add_stat_sample(&ts->clat_low_prio_stat[ddir], nsec);
        }
 
        if (td->clat_log)
@@ -2937,7 +2937,7 @@ void add_lat_sample(struct thread_data *td, enum fio_ddir ddir,
                if (priority_bit)
                        add_stat_sample(&ts->clat_high_prio_stat[ddir], nsec);
                else
-                       add_stat_sample(&ts->clat_prio_stat[ddir], nsec);
+                       add_stat_sample(&ts->clat_low_prio_stat[ddir], nsec);
 
        }
        if (needs_lock)
diff --git a/stat.h b/stat.h
index 3c1653f..0d14166 100644 (file)
--- a/stat.h
+++ b/stat.h
@@ -250,9 +250,9 @@ struct thread_stat {
        fio_fp64_t ss_criterion;
 
        uint64_t io_u_plat_high_prio[DDIR_RWDIR_CNT][FIO_IO_U_PLAT_NR] __attribute__((aligned(8)));;
-       uint64_t io_u_plat_prio[DDIR_RWDIR_CNT][FIO_IO_U_PLAT_NR];
+       uint64_t io_u_plat_low_prio[DDIR_RWDIR_CNT][FIO_IO_U_PLAT_NR];
        struct io_stat clat_high_prio_stat[DDIR_RWDIR_CNT] __attribute__((aligned(8)));
-       struct io_stat clat_prio_stat[DDIR_RWDIR_CNT];
+       struct io_stat clat_low_prio_stat[DDIR_RWDIR_CNT];
 
        union {
                uint64_t *ss_iops_data;