From 88064c5bd8dc8d14153dd9d26af6a3be1389ff8c Mon Sep 17 00:00:00 2001 From: Gohar Irfan Chaudhry Date: Thu, 3 Aug 2023 13:51:59 -0600 Subject: [PATCH] Fix incorrect y-axis scaling when plotting reads and writes together on the same graph --- fio_plot/fiolib/supporting.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/fio_plot/fiolib/supporting.py b/fio_plot/fiolib/supporting.py index 9a9d10aa64..25a5afa72b 100644 --- a/fio_plot/fiolib/supporting.py +++ b/fio_plot/fiolib/supporting.py @@ -214,7 +214,6 @@ def raw_stddev_to_percent(values, stddev_series): def process_dataset(settings, dataset): - datatypes = [] new_list = [] new_structure = {"datatypes": None, "dataset": None} @@ -258,20 +257,20 @@ def process_dataset(settings, dataset): if x == "bw": scale_factors_bw.append(get_scale_factor_bw(record[rw]["yvalues"])) #print(item["hostname"]) - if settings["draw_total"] and len(settings["filter"]) == 2: - readdata = record["read"]["yvalues"] - writedata = record["write"]["yvalues"] - record["total"] = {} - record["total"]["yvalues"] = [x + y for x, y in zip(readdata, writedata)] - record["total"]["xvalues"] = record["read"]["xvalues"] # hack - if item["type"] in ["lat", "clat", "slat"]: - scale_factors_lat.append(get_scale_factor_lat(record["total"]["yvalues"])) - if "bw" in item["type"]: - scale_factors_bw.append(get_scale_factor_bw(record["total"]["yvalues"])) + if settings["draw_total"] and len(settings["filter"]) == 2: + readdata = record["read"]["yvalues"] + writedata = record["write"]["yvalues"] + record["total"] = {} + record["total"]["yvalues"] = [x + y for x, y in zip(readdata, writedata)] + record["total"]["xvalues"] = record["read"]["xvalues"] # hack + if item["type"] in ["lat", "clat", "slat"]: + scale_factors_lat.append(get_scale_factor_lat(record["total"]["yvalues"])) + if "bw" in item["type"]: + scale_factors_bw.append(get_scale_factor_bw(record["total"]["yvalues"])) #print(item["hostname"]) - new_list.append(record) + new_list.append(record) item.pop("data") - + """ This second loop assures that all data is scaled with the same factor """ @@ -506,4 +505,4 @@ def filter_hosts(settings, item): outcome = True else: outcome = True - return outcome \ No newline at end of file + return outcome