Skip to content

Instantly share code, notes, and snippets.

@OzuYatamutsu
Created November 8, 2015 01:26
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 OzuYatamutsu/792f0cf542c6ec7c5254 to your computer and use it in GitHub Desktop.
Save OzuYatamutsu/792f0cf542c6ec7c5254 to your computer and use it in GitHub Desktop.
#!/bin/bash
NUM_SAMPLES=50
echo "The following runtime deltas are reported in seconds."
echo "Collecting $NUM_SAMPLES samples..."
# Build project from scratch each time.
prepare_build() {
make clean
make all
export LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH
}
# Performance run
perf_test() {
# Time before
X0=$(date +%s.%N)
# Run test program
./pi_integration_test > /dev/null
# Time after
X1=$(date +%s.%N)
# Time delta
delta=$(python -c "print($X1 - $X0)")
echo $delta
}
# Repeat NUM_SAMPLES times
for (( i=1; i<=$NUM_SAMPLES; i++ )) do
prepare_build > /dev/null
perf_test
done
# Clean up when done
make clean > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment