From e2fc922448086f13c4b5c421ea367c5a4ed54d97 Mon Sep 17 00:00:00 2001 From: Ivan Pepelnjak Date: Fri, 10 Feb 2023 18:45:14 +0100 Subject: [PATCH] timing: a script to measure device boot/config times --- timing/README.md | 9 +++++++++ timing/timing.sh | 20 ++++++++++++++++++++ timing/topology.yml | 7 +++++++ 3 files changed, 36 insertions(+) create mode 100644 timing/README.md create mode 100755 timing/timing.sh create mode 100644 timing/topology.yml diff --git a/timing/README.md b/timing/README.md new file mode 100644 index 0000000..f4d0ab5 --- /dev/null +++ b/timing/README.md @@ -0,0 +1,9 @@ +# Measure Virtual Device Startup Time + +The script in this directory was used to measure the time it takes to boot a network device and perform the minimal initial configuration. + +If you want to repeat the measurements: + +* [Install netlab](https://netsim-tools.readthedocs.io/en/latest/install.html) +* [Build Vagrant boxes](https://netsim-tools.readthedocs.io/en/latest/labs/libvirt.html) for the networking devices you want to test +* Execute `./timing.sh ` diff --git a/timing/timing.sh b/timing/timing.sh new file mode 100755 index 0000000..8eedf3e --- /dev/null +++ b/timing/timing.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# Time how long it takes to spin up a virtual machine and do initial configuration +# +set -e +if [ -z "$1" ]; then + echo "Specify device type" + exit 1 +fi +for dut in $@; do + echo "Device: $dut" + netlab create -d $dut >/dev/null 2>/dev/null + echo -n "Starting the lab: " + /usr/bin/time -f "%E" bash -c 'netlab up --snapshot --no-config >/dev/null 2>/dev/null || echo "netlab up failed"' + echo -n "Device configuration: " + /usr/bin/time -f "%E" bash -c 'netlab initial >/dev/null 2>/dev/null || echo "netlab up failed"' + netlab down --cleanup >/dev/null 2>/dev/null + echo "... done" + echo "" +done diff --git a/timing/topology.yml b/timing/topology.yml new file mode 100644 index 0000000..8b40151 --- /dev/null +++ b/timing/topology.yml @@ -0,0 +1,7 @@ +# +# Lab topology used to test VM start times +# +nodes: [ dut ] + +links: +- dut