Re: Execution time of code?
* coal@mailvault.com:
On Mar 5, 11:55 pm, "Alf P. Steinbach" <al...@start.no> wrote:
I'm not sure if you responded to this very well:
'clock' just doesn't cut it on Windows, for example. Machines
nowadays are so fast and the software is so complex that time
measurement with the granularity of 20 milliseconds is just not
suitable for measuring time on a function level.
Oh. Well, the question we were talking about was a timer-thing for measuring the
performance of various parts of an algorithm. 'clock' is eminently usable for
that; it's trivial to accumulate results, and/or adjust argument values for the
measured thing, to get into the resolution range, and I described that in
concrete in my first response in this thread. Not that it's necessarily how
would do it (Windows' GetTickCount API routine comes to mind... ;-)).
But I'm taking issue with Victor's statement that 'clock' is the last thing you
should try for this.
That is so far just a silly assertion that he's failed to back up in any way,
veering instead into general profiling of massive applications, adding in
various personal perspectives, snipping facts and references, etc.
I've done some performance testing on Windows and Linux --
www.webEbenezer.net/comparison.html. On Windows I use clock
and on Linux I use gettimeofday. From what I can tell
gettimeofday gives more accurate results than clock on Linux.
Depending on how this thread works out, I may start using the
function Victor mentioned on Windows.
Performance counters in Windows can be great for general profiling yes.
And (OFF-TOPIC for clc++) you can even access all that data without any special
tools, just importing it into nearest spreadsheet.
But for just measuring an algorithm, the OP's problem, that approach can be and
IME (although I have not very much experience with the performance counters)
usually is massive overkill... ;-)
--
Due to hosting requirements I need visits to [http://alfps.izfree.com/].
No ads, and there is some C++ stuff! :-) Just going there is good. Linking
to it is even better! Thanks in advance!- Hide quoted text -
I'm interested in trading links with people on webEbenezer.net.
I don't care if your site doesn't get a lot of hits. I've been
there and done that and know it can be tough.
Thanks. But I'm not really into link trading. It's just that the free Norwegian
hosting I've used is being terminated (for all thousands of homepages) in May,
so I had to find some new free hosting, and they require 10 hits per month,
otherwise the site is deemed inactive and is removed. I didn't know how much
traffic I had. As it turned out it seems I have 30-40 hits per day (unique
visitors), so I should be safe against the 10 visitors per month criterion. :-)
Cheers,
- Alf
--
Due to hosting requirements I need visits to [http://alfps.izfree.com/].
No ads, and there is some C++ stuff! :-) Just going there is good. Linking
to it is even better! Thanks in advance!