diff options
author | QiLiang <liangqi1@huawei.com> | 2015-09-07 21:55:29 +0800 |
---|---|---|
committer | QiLiang <liangqi1@huawei.com> | 2015-10-15 09:59:34 +0800 |
commit | c967d7365e1256a257ceb9880caa02d6942dfad7 (patch) | |
tree | 6d49f29db2dbbd15023dfeeafd2e5dee9b68531f /yardstick/benchmark/scenarios/compute/cyclictest_benchmark.bash | |
parent | 15e8300a8e85d5907c5ea90da505929b8ca85ca0 (diff) |
Add Cyclictest scenario and sample
Support measuring operating system's high resolution by using Cyclictest.
JIRA: YARDSTICK-122
Change-Id: I2e00ce117e263deaaf52cd2d663b845bd5b65432
Signed-off-by: QiLiang <liangqi1@huawei.com>
Diffstat (limited to 'yardstick/benchmark/scenarios/compute/cyclictest_benchmark.bash')
-rw-r--r-- | yardstick/benchmark/scenarios/compute/cyclictest_benchmark.bash | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/yardstick/benchmark/scenarios/compute/cyclictest_benchmark.bash b/yardstick/benchmark/scenarios/compute/cyclictest_benchmark.bash new file mode 100644 index 000000000..5da3e171b --- /dev/null +++ b/yardstick/benchmark/scenarios/compute/cyclictest_benchmark.bash @@ -0,0 +1,48 @@ +#!/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/cyclictest-out.log + +# run cyclictest test +run_cyclictest() +{ + cyclictest $OPTIONS > $OUTPUT_FILE +} + +# write the result to stdout in json format +output_json() +{ + min=$(awk '/# Min Latencies:/{print $4}' $OUTPUT_FILE) + avg=$(awk '/# Avg Latencies:/{print $4}' $OUTPUT_FILE) + max=$(awk '/# Max Latencies:/{print $4}' $OUTPUT_FILE) + echo -e "{ \ + \"min\":\"$min\", \ + \"avg\":\"$avg\", \ + \"max\":\"$max\" \ + }" +} + +# main entry +main() +{ + # run the test + run_cyclictest + + # output result + output_json +} + +main + |