summaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/networking/ping_benchmark.bash
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/benchmark/scenarios/networking/ping_benchmark.bash')
-rw-r--r--yardstick/benchmark/scenarios/networking/ping_benchmark.bash22
1 files changed, 22 insertions, 0 deletions
diff --git a/yardstick/benchmark/scenarios/networking/ping_benchmark.bash b/yardstick/benchmark/scenarios/networking/ping_benchmark.bash
new file mode 100644
index 000000000..6916b771a
--- /dev/null
+++ b/yardstick/benchmark/scenarios/networking/ping_benchmark.bash
@@ -0,0 +1,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}'