Also available as a gist. Very simple way of measuring execution time in seconds using Ruby

#!/usr/bin/env ruby
# Measure performance in seconds of tasks
# Record Startime For performance measurements
startTime =
#Main part of script goes here
#Calculate and Display Execution Time in seconds
execTime = - startTime
puts "Execution time #{execTime} seconds."

Matlab has a slightly simpler function for this

%Main part goes here