Created
November 17, 2016 14:42
-
-
Save andresilveirah/cbbacfa4ea09d5e87b2ba845472a48c2 to your computer and use it in GitHub Desktop.
A uber ugly script to compute how much time each kind of specs are taking.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "spec_type,examples,time" > specs_times.csv | |
for spec_type in "helpers" "models" "features" "services" "observers" "policies" "validators" "routing" "controllers" "serializers" | |
do | |
total_time=0 | |
examples=$(gtime --format="%e" -o time_output.txt bundle exec rake SPEC=spec/$spec_type 2>/dev/null | grep 'examples' | cut -d" " -f1) | |
real_time=`cat time_output.txt` | |
total_time=$(echo "scale=3; $total_time + $real_time" | bc -l) | |
examples=$(gtime --format="%e" -o time_output.txt bundle exec rake SPEC=spec/$spec_type 2>/dev/null | grep 'examples' | cut -d" " -f1) | |
real_time=`cat time_output.txt` | |
total_time=$(echo "scale=3; $total_time + $real_time" | bc -l) | |
examples=$(gtime --format="%e" -o time_output.txt bundle exec rake SPEC=spec/$spec_type 2>/dev/null | grep 'examples' | cut -d" " -f1) | |
real_time=`cat time_output.txt` | |
total_time=$(echo "scale=3; $total_time + $real_time" | bc -l) | |
avg_time=$(echo "scale=3; $total_time / 3" | bc -l) | |
echo $spec_type,$examples,$avg_time >> specs_times.csv | |
echo $spec_type "done" | |
done | |
$(rm time_output.txt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment