diff options
author | Simon Parri <simonparri@ganzeria.com> | 2025-07-22 00:56:22 +0200 |
---|---|---|
committer | Simon Parri <simonparri@ganzeria.com> | 2025-07-22 11:49:01 +0200 |
commit | d2c331b9f036951eef062dd5141c75182375ba12 (patch) | |
tree | 325bf3c56b70ec845e8de9349f45408ed844e747 /common/bin/bandwidthtest | |
download | dotfiles-d2c331b9f036951eef062dd5141c75182375ba12.tar.gz dotfiles-d2c331b9f036951eef062dd5141c75182375ba12.zip |
Add current configuration
Diffstat (limited to 'common/bin/bandwidthtest')
-rwxr-xr-x | common/bin/bandwidthtest | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/common/bin/bandwidthtest b/common/bin/bandwidthtest new file mode 100755 index 0000000..baac413 --- /dev/null +++ b/common/bin/bandwidthtest @@ -0,0 +1,20 @@ +#!/bin/sh + +start="$(($(cat /sys/class/net/$1/statistics/rx_bytes | paste -sd '+')))" +end="$(($(cat /sys/class/net/$1/statistics/rx_bytes | paste -sd '+')))" +if [ "$2" ]; then + delay="$2" +else + delay=10 +fi + +printf "Recording bandwidth.\n" + +report() { +printf '%4dB\n' $(numfmt --to=iec $(($end - $start))) +} + +trap report SIGINT +while sleep "$delay"; do + report +done |