aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/networking/ping_benchmark.bash
blob: 6916b771aa14a45f743d27e007a94e7a0b082f9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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 single ping command towards a destination and outputs the round trip
# time in milliseconds on stdout. The count (-c) option is deliberately not
# supported since it is supposed to be handled by the runner.

set -e

destination=$1
shift
options="$@"

ping -c 1 $options $destination | grep ttl | awk -F [=\ ] '{printf $10}'