blob: 04e3c1a9dd86fa523f2c8ad87a110988dd4f5b9f (
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
|
#!/bin/bash
##############################################################################
# Copyright (c) 2015 Ericsson AB 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
##############################################################################
# Run a lmbench read memory latency benchmark in a host and
# outputs in json format the array sizes in megabytes and
# load latency over all points in that array in nanosecods
set -e
SIZE=$1
shift
STRIDE=$1
# write the result to stdout in json format
output_json()
{
iter=0
echo [
while read DATA
do
if [ $iter -gt 1 ] && [ -n "$DATA" ]; then
echo ,
fi
echo -n $DATA | awk '/ /{printf "{\"size\": %s, \"latency\": %s}", $1, $2}'
iter=$((iter+1))
done
echo ]
}
/usr/lib/lmbench/bin/x86_64-linux-gnu/lat_mem_rd $SIZE $STRIDE 2>&1 | output_json
|