Skip to content

Instantly share code, notes, and snippets.

@makotom
Created March 17, 2023 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makotom/c7430d38ff22ef8e7561a0da70529c2b to your computer and use it in GitHub Desktop.
Save makotom/c7430d38ff22ef8e7561a0da70529c2b to your computer and use it in GitHub Desktop.
#!/bin/bash
CONCURRENCY=8
RESULT_DIR="$(mktemp -d -p ./)"
for iter in $(seq 1 "${CONCURRENCY}"); do
./ndt7-client.exe -format json | tail -n 1 >"${RESULT_DIR}/${iter}" &
done
until [[ "$(jobs | grep -c Running)" -eq 0 ]]; do
sleep 1
done
echo -n 'Download: '
find "./${RESULT_DIR}/"* -exec jq -r '.Download.Throughput.Value' {} \; | awk '{ s += $1 } END { print s "Mbps" }'
echo -n 'Upload: '
find "./${RESULT_DIR}/"* -exec jq -r '.Upload.Throughput.Value' {} \; | awk '{ s += $1 } END { print s " Mbps" }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment