From: Paul Brannan Date: 2002-02-07T06:29:24+09:00 Subject: Re: eruby / profiler magic? On Thu, Feb 07, 2002 at 04:22:15AM +0900, Patrick May wrote: > Basically, I want the profile information to be sent back to the > browser. Does anyone know the magic words (Please...)? I don't know of any way to do that. There are a couple of problems. One problem is that the profiler displays its output when ruby exits, but once ruby has exited, you have already printed . It also prints to STDERR, which will cause an internal server error if it is not redirected. And if you redirect it to STDOUT, then the profiler output seems to get put before the tag. I was able to write a ruby extension that called rb_exec_end_proc to force output to occur in the correct place, but this still had problems. The profiler gets sort of confused by the line numbers in the rhtml file. When I did finally get some output (not to the webpage, but by running eruby on the cmd line), I saw the following: % cumulative self self total time seconds seconds calls ms/call ms/call name 92.31 0.12 0.12 1 120.00 130.00 Fixnum#times 7.69 0.13 0.01 1000 0.01 0.01 Fixnum#+ 0.00 0.13 0.00 1 0.00 0.00

Results:

  1010
.write
  0.00     0.13      0.00        1     0.00     0.00  Kernel.require
  0.00     0.13      0.00        1     0.00     0.00  


Results:

  1010.write
  0.00     0.13      0.00        1     0.00     0.00  Fixnum#to_s
  0.00     0.13      0.00        1     0.00     0.00  IO#flush
  0.00     0.13      0.00        1     0.00     0.00  Kernel.puts
  0.00     0.13      0.00        1     0.00   130.00  #toplevel

The profiler output should not contain html.

Perhaps someone who has been working with eruby longer than me has a
better solution, but I think the best answer is going to be to modify
profile.rb to work with eruby; a modified profiler is probably not going
to be useful to the general public, though.

Paul