summaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark
diff options
context:
space:
mode:
authorhoujingwen <houjingwen@huawei.com>2015-10-08 09:31:36 +0000
committerhoujingwen <houjingwen@huawei.com>2015-10-13 12:22:51 +0800
commitc7a3775d447e29850463893495c08328960cd3d5 (patch)
tree376bfc60d1ae8f8cead7596d651799a4c8344077 /yardstick/benchmark
parent89ee821fd10b1de5cd6d319347627ca540ac57c0 (diff)
Fio scenario support sla
JIRA: YARDSTICK-34 Change-Id: I782ba5845f8bd54a19bad078fe7be546400f7524 Signed-off-by: houjingwen <houjingwen@huawei.com>
Diffstat (limited to 'yardstick/benchmark')
-rw-r--r--yardstick/benchmark/scenarios/storage/fio.py32
1 files changed, 24 insertions, 8 deletions
diff --git a/yardstick/benchmark/scenarios/storage/fio.py b/yardstick/benchmark/scenarios/storage/fio.py
index 42f159164..1107a8b2c 100644
--- a/yardstick/benchmark/scenarios/storage/fio.py
+++ b/yardstick/benchmark/scenarios/storage/fio.py
@@ -114,14 +114,30 @@ class Fio(base.Scenario):
raw_data = json.loads(stdout)
# The bandwidth unit is KB/s, and latency unit is us
- result["read_bw"] = raw_data["jobs"][0]["read"]["bw"]
- result["read_iops"] = raw_data["jobs"][0]["read"]["iops"]
- result["read_lat"] = raw_data["jobs"][0]["read"]["lat"]["mean"]
- result["write_bw"] = raw_data["jobs"][0]["write"]["bw"]
- result["write_iops"] = raw_data["jobs"][0]["write"]["iops"]
- result["write_lat"] = raw_data["jobs"][0]["write"]["lat"]["mean"]
-
- # TODO: add sla check
+ if rw in ["read", "randread", "rw", "randrw"]:
+ result["read_bw"] = raw_data["jobs"][0]["read"]["bw"]
+ result["read_iops"] = raw_data["jobs"][0]["read"]["iops"]
+ result["read_lat"] = raw_data["jobs"][0]["read"]["lat"]["mean"]
+ if rw in ["write", "randwrite", "rw", "randrw"]:
+ result["write_bw"] = raw_data["jobs"][0]["write"]["bw"]
+ result["write_iops"] = raw_data["jobs"][0]["write"]["iops"]
+ result["write_lat"] = raw_data["jobs"][0]["write"]["lat"]["mean"]
+
+ if "sla" in args:
+ for k, v in result.items():
+ if k not in args['sla']:
+ continue
+
+ if "lat" in k:
+ # For lattency small value is better
+ max_v = float(args['sla'][k])
+ assert v <= max_v, "%s %f > " \
+ "sla:%s(%f)" % (k, v, k, max_v)
+ else:
+ # For bandwidth and iops big value is better
+ min_v = int(args['sla'][k])
+ assert v >= min_v, "%s %d < " \
+ "sla:%s(%d)" % (k, v, k, min_v)
return result