Skip to content

Instantly share code, notes, and snippets.

@catatsuy
Last active December 16, 2015 14:39
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 catatsuy/5450309 to your computer and use it in GitHub Desktop.
Save catatsuy/5450309 to your computer and use it in GitHub Desktop.
NUMBER_OF_TRIALS = 3
iterators = (0..12).map { |item| 2 ** item }
iterators.each do |item|
`g++ -O2 -Wall -W -static -std=c++0x -D NUM_COUNTER=#{item} main.cc -o arch.out`
sum = 0
NUMBER_OF_TRIALS.times do
result = `/usr/bin/time -p ./arch.out 2>&1 | grep real | sed -e "s/real//"`
sum += result.to_f
end
puts "%4d, %.2f" % [item, sum / NUMBER_OF_TRIALS]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment