aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/compute/unixbench_benchmark.bash
blob: 0f0122e51b226c78791bf9698dfa2aa94543a30e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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/UnixBench/
    ./Run $OPTIONS > $OUTPUT_FILE
}

# write the result to stdout in json format
output_json()
{
    single_score=$(awk '/Score/{print $NF}' $OUTPUT_FILE | head -1 )
    parallel_score=$(awk '/Score/{print $NF}' $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