Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Give a simplest way to find out the time a method takes for execution without using any profiling tool?
Give a simplest way to find out the time a method takes for execution without using any profiling tool?
✍: Guest
Read the system time just before the method is invoked and immediately after method returns. Take the time difference, which will give you the time taken by a method for execution.
To put it in code...
long start = System.currentTimeMillis ();
method ();
long end = System.currentTimeMillis ();
System.out.println ("Time taken for execution is " + (end - start));
Remember that if the time taken for execution is too small, it might show that it is taking zero milliseconds for execution. Try it on a method which is big enough, in the sense the one which is doing considerable amout of processing.
2013-05-24, 1962👍, 0💬
Popular Posts:
How To Create an Add-to-My-Yahoo Button on Your Website? - RSS FAQs - Adding Your Feeds to RSS News ...
How Can we change priority & what levels of priority are provided by Dot Net? Thread Priority ca...
What Information Is Needed to Connect SQL*Plus an Oracle Server? - Oracle DBA FAQ - Introduction to ...
What print out will the folloging code produce? main() { char *p1=“name”; char *p2; p2=(char*)malloc...
Do You Know the Book "JUnit in Action"? You should know this book. It received some good reviews. Ti...