Ruby Profiler

Hello, I’m looking for a program to profile my non-rails ruby program…
I found ruby-prof, can that do the job? if it does, I have no idea how
to install and run it to profile my programs =(

Thanks for your help

On Fri, Jun 6, 2008 at 12:29 PM, Justin To [email protected] wrote:

Hello, I’m looking for a program to profile my non-rails ruby program…
I found ruby-prof, can that do the job? if it does, I have no idea how
to install and run it to profile my programs =(

ruby-prof is excellent and can do the job for you.

Quick start:
gem install ruby-prof
ruby -runprof mycode.rb

(unprof.rb is a wrapper script that profiles your code and drops
profiling output in the current directory)

jeremy

Justin To wrote:

Hello, I’m looking for a program to profile my non-rails ruby program…
I found ruby-prof, can that do the job? if it does, I have no idea how
to install and run it to profile my programs =(

gem install ruby-prof

ruby-prof my-prog.rb

See ruby-prof -h for optoins. The -p graph_html option is nice. I’ve
been a very happy user of ruby-prof.

Thanks, I got it to install in RubyGems Package Manager…now to run it
on my file, where must that file be? My file is in a folder on the
desktop…when
I run ruby -runprof my-file-name.rb
it outputs: ruby: No such file or directory – my-file-name.rb

Thanks again!

On 06.06.2008 21:29, Justin To wrote:

Hello, I’m looking for a program to profile my non-rails ruby program…
I found ruby-prof, can that do the job? if it does, I have no idea how
to install and run it to profile my programs =(

There is also “-r profile” (no gem needed):

robert@fussel ~
$ ruby -r profile -e ‘10.times {|i| puts i}’
0
1
2
3
4
5
6
7
8
9
% cumulative self self total
time seconds seconds calls ms/call ms/call name
0.00 0.00 0.00 10 0.00 0.00 Kernel.puts
0.00 0.00 0.00 10 0.00 0.00 Fixnum#to_s
0.00 0.00 0.00 1 0.00 0.00 Integer#times
0.00 0.00 0.00 20 0.00 0.00 IO#write
0.00 0.01 0.00 1 0.00 10.00 #toplevel

Kind regards

robert

On Fri, Jun 6, 2008 at 1:29 PM, Justin To [email protected] wrote:

Hello, I’m looking for a program to profile my non-rails ruby program…
I found ruby-prof, can that do the job? if it does, I have no idea how
to install and run it to profile my programs =(

I wrote a series of short articles about using ruby-prof a while ago,
and they still seem pretty popular. Perhaps these will help:

pat eyler wrote:

On Fri, Jun 6, 2008 at 1:29 PM, Justin To [email protected] wrote:

Hello, I’m looking for a program to profile my non-rails ruby program…
I found ruby-prof, can that do the job? if it does, I have no idea how
to install and run it to profile my programs =(

I wrote a series of short articles about using ruby-prof a while ago,
and they still seem pretty popular. Perhaps these will help:

On Ruby: Profile and ruby-prof
On Ruby: Profile and ruby-prof: Getting Specific
On Ruby: ruby-prof and call graphs

I’m sorry to say that those articles didn’t help…I’m trying to run
ruby-prof on a program saved onto the desktop… where do I go to type
in the command(s) and what commands should I type?

Thanks

On Jun 9, 6:05 pm, Justin To [email protected] wrote:

http://on-ruby.blogspot.com/2006/08/profile-and-ruby-prof-getting-spe
On Ruby: ruby-prof and call graphs

I’m sorry to say that those articles didn’t help…I’m trying to run
ruby-prof on a program saved onto the desktop… where do I go to type
in the command(s) and what commands should I type?

Wow, what an answer…

When you said “RubyGems Package Manager” looks like you’re running
Windows and you have One-Click Installer “installed”.

Just jump into a command prompt and see if “ruby -v” get you the ruby
version installed, if so, that means you have Ruby in your PATH.

First you need to get your feets wet with command line, ‘cd’ into your
desktop folder (whatever is that, you should know) and try running the
suggested commandline from the articles.

HTH,

On Mon, Jun 9, 2008 at 18:05, Justin To [email protected] wrote:

On Ruby: Profile and ruby-prof: Getting Specific
On Ruby: ruby-prof and call graphs

I’m sorry to say that those articles didn’t help…I’m trying to run
ruby-prof on a program saved onto the desktop… where do I go to type
in the command(s) and what commands should I type?

Thanks

Create shortcut on desktop, answer the first question with “cmd”
(without quotes).
Name it as you wish. When created, open its properties, and replace
%windir% with
%homedrive%%homepath% (no spaces between %%). Save.

Now you can click on it and a dos/cmd window appears.

Alternative way is Start menu, Accessories, command prompt, (window
appears), %homedrive%
cd %homepath%\Desktop

or replace %homedrive% and %homepath% with actual values (C:,
\documents and settings<your user name>)

J.

Thanks, I finally figured it out and was able to print some reports
using your articles!