aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/compute/lmbench_latency_benchmark.bash
diff options
context:
space:
mode:
authorKristian Hunt <kristian.hunt@gmail.com>2015-10-13 16:38:56 +0200
committerKristian Hunt <kristian.hunt@gmail.com>2015-10-28 11:38:48 +0100
commit05d5ac8d6d5e9bd1e6b69afbd764000aeb4a030e (patch)
tree2937a8372d4e672f4d8f755950e9e58779cbdc4b /yardstick/benchmark/scenarios/compute/lmbench_latency_benchmark.bash
parentf37d291f6397891cd0dc37c6140b114868921b61 (diff)
Extend lmbench scenario to measure memory bandwidth
Lmbench scenario has now two scripts and will choose between them, based on whether the intention is to run memory latency or bandwidth tests. Added also unit test file for this scenario. JIRA: YARDSTICK-113 Change-Id: I2ba4dbef31f3cafbdb3c583ece5ed9512a906896 Signed-off-by: Kristian Hunt <kristian.hunt@gmail.com>
Diffstat (limited to 'yardstick/benchmark/scenarios/compute/lmbench_latency_benchmark.bash')
-rw-r--r--yardstick/benchmark/scenarios/compute/lmbench_latency_benchmark.bash41
1 files changed, 41 insertions, 0 deletions
diff --git a/yardstick/benchmark/scenarios/compute/lmbench_latency_benchmark.bash b/yardstick/benchmark/scenarios/compute/lmbench_latency_benchmark.bash
new file mode 100644
index 000000000..04e3c1a9d
--- /dev/null
+++ b/yardstick/benchmark/scenarios/compute/lmbench_latency_benchmark.bash
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# Run a lmbench read memory latency benchmark in a host and
+# outputs in json format the array sizes in megabytes and
+# load latency over all points in that array in nanosecods
+
+set -e
+
+SIZE=$1
+shift
+STRIDE=$1
+
+# write the result to stdout in json format
+output_json()
+{
+ iter=0
+ echo [
+ while read DATA
+ do
+ if [ $iter -gt 1 ] && [ -n "$DATA" ]; then
+ echo ,
+ fi
+
+ echo -n $DATA | awk '/ /{printf "{\"size\": %s, \"latency\": %s}", $1, $2}'
+
+ iter=$((iter+1))
+ done
+ echo ]
+}
+
+/usr/lib/lmbench/bin/x86_64-linux-gnu/lat_mem_rd $SIZE $STRIDE 2>&1 | output_json
+