[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
Timer  XML
Forum Index » Java Programming
Author Message
unknownterra

Newbie
[Avatar]

Joined: 03/22/2006 20:08:52
Messages: 10
Offline

Hi,

I have a quick question. For the life of me I can't remember how to measure time between two points in the code. I remember doing it a long time ago, where you mark two points in your code then take away the start time from the stop time to get execution time. What is the line of code that measures time in milliseconds?

I feel kindof embarrassed to ask this since its probably very trivial
tfecw

Newbie

Joined: 09/19/2005 15:02:20
Messages: 144
Location: No. VA.
Offline

We've all been there.

There are a couple of ways to get the current time in milliseconds. Using the Date class is one them.



Do the same to get the end time and subtract the 2.

If you are looking to get the time for performance tracking reasons, IE you want to see how one algorithm performs when compared to another, you might want to try using a profiler to get a more accurate idea of what's going on. Jprobe has a free version avilable that's pretty nifty.
aim icon
unknownterra

Newbie
[Avatar]

Joined: 03/22/2006 20:08:52
Messages: 10
Offline

tfecw wrote:We've all been there.

There are a couple of ways to get the current time in milliseconds. Using the Date class is one them.



Do the same to get the end time and subtract the 2.

If you are looking to get the time for performance tracking reasons, IE you want to see how one algorithm performs when compared to another, you might want to try using a profiler to get a more accurate idea of what's going on. Jprobe has a free version avilable that's pretty nifty.

Thanks for that!

I just need to measure the time between two points. Its past 3am and I am playing with java. Ayyyy! I need life.
 
Forum Index » Java Programming
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle