[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

There's gem chocolate in my profiling peanut butter!

Daniel Berger

5/21/2007 9:39:00 PM

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.

Regards,

Dan

5 Answers

Joel VanderWerf

5/21/2007 10:11:00 PM

0

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

Daniel Berger

5/21/2007 10:24:00 PM

0

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

Eric Hodel

5/21/2007 11:32:00 PM

0

On May 21, 2007, at 15:11, Joel VanderWerf 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

Is RubyProf still being maintained? It has this horribly annoying
bug where it breaks when you return after calling RubyProf.start.
The pure-ruby profile.rb works correctly, Shugo's prof (RubyProf's
ancestor) works correctly, and zenprofile (from ZenHacks) works
correctly.

The bug's been reported at least twice:

http://rubyforge.org/tracker/...
func=detail&aid=5652&group_id=1814&atid=7060

http://rubyforge.org/tracker/...
func=detail&aid=5658&group_id=1814&atid=7060

Daniel Berger

5/22/2007 1:47:00 AM

0

On May 21, 5:32 pm, Eric Hodel <drbr...@segment7.net> wrote:
> On May 21, 2007, at 15:11, Joel VanderWerf 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
>
> Is RubyProf still being maintained? It has this horribly annoying
> bug where it breaks when you return after calling RubyProf.start.
> The pure-ruby profile.rb works correctly, Shugo's prof (RubyProf's
> ancestor) works correctly, and zenprofile (from ZenHacks) works
> correctly.
>
> The bug's been reported at least twice:
>
> http://rubyforge.org/tracker/...
> func=detail&aid=5652&group_id=1814&atid=7060
>
> http://rubyforge.org/tracker/...
> func=detail&aid=5658&group_id=1814&atid=7060

I haven't experienced that myself, and it has been less than a year
since the last release. However, I do see a bunch of bugs in the queue
that haven't been touched, so I dunno.

Shugo, Charlie - you around?

Dan

Stephen Kellett

5/23/2007 6:54:00 PM

0

In message <1179783533.232092.292610@r3g2000prh.googlegroups.com>,
Daniel Berger <djberg96@gmail.com> writes
>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.

Setting that up is trivial with Ruby Performance Validator.

http://www.softwareverify.com/ruby/profiler/...

Stephen
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk/sof...
Computer Consultancy, Software Development
Windows C++, Java, Assembler, Performance Analysis, Troubleshooting
Reg Office: 24 Windmill Walk, Sutton, Ely, Cambs CB6 2NH.