Skip to content

Commit

Permalink
Merge #124
Browse files Browse the repository at this point in the history
124: Add netbench runner r=stlankes a=mkroening

This little script helps running `netbench`.

I am not sure if we would even want such a thing upstream. The amount of RAM and the arguments for `netbench` has still to be debated about.

What do you think?



Co-authored-by: Martin Kröning <mkroening@posteo.net>
  • Loading branch information
bors[bot] and mkroening committed May 30, 2021
2 parents 204578e + 9d0e6c5 commit a1ea685
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions benches/netbench/run.sh
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

# Usage: run.sh TARGET BIN
# Example: run.sh linux server-bw
# run.sh hermit client-bw

set -o errexit

netbench_dir="${0%/*}"
root_dir="$netbench_dir"/../..
rusty_loader_dir="$root_dir"/loader

bin=$2
args="--bytes 1048576 --rounds 1000"

hermit() {
echo "Building rusty-loader"

make -C "$rusty_loader_dir" release=1

echo "Building $bin image"

cargo build --manifest-path "$netbench_dir"/Cargo.toml --bin $bin \
--release

echo "Launching $bin image on QEMU"

qemu-system-x86_64 -cpu host \
-enable-kvm -display none -smp 1 -m 1G -serial stdio \
-kernel "$rusty_loader_dir"/target/x86_64-unknown-hermit-loader/release/rusty-loader \
-initrd "$root_dir"/target/x86_64-unknown-hermit/release/$bin \
-netdev tap,id=net0,ifname=tap10,script=no,downscript=no,vhost=on \
-device virtio-net-pci,netdev=net0,disable-legacy=on \
-append "-- --nonblocking 0 --address 10.0.5.1 $args"
}

linux() {
echo "Launching $bin on linux"

cargo run --manifest-path "$netbench_dir"/Cargo.toml --bin $bin \
--release \
--target x86_64-unknown-linux-gnu \
-- \
--nonblocking 0 --address 10.0.5.3 $args
}

$1

0 comments on commit a1ea685

Please sign in to comment.