aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/networking/ping_benchmark.bash
diff options
context:
space:
mode:
authorHans Feldt <hans.feldt@ericsson.com>2015-05-20 14:08:22 +0200
committerHans Feldt <hans.feldt@ericsson.com>2015-05-20 14:08:22 +0200
commitc62813e00fd3975fb3b7d94b7b633b68c65a6bf7 (patch)
tree17fe1edb2d465350a07ef15f50ac0adc9dfd6bca /yardstick/benchmark/scenarios/networking/ping_benchmark.bash
parentc157e033e65ad2e34a9c5c265a869cddcc67e106 (diff)
add ping benchmark type
This simple benchmark can be used to measure network latency. Change-Id: I41f5b9f32544b2e668d39220fcfb87ed493f4baa JIRA: - Signed-off-by: Hans Feldt <hans.feldt@ericsson.com>
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}'