A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
How i get execution time in java???
Muhammad usman shad
Joined: Jan 06, 2010
Jan 16, 2010 02:10:51
Assalam o Aliekum to all,
I am assigned a task by my teacher in
in which i am sorting an array using different sortin techniques.
I do it accurately...
Now i have to get the Execution time from the system which it takes to get the output,
Is there any method in java which can do this and if not then can i do it???
Then please please help me,
Joined: Oct 25, 2008
Jan 16, 2010 04:41:57
Look at java.lang.System.currentTimeMillis() and build something around it.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Joined: Oct 24, 2006
Jan 16, 2010 06:48:05
Also, if you simply instantiate a
object with the default constructor (new Date()) that will reflect the current time.
The same applies to java.util.Calendar.getInstance().
Joined: Oct 27, 2005
Jan 17, 2010 08:58:01
And if milliseconds is not accurate enough, Java 5.0 added System.nanoTime() which returns the time in nanoseconds.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: How i get execution time in java???
Timing a program
finding the timeofday in Java
Calculating Time taken by a code segment
Performance meseaurement of code conatining queries
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015