From: daz Date: 2003-06-02T22:25:38+09:00 Subject: Re: IF statement in ruby 1.8.0 (2003-05-26) [i386-mswin32] "Shashank Date" wrote: > > > What is "call timing" ? Time when a particular call was made ? > I took this to mean that the frequency and/or sequence of calls is "undefined" at present. Don't write code in a set_trace_func proc that depends on 'line' events being the same in the future as they are now. If this gives you a problem, you can save the line number so that your proc is called only once per line. Note that some single-line iterations are filtered out (lost) even though multiple genuine new-line calls were received. #---------------------------------------------------------------- prev_line = nil set_trace_func proc {| event, fi, line, oi, bi, cl | case event when 'line' if (( true)) and prev_line == line # <- change to ((!true)) print '[+ ]' else printf("[%-2d]", line) end else print '.' # other events end prev_line = line } ### line :15 def roo 3.times do 0 end end a = 1 a = 2 if true if true then a = 3 end a = 4; a -= 1 while a > 0 2.times do z = 5 end 2.times do z = 6 +7 end roo #---------------------------------------------------------------- Change (( true)) to (( !true)) on line 5 to remove the filter [+ ] shows a repeat of the prior line [nn] all other events show as dots Results: Two long lines from two runs split and grouped (IfYouKnowWhatIMean) [16]..[21][23][+ ][24][+ ][+ ][25][+ ]............... (( true)) [16]..[21][23][23][24][24][24][25][25]............... ((!true)) ....[26].[27][+ ].[29].[30][31][30][31].[33].[17].[18][+ ][+ ].. (( true)) ....[26].[27][27].[29].[30][31][30][31].[33].[17].[18][18][18].. ((!true)) I'm sure others will step in and help if you're not happy or if I've triggered a GC.start - (I've seen Matz has replied to you. Posting anyway.) daz -- Slap me; I feel little pain. ;-)