Howdy,
I tend to use the simplest of all:

long opStart = System.currentTimeMillis();
... do stuff ...
long opEnd = System.currentTimeMillis();
... elapsed time in milliseconds = opEnd - opStart

I know this approach isn't 100% accurate due to threading issues, CPU
cycles, etc, but it's good enough for every application I've ever
written/used.  It's also consistent, simple to use, and incurs no
overhead.

You will undoubtedly find many timing utilities if you try a google
search.  I haven't found one that claims to always be 100% accurate in
the face of threading issues, so why bother using anything but the
simplest? ;)

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Robert McIntosh [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, March 11, 2003 11:54 AM
>To: Commons
>Subject: [OT] timers
>
>Does anyone know of a good timer utility, maybe there is one hidden in
>commons somewhere? I don't mean a timer like the java.util.Timer and
the
>javax.swing.Timers which are schedule types, but a timer for well,
>timing operations. I have a simple one I wrote that works, but I didn't
>know if there were any others that might be better.
>
>- Robert
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to