| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 03/29/2006 06:30:30
|
unknownterra
Newbie
![[Avatar]](/images/avatar/084b6fbb10729ed4da8c3d3f5a3ae7c9.jpg)
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
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 03/29/2006 07:47:00
|
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.
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 03/29/2006 09:05:15
|
unknownterra
Newbie
![[Avatar]](/images/avatar/084b6fbb10729ed4da8c3d3f5a3ae7c9.jpg)
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.
|
|
|
 |
|
|