From 6865f49dcca9de2921255fa89a99f1e7c941a6c7 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 18 Oct 2020 16:07:17 +0300 Subject: add network benchmark over localhost --- benchmarker | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/benchmarker b/benchmarker index 1f8da4d..b83e5b9 100755 --- a/benchmarker +++ b/benchmarker @@ -21,11 +21,33 @@ gotfile() cpubench_xz() { local filename - echo "CPU benchmark (xz on a large sparse file)" + local size + + size=1G filename="$(mktemp)" truncate -s 10G "$filename" + + echo "CPU benchmark (xz on a $size sparse file)" /bin/time --format="%e" xz -T0 < "$filename" > /dev/null rm -f "$filename" } +netbench() +{ + local filename + local port + local size + + filename="$(mktemp)" + port=3858 + size=10G + truncate -s "$size" "$filename" + + echo "Network benchmark (netcat a $size sparse file across localhost)" + nc -l localhost "$port" > /dev/null & + /bin/time --format="%e" nc -N localhost "$port" < "$filename" + rm -f "$filename" +} + cpubench_xz +netbench -- cgit v1.2.1