The Artima Developer Community
Sponsored Link

Java Answers Forum
Can any body help me.........

1 reply on 1 page. Most recent reply: Sep 11, 2003 6:07 AM by John Channing

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
guru

Posts: 3
Nickname: codecguru
Registered: Sep, 2003

Can any body help me......... Posted: Sep 11, 2003 5:43 AM
Reply to this message Reply
Advertisement
How to write a programe to calculate time taken by the program...just an idea.if possible code aslo..


John Channing

Posts: 17
Nickname: drc
Registered: Jun, 2003

Re: Can any body help me......... Posted: Sep 11, 2003 6:07 AM
Reply to this message Reply
All you need is System.currentTimeMillis(). Here's a class that I use to measure performance.
John
public class DebugTimer
{
private long start ;
private long split ;
private long end ;

public DebugTimer()
{
start = System.currentTimeMillis() ;
}

public void stop()
{
end = System.currentTimeMillis() ;
}

// Allows an intermediate elapsed time to be taken
public void split()
{
split = System.currentTimeMillis() ;
}

public long elapsed()
{
return end - start ;
}

public long elapsedStartToSplit()
{
return split - start ;
}

public long elapsedSplitToEnd()
{
return end - split ;
}

public void reset()
{
start = 0 ;
split = 0 ;
end = 0 ;
}
}

Flat View: This topic has 1 reply on 1 page
Topic: array Previous Topic   Next Topic Topic: How do we put images in an applet

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use