Total members 11889 |It is currently Fri Mar 29, 2024 8:53 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Hi
i have written program for different sorting algorithm each containing
in separate function.

I want to calculate time required to execute each sorting algo. I used
Date class method getTime() to get time before execution & after
execution by creating new object of Date. & Take difference of these two.

But function execute in us & gettime() returns millisecond.

Is there any way to calculate exact time required for each function.
Please explain ur answer




Author:
Proficient
User avatar Posts: 280
Have thanks: 1 time

Before function call:-
Code:
long startTime = System.currentTimeMillis();


After function call:-
Code:
long stopTime = System.currentTimeMillis();
System.out.println("Exceution time = " + (stopTime-startTime) );


_________________
Please recommend my post if you found it helpful


Author:
Proficient
User avatar Posts: 228
Have thanks: 0 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : calculating time required to execute function
 recursively calculating factorial     -  
 Calculating image Gradient     -  
 execute if else simultaneously     -  
 Execute System Commands     -  
 @NamedNativeQuery:SQLGrammarException could not execute quer     -  
 Which language is required to set up a web application?     -  
 Fatwire professionals required - Large MNC     -  
 Software Best Practices Training topics required     -  
 convert char*(number) to required unsigned char*     -  
 What Time Is It?     -  



Topic Tags

Java Time
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com