aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/compute/unixbench_benchmark.bash
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/benchmark/scenarios/compute/unixbench_benchmark.bash')
-rw-r--r--yardstick/benchmark/scenarios/compute/unixbench_benchmark.bash46
1 files changed, 46 insertions, 0 deletions
diff --git a/yardstick/benchmark/scenarios/compute/unixbench_benchmark.bash b/yardstick/benchmark/scenarios/compute/unixbench_benchmark.bash
new file mode 100644
index 000000000..5a5dbc394
--- /dev/null
+++ b/yardstick/benchmark/scenarios/compute/unixbench_benchmark.bash
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2015 Huawei Technologies Co.,Ltd 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
+##############################################################################
+
+set -e
+
+# Commandline arguments
+OPTIONS="$@"
+OUTPUT_FILE=/tmp/unixbench-out.log
+
+# run unixbench test
+run_unixbench()
+{
+ cd /opt/tempT/UnixBench/
+ ./Run $OPTIONS > $OUTPUT_FILE
+}
+
+# write the result to stdout in json format
+output_json()
+{
+ single_score=$(awk '/Score/{print $7}' $OUTPUT_FILE | head -1 )
+ parallel_score=$(awk '/Score/{print $7}' $OUTPUT_FILE | tail -1 )
+ echo -e "{ \
+ \"single_score\":\"$single_score\", \
+ \"parallel_score\":\"$parallel_score\" \
+ }"
+}
+
+# main entry
+main()
+{
+ # run the test
+ run_unixbench
+
+ # output result
+ output_json
+}
+
+main