Skip to content

Commit

Permalink
timing: a script to measure device boot/config times
Browse files Browse the repository at this point in the history
  • Loading branch information
ipspace committed Feb 10, 2023
1 parent ff0f1e4 commit e2fc922
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
9 changes: 9 additions & 0 deletions timing/README.md
Original file line number Diff line number Diff line change
@@ -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 <list-of-devices>`
20 changes: 20 additions & 0 deletions timing/timing.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions timing/topology.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Lab topology used to test VM start times
#
nodes: [ dut ]

links:
- dut

0 comments on commit e2fc922

Please sign in to comment.