From: Paul C. <pa...@se...> - 2008-08-06 10:48:35
|
Hi, On Wed, Aug 6, 2008 at 12:03 PM, Eric Bezault <er...@go...> wrote: > Müller Gloria wrote: >> Something unrelated. I wanted to time my code. Is it really that Eiffel can only measure >> time up to a precision of seconds? If I want to time my code I need at least nanoseconds. >> Any idea how to do this? Using command line "time" is inconvenient. I want to measure >> time of little code pieces not of the entire app. > > You would have to find an Eiffel date/time library which supports > nanoseconds, or write one if one does not exist yet. The Gobo > date/time library is indeed limited to milliseconds. You may have > a look at ISE's EiffelTime library, but I think that it has the same > limitation when calling `make_now'. High precision timing is very dependent on the hardware and operating system you are using. Millisecond resolution should be good enough for most non-embedded situations. On Linux you could try wrapping the High Precision Event Timer (HPET) and you could maybe achieve nanoseconds resolution. I'm not sure. See: http://en.wikipedia.org/wiki/High_Precision_Event_Timer See here for an example C program using HPET: http://www.mjmwired.net/kernel/Documentation/hpet.txt If you do wrap HPET I would be glad to use it! ;-) /Paul -- Paul Cohen mobile: +46 730 787 035 e-mail: pau...@se... |