Skip to content

Commit

Permalink
slightly better test with method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Jan 16, 2013
1 parent dba1c34 commit 2cdcc25
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions test.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
$:.unshift 'ext'
require 'rblineprof'

profile = lineprof(/./) do
def inner
sleep 0.001
1*2*3
4*5*6
7*8*9*10*11*12*13*14*15
2**32
2**128
end

def outer
sleep 0.001

100.times do
inner
end

sleep 0.001
1*2*3
4*5*6
7*8*9*10*11*12*13*14*15
2**32
2**128
inner
end

end
profile = lineprof(/./) do
outer
end

File.readlines(__FILE__).each_with_index do |line, num|
if (sample = profile[__FILE__][num+1]) > 0
# printf "% 7d | %s", sample, line
printf "% 8.1fms | %s", sample/1000.0, line
else
# printf " | %s", line
printf " | %s", line
end
end

0 comments on commit 2cdcc25

Please sign in to comment.