diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-10-18 16:07:17 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-10-18 16:07:17 +0300 |
commit | 6865f49dcca9de2921255fa89a99f1e7c941a6c7 (patch) | |
tree | 92790be4c52a23525829d3cd708a99d74f0c0c29 | |
parent | 7877a4e5f91c0da0c3a3531bd1789c0bb1027b20 (diff) | |
download | benchmarker-6865f49dcca9de2921255fa89a99f1e7c941a6c7.tar.gz |
add network benchmark over localhost
-rwxr-xr-x | benchmarker | 24 |
1 files changed, 23 insertions, 1 deletions
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 |