# There's gem chocolate in my profiling peanut butter!

**URL:** <https://www.ruby-forum.com/t/theres-gem-chocolate-in-my-profiling-peanut-butter/104737>\
**Category:** Ruby\
**Created:** [May 21, 2007, 11:41pm UTC](https://www.ruby-forum.com/t/theres-gem-chocolate-in-my-profiling-peanut-butter/104737 "2007-05-21T23:41:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [May 21, 2007, 11:41pm UTC](https://www.ruby-forum.com/t/theres-gem-chocolate-in-my-profiling-peanut-butter/104737/1 "2007-05-21T23:41:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [May 22, 2007, 12:12am UTC](https://www.ruby-forum.com/t/theres-gem-chocolate-in-my-profiling-peanut-butter/104737/2 "2007-05-22T00:12:31Z")

</div>

Daniel B. 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).

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [May 22, 2007, 12:26am UTC](https://www.ruby-forum.com/t/theres-gem-chocolate-in-my-profiling-peanut-butter/104737/3 "2007-05-22T00:26:32Z")

</div>

On May 21, 4:11 pm, Joel VanderWerf [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> An excerpt from the README of ruby-prof:  
> RubyProf.start  
> to profile:
> 
> # 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

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [May 22, 2007, 3:50am UTC](https://www.ruby-forum.com/t/theres-gem-chocolate-in-my-profiling-peanut-butter/104737/4 "2007-05-22T03:50:46Z")

</div>

On May 21, 5:32 pm, Eric H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > generally bugs me.
> 
> ancestor) works correctly, and zenprofile (from ZenHacks) works  
> correctly.
> 
> The bug’s been reported at least twice:
> 
> [http://rubyforge.org/tracker/index.php](http://rubyforge.org/tracker/index.php)?  
> func=detail&aid=5652&group\_id=1814&atid=7060
> 
> [http://rubyforge.org/tracker/index.php](http://rubyforge.org/tracker/index.php)?  
> 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

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [May 23, 2007, 9:01pm UTC](https://www.ruby-forum.com/t/theres-gem-chocolate-in-my-profiling-peanut-butter/104737/5 "2007-05-23T21:01:00Z")

</div>

In message [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid),  
Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.

> **[Software Tools | Software Verify](http://www.softwareverify.com/products/)**
>
> Listing of all our software tools for each language and technology that we support.

Stephen

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [July 10, 2007, 6:16am UTC](https://www.ruby-forum.com/t/theres-gem-chocolate-in-my-profiling-peanut-butter/104737/6 "2007-07-10T06:16:31Z")

</div>

> > 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.

Hi Daniel and Eric,

Yup still around (just a few months behind schedule :).

The bug is fixed in ruby-prof 0.5.0, which is now available on  
ruby-forge.

Charlie

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [May 22, 2007, 1:33am UTC](https://www.ruby-forum.com/t/theres-gem-chocolate-in-my-profiling-peanut-butter/104737/7 "2007-05-22T01:33:36Z")

</div>

On May 21, 2007, at 15:11, Joel VanderWerf wrote:

> ==================================================
> 
> [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/index.php](http://rubyforge.org/tracker/index.php)?  
func=detail&aid=5652&group\_id=1814&atid=7060

[http://rubyforge.org/tracker/index.php](http://rubyforge.org/tracker/index.php)?  
func=detail&aid=5658&group\_id=1814&atid=7060
