# Ruby-prof on windows: strange measured time numbers

**URL:** <https://www.ruby-forum.com/t/ruby-prof-on-windows-strange-measured-time-numbers/183669>\
**Category:** Ruby\
**Created:** [February 18, 2010, 2:57pm UTC](https://www.ruby-forum.com/t/ruby-prof-on-windows-strange-measured-time-numbers/183669 "2010-02-18T14:57:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [February 18, 2010, 2:57pm UTC](https://www.ruby-forum.com/t/ruby-prof-on-windows-strange-measured-time-numbers/183669/1 "2010-02-18T14:57:46Z")

</div>

Hi there,  
I play with ruby-prof. Profiling those simple-few-dozens-line scripts  
seems clear, but when I try to profile `rake --tasks`, as follows

C:\InstantRails\rails\_apps\projectN\>“ruby-prof” “–printer=graph\_html”  
“–file=ruby\_prof.rake.html” “–min\_percent=1.00” “–”  
“C:\InstantRails\ruby\bin\rake” --tasks

I get reported execution total time from 84 to 102 seconds, while it  
actually took not more than 25 seconds.

I set environment wariable RUBY\_PROF\_CPU\_FREQUENCY to various values  
scaling them 10 times, but it seemes had no influence on execution total  
time. Also I tried same with --mode key values cpu, wall.

How can I get more realistic totals?

win xp sp3, core2duo T2300 @1.66GHz  
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

---

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [February 18, 2010, 5:51pm UTC](https://www.ruby-forum.com/t/ruby-prof-on-windows-strange-measured-time-numbers/183669/2 "2010-02-18T17:51:29Z")

</div>

> I set environment wariable RUBY\_PROF\_CPU\_FREQUENCY to various values  
> scaling them 10 times, but it seemes had no influence on execution total  
> time. Also I tried same with --mode key values cpu, wall.

which version of ruby-prof? (RUBY\_PROF\_CPU\_FREQUENCY only helps with  
timing if you have an Intel chip and use that mode).  
Thanks.  
-r

---

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [February 18, 2010, 6:52pm UTC](https://www.ruby-forum.com/t/ruby-prof-on-windows-strange-measured-time-numbers/183669/3 "2010-02-18T18:52:49Z")

</div>

Roger P. wrote:

> which version of ruby-prof?

ruby-prof-0.7.3-x86-mswin32-60

I’ve just tried again

set RUBY\_PROF\_CPU\_FREQUENCY=1 782 411 428 (1.66_1024_1024\*1024)  
then ran

C:\InstantRails\rails\_apps\projectN\>“ruby-prof” “–printer=graph\_html”  
“–file=ruby\_prof.rake.html” “–min\_percent=1.00” “–mode=cpu” “–”  
“C:\InstantRails\ruby\bin\rake” --tasks

got about 105 seconds

then set RUBY\_PROF\_CPU\_FREQUENCY=178 241 142 (previous value/10)  
and got about 110 seconds

---

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [February 18, 2010, 8:15pm UTC](https://www.ruby-forum.com/t/ruby-prof-on-windows-strange-measured-time-numbers/183669/4 "2010-02-18T20:15:18Z")

</div>

Zhoran T. wrote:

> > which version of ruby-prof?
> 
> ruby-prof-0.7.3-x86-mswin32-60

I’ll try and build a native gem for mswin32 and you can try that.  
-rp

---

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [February 18, 2010, 10:51pm UTC](https://www.ruby-forum.com/t/ruby-prof-on-windows-strange-measured-time-numbers/183669/5 "2010-02-18T22:51:26Z")

</div>

Zhoran T. wrote:

> Roger P. wrote:
> 
> > which version of ruby-prof?
> 
> ruby-prof-0.7.3-x86-mswin32-60

All righty update your gem, give 'er a shot again and report back.

E:\installs\ruby\_msvc\bin\>gem install ruby-prof  
Successfully installed ruby-prof-0.8.1-x86-mswin32  
1 gem installed

Thanks for the kick in the pants to use rake compiler 🙂

-rp

---

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [February 19, 2010, 9:32am UTC](https://www.ruby-forum.com/t/ruby-prof-on-windows-strange-measured-time-numbers/183669/6 "2010-02-19T09:32:48Z")

</div>

Roger P. wrote:

> All righty update your gem, give 'er a shot again and report back.
> 
> E:\installs\ruby\_msvc\bin\>gem install ruby-prof  
> Successfully installed ruby-prof-0.8.1-x86-mswin32  
> 1 gem installed
> 
> Thanks for the kick in the pants to use rake compiler 🙂

Hi, Roger  
updated gem and made two series of shots with the same two  
RUBY\_PROF\_CPU\_FREQUENCY values. Both RUBY\_PROF\_CPU\_FREQUENCY values  
178241142 and 1782411428 result in 18-19 secs

Now it reports more realistic - 18 secs while it took about 23 secs as  
showed my watch. A compared my watch to computer clock, and found it’s  
ok ) Could the difference take place due to concurrent process execution  
environment?

---

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [February 19, 2010, 6:13pm UTC](https://www.ruby-forum.com/t/ruby-prof-on-windows-strange-measured-time-numbers/183669/7 "2010-02-19T18:13:16Z")

</div>

Roger P. wrote:

> > Hi, Roger  
> > updated gem and made two series of shots with the same two  
> > RUBY\_PROF\_CPU\_FREQUENCY values. Both RUBY\_PROF\_CPU\_FREQUENCY values  
> > 178241142 and 1782411428 result in 18-19 secs
> > 
> > Now it reports more realistic - 18 secs while it took about 23 secs as  
> > showed my watch. A compared my watch to computer clock, and found it’s  
> > ok ) Could the difference take place due to concurrent process execution  
> > environment?
> 
> Note well that it won’t actually use RUBY\_PROF\_CPU\_FREQUENCY unless you  
> specify --mode=cpu
> 
> Thanks!  
> -rp

Roger,  
I like ruby-prof, and find it very helpful. Thank you for it! And best  
wishes )

Zhoran

---

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [February 19, 2010, 5:31pm UTC](https://www.ruby-forum.com/t/ruby-prof-on-windows-strange-measured-time-numbers/183669/8 "2010-02-19T17:31:41Z")

</div>

> Hi, Roger  
> updated gem and made two series of shots with the same two  
> RUBY\_PROF\_CPU\_FREQUENCY values. Both RUBY\_PROF\_CPU\_FREQUENCY values  
> 178241142 and 1782411428 result in 18-19 secs
> 
> Now it reports more realistic - 18 secs while it took about 23 secs as  
> showed my watch. A compared my watch to computer clock, and found it’s  
> ok ) Could the difference take place due to concurrent process execution  
> environment?

Note well that it won’t actually use RUBY\_PROF\_CPU\_FREQUENCY unless you  
specify --mode=cpu

Thanks!  
-rp
