[Fuego] [PATCH] dd: Add new test to measure block device performance

Bird, Timothy Tim.Bird at sony.com
Wed Nov 22 03:42:08 UTC 2017


NOTE: I'm sending this patch to the list to let people know about this new test,
and for any feedback they might have on the patch.  Often, my patches
don't get any review because I just stick them into the repository, but
it's probably good if people see what I'm up to every once in a while. :-)
---

Read approximately 1G (well, 1 million bytes 1024 times), and
report the number of seconds it took to do so.
This was reported by Linus Wallej (a veteran kernel developer) to
be a useful metric to detect changes in block scheduler performance.
In order for this test to be useful, the criteria.json file needs
to be tuned for the board (and block device) under test.

You can specify a BENCHMARK_DD_BLOCK_DEVICE in the board file,
or just "block_device" in a spec file, to control what block
device to measure.  The test has a few rough edges, noted in
comments in the fuego_test.sh file.

Signed-off-by: Tim Bird <tim.bird at sony.com>
---
 engine/tests/Benchmark.dd/criteria.json | 12 ++++++++++++
 engine/tests/Benchmark.dd/fuego_test.sh | 23 +++++++++++++++++++++++
 engine/tests/Benchmark.dd/parser.py     | 21 +++++++++++++++++++++
 engine/tests/Benchmark.dd/spec.json     |  7 +++++++
 4 files changed, 63 insertions(+)
 create mode 100644 engine/tests/Benchmark.dd/criteria.json
 create mode 100644 engine/tests/Benchmark.dd/fuego_test.sh
 create mode 100755 engine/tests/Benchmark.dd/parser.py
 create mode 100644 engine/tests/Benchmark.dd/spec.json

diff --git a/engine/tests/Benchmark.dd/criteria.json b/engine/tests/Benchmark.dd/criteria.json
new file mode 100644
index 0000000..d9469f2
--- /dev/null
+++ b/engine/tests/Benchmark.dd/criteria.json
@@ -0,0 +1,12 @@
+{
+    "schema_version":"1.0",
+    "criteria":[
+        {
+            "tguid":"default.dd_1G.time",
+            "reference":{
+                "value":60,
+                "operator":"lt"
+            }
+        }
+    ]
+}
diff --git a/engine/tests/Benchmark.dd/fuego_test.sh b/engine/tests/Benchmark.dd/fuego_test.sh
new file mode 100644
index 0000000..fca75c4
--- /dev/null
+++ b/engine/tests/Benchmark.dd/fuego_test.sh
@@ -0,0 +1,23 @@
+# NOTES:
+#  * time might not be a standalone program (it can be a shell builtin)
+#    * can't use is_on_target to detect it
+#  * busybox builtin time doesn't produce 'real' line
+#  * autodetect of block device doesn't work for nfs-mounted root filesystems
+#
+function test_pre_check {
+    is_on_target_path dd PROGRAM_DD
+    assert_define PROGRAM_DD "Missing 'dd' program on target"
+    # FIXTHIS - need to handle time as shell builtin case here
+    #is_on_target_path time PROGRAM_TIME
+    #assert_define PROGRAM_TIME "Missing 'time' program on target"
+}
+
+function test_run {
+    if [ -z "$BENCHMARK_DD_BLOCK_DEVICE" ] ; then
+        # if no block device specified, use root fs block device
+        ROOT_MOUNT_STR=$(cmd "mount | grep \" on / \"")
+        # fancy way to get the first string in ROOT_MOUNT_STR
+        BENCHMARK_DD_BLOCK_DEVICE=$(IFS=" "; set -- ${ROOT_MOUNT_STR} ; echo $1)
+    fi
+    report "time dd if=$BENCHMARK_DD_BLOCK_DEVICE of=/dev/null bs=1000000 count=1024"
+}
diff --git a/engine/tests/Benchmark.dd/parser.py b/engine/tests/Benchmark.dd/parser.py
new file mode 100755
index 0000000..6547e87
--- /dev/null
+++ b/engine/tests/Benchmark.dd/parser.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+import os, re, sys
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+regex_string = "^real[\t ]*(.*)m(.*)s"
+
+results = {}
+matches = plib.parse_log(regex_string)
+print("DEBUG: matches=%s" % str(matches))
+
+if matches:
+    minutes = (float)(matches[0][0])
+    seconds = (float)(matches[0][1])
+    time = minutes*60 + seconds
+    results['default.dd_1G'] = \
+            [{"name": "time", "measure" : time}]
+
+sys.exit(plib.process(results))
diff --git a/engine/tests/Benchmark.dd/spec.json b/engine/tests/Benchmark.dd/spec.json
new file mode 100644
index 0000000..1cb0a1e
--- /dev/null
+++ b/engine/tests/Benchmark.dd/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Benchmark.bb",
+    "specs": {
+        "default": {}
+    }
+}
+
-- 
1.9.1



More information about the Fuego mailing list