If you try to profile on a Unix environment based on timings you have to do multiple passes and get a statistical average to be meaningful. The timer functionality in the kernel or user space is at such a low priority that effectively it jumps between values ... that's why when tuning using tools like sar you have to set a decent sample size. This is pretty much the case for any current non-realtime OS. For long running tasks the time is probably OK, for small times ( < 10 ms or even .1s timings ) on a busy system the times are just erroneous.

Cheers,
Thor HW

On 3-Nov-03, at 9:36 AM, Nicola Ken Barozzi wrote:

Berin Loritsch wrote:
...
I have a feeling the timings are useless largely because of the granularity
of the System.getTimeInMillis() method. On Windows the granularity is 10 ms.
If the timing is less than that it registers as 0. Add enough zeros and it
will always be less than the total time for the timing.

There is a way of getting around this by using JNI and calling the correct stuff. If you Google round you will sure find something. Probably there is something at www.javaworld.com.


--
Nicola Ken Barozzi                   [EMAIL PROTECTED]
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------






Reply via email to