Merge "Add task-args(from yaml file) candidates in /api/v2/yardstick/testcases API"
[yardstick.git] / yardstick / benchmark / scenarios / compute / lmbench_latency_for_cache.bash
1 #!/bin/bash
2
3 ##############################################################################
4 # Copyright (c) 2015 Ericsson AB and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 # Run a lmbench cache latency benchmark in a host and
13 # outputs in json format the array sizes in megabytes and
14 # load latency over all points in that array in nanosecods
15
16 set -e
17
18 REPETITON=$1
19 WARMUP=$2
20
21 NODE_CPU_ARCH="$(uname -m)"
22
23 # write the result to stdout in json format
24 output_json()
25 {
26     read DATA
27     echo $DATA | awk '{printf "{\"L1cache\": %s}", $5}'
28 }
29
30
31 if [ "${NODE_CPU_ARCH}" == "aarch64" ]; then
32     /usr/lib/lmbench/bin/cache -W $WARMUP -N $REPETITON  2>&1 | output_json
33 else
34     /usr/lib/lmbench/bin/x86_64-linux-gnu/cache -W $WARMUP -N $REPETITON  2>&1 | output_json
35 fi