Skip to content

Instantly share code, notes, and snippets.

@juancampa
Created December 12, 2018 20:24
Show Gist options
  • Save juancampa/428c8946038835ee4c46158e267d0ca8 to your computer and use it in GitHub Desktop.
Save juancampa/428c8946038835ee4c46158e267d0ca8 to your computer and use it in GitHub Desktop.
Hyper throughput perf test
#!/bin/bash
RUNS=5
for i in `seq 1 $RUNS`; do
starttime=`date "+%s%3N"`
# Generate a significant amount of output
ls -Rl /usr/ /usr/ /usr/ /usr/
endtime=`date "+%s%3N"`
durations[$i]=$(($endtime-$starttime))
done
avg=0
for i in `seq 1 $RUNS`; do
duration=${durations[$i]}
avg=$(($avg + $duration))
echo Duration: $(($duration/1000)).$(($duration%1000))s
done
avg=$(($avg/$RUNS))
echo Average: $(($avg/1000)).$(($avg%1000))s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment