[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

[ANN] hitimes 0.3.0 Released

Jeremy Hinegardner

10/12/2008 5:32:00 AM

hitimes version 0.3.0 has been released. Now with windows support.

gem install hitimes

http://copiousfreetime.rubyforge.or...

Hitimes is a fast, high resolution timer library for recording performance
metrics. It uses the appropriate C method calls for each system to get the
highest granularity time increments possible.

It currently supports any system with the POSIX call clock_gettime(),
Mac OS X and Windows.

Using Hitimes can be faster than using a series of Time.new calls, and
it will have a much higher granularity. It is definitely faster than
using Process.times.

{{ Release notes for Version 0.3.0 }}

* switched to extconf for building extensions
* first release of windows binary gem
* reverted back to normal rdoc


--
========================================================================
Jeremy Hinegardner jeremy@hinegardner.org


2 Answers

Roger Pack

10/12/2008 5:32:00 PM

0

> hitimes version 0.3.0 has been released. Now with windows support.

Looks nice. I love how accurate it is over traditional Benchmark.

Wish list: 1.9 use, and also the ability to use the CPU clock counter
[maybe guess or estimate the accuracy?]. That might be faster, for
those of us that want speed over accuracy :) [1] seems to use it, as an
example. Anything to improve speed [like a C based measure, etc.]

Thanks much.
-=R


http://ruby-prof.ruby...
--
Posted via http://www.ruby-....

Jeremy Hinegardner

10/13/2008 4:00:00 AM

0

On Mon, Oct 13, 2008 at 02:32:25AM +0900, Roger Pack wrote:
> > hitimes version 0.3.0 has been released. Now with windows support.
>
> Looks nice. I love how accurate it is over traditional Benchmark.

Thanks!

> Wish list: 1.9 use,

I'll get around to 1.9 at some point.

> and also the ability to use the CPU clock counter
> [maybe guess or estimate the accuracy?]. That might be faster, for
> those of us that want speed over accuracy :) [1] seems to use it, as an
> example.

It looks like ruby-prof some assembler to get its timing calls. Unfortunately I
don't know assembler, otherwise I may have gone that route.

I went with the lowest level timing API call I could find on each system. this
means that on Windows it uses the QueryPerformanceCounter()[1] and
QueryPerformanceFrequency() combination, on OS X is uses UpTime()[2], and
everything else goes to clock_gettime()[3].

> Anything to improve speed [like a C based measure, etc.]

Patches are always welcome :-). Feel free to contribute[4].

The Interval class is pure C. I may re-implement Timer in C, but not quite yet.
In hitimes, the fastest way to measure the execution time of a piece of code is:

duration = Interval.measure { # your code here }

If ther are faster ways to measure the execution of code, I would happy to
incorporate them.

enjoy,

-jeremy

[1] - http://msdn.microsoft.com/en-us/library/ms6...
[2] - http://developer.apple.com/documentation/Hardware/DeviceManagers/pci_srvcs/pci_cards_drivers/PCI_BOOK.199.html#...
[3] - http://www.openbsd.org/cgi-bin/man.cgi?query=clock_gettime&...
[4] - http://github.com/copiousfreetime/hitimes/t...

--
========================================================================
Jeremy Hinegardner jeremy@hinegardner.org