[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Ruby Profiler

Justin To

6/6/2008 7:29:00 PM

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
--
Posted via http://www.ruby-....

9 Answers

Jeremy Kemper

6/6/2008 7:43:00 PM

0

On Fri, Jun 6, 2008 at 12:29 PM, Justin To <tekmc@hotmail.com> 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

Joel VanderWerf

6/6/2008 7:47:00 PM

0

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.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Justin To

6/6/2008 8:05:00 PM

0

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

Thanks again!
--
Posted via http://www.ruby-....

Robert Klemme

6/6/2008 10:11:00 PM

0

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

pat eyler

6/7/2008 1:52:00 PM

0

On Fri, Jun 6, 2008 at 1:29 PM, Justin To <tekmc@hotmail.com> 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:

http://on-ruby.bl.../2006/08/profile-and-ruby...
http://on-ruby.bl.../2006/08/profile-and-ruby-prof-getting-spe...
http://on-ruby.bl.../2006/08/ruby-prof-and-call-g...


>
> Thanks for your help
> --
> Posted via http://www.ruby-....
>
>



--
thanks,
-pate
-------------------------
Duty makes us do things, Love make us do things well.
http://on-ruby.bl... http://on-erlang.bl...
http://on-soccer.bl...

Justin To

6/9/2008 4:06:00 PM

0

pat eyler wrote:
> On Fri, Jun 6, 2008 at 1:29 PM, Justin To <tekmc@hotmail.com> 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:
>
> http://on-ruby.blogspot.com/2006/08/profile-and-ruby...
> http://on-ruby.blogspot.com/2006/08/profile-and-ruby-prof-getting-spe...
> http://on-ruby.blogspot.com/2006/08/ruby-prof-and-call-g...

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
--
Posted via http://www.ruby-....

Luis Lavena

6/9/2008 7:30:00 PM

0

On Jun 9, 6:05 pm, Justin To <te...@hotmail.com> wrote:
> pat eyler wrote:
> > On Fri, Jun 6, 2008 at 1:29 PM, Justin To <te...@hotmail.com> 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:
>
> >http://on-ruby.blogspot.com/2006/08/profile-and-ruby...
> >http://on-ruby.blogspot.com/2006/08/profile-and-ruby-prof-g......
> >http://on-ruby.blogspot.com/2006/08/ruby-prof-and-call-g...
>
> 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,
--
Luis Lavena

Justin To

6/9/2008 9:51:00 PM

0

Thanks, I finally figured it out and was able to print some reports
using your articles!
--
Posted via http://www.ruby-....

Jano Svitok

6/10/2008 11:55:00 AM

0

On Mon, Jun 9, 2008 at 18:05, Justin To <tekmc@hotmail.com> wrote:
> pat eyler wrote:
>> On Fri, Jun 6, 2008 at 1:29 PM, Justin To <tekmc@hotmail.com> 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:
>>
>> http://on-ruby.blogspot.com/2006/08/profile-and-ruby...
>> http://on-ruby.blogspot.com/2006/08/profile-and-ruby-prof-getting-spe...
>> http://on-ruby.blogspot.com/2006/08/ruby-prof-and-call-g...
>
> 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%<enter>
cd %homepath%\Desktop<enter>

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

J.