Merge "Bug Fix: force the network to attacht to trex to start the traffic"
[yardstick.git] / yardstick / benchmark / scenarios / compute / lmbench_bandwidth_benchmark.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 memory bandwidth benchmark in a host and
13 # output in json format the memory size in megabytes and
14 # memory bandwidth in megabytes per second
15
16 set -e
17
18 SIZE=$1
19 TEST_NAME=$2
20 WARMUP=$3
21
22 # write the result to stdout in json format
23 output_json()
24 {
25     read DATA
26     echo $DATA | awk '/ /{printf "{\"size(MB)\": %s, \"bandwidth(MBps)\": %s}", $1, $2}'
27 }
28
29 /usr/lib/lmbench/bin/x86_64-linux-gnu/bw_mem -W $WARMUP ${SIZE}k $TEST_NAME 2>&1 | output_json