From: Sean Chittenden Date: 2002-09-14T05:32:19+09:00 Subject: Re: Dump each method called to stdout? > I've got a script that loops through a bunch of stuff and somewhere > in the middle (not the same place each time) it's hanging. > > Is there a quick way to hook each method call so I can output the > method name to stdout so I can see the last method called before the > hang? Debugging won't work well -- I'd have to step through every > line numerous times until it just happened to hang wherever it does, > and I have no idea if the debugging environ would affect it. What I've done before is set counters that only print goo every few minutes + a stack trace. count = 0 while true # do stuff begin if count == 100 count = 0 raise "Uga" rescue => e print e.backtrace.join("\n") end # do more stuff... count += 1 end There are other ways of doing things, but I've found that to be a decent way of figuring out what's going on in tight loops... you might want to toss in counter that doesn't ever get reset and a time index but I think you get the concept. -sc -- Sean Chittenden