On May 21, 4:11 pm, Joel VanderWerf <v... / path.berkeley.edu> wrote:
> Daniel Berger wrote:
> > Hi all,
>
> > Has anyone written anything that will skip all the gem related code
> > that occurs on startup when running a profiler over a program? Is it
> > even possible?
>
> > All that extra stuff in the final output makes it harder to read and
> > generally bugs me.
>
> An excerpt from the README of ruby-prof:
>
> ==================================================
> === ruby-prof API
>
> The second way is to use the ruby-prof API to profile
> particular segments of code.
>
>    require 'ruby-prof'
>
>    # Profile the code
>    RubyProf.start
>    ...
>    [code to profile]
>    ...
>    result = RubyProf.stop
>
>    # Print a flat profile to text
>    printer = RubyProf::TextPrinter.new(result)
>    printer.print(STDOUT, 0)
>
> Alternatively, you can use a block to tell ruby-prof what
> to profile:
>
>    require 'ruby-prof'
>
>    # Profile the code
>    result = RubyProf.profile do
>      ...
>      [code to profile]
>      ...
>    end
>
>    # Print a graph profile to text
>    printer = RubyProf::GraphPrinter.new(result)
>    printer.print(STDOUT, 0)
> ==================================================
>
> If for some reason you want to use profile.rb, it's easy to hack up to
> have the same feature (let me know and I'll send it).
>
> --
>        vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Oh, excellent Joel, thank you. As for profile.rb, I think it would be
great to send that as a patch to ruby-core. :)

Regards,

Dan