Wednesday, December 12, 2012

Performance Checking - How to Count the execution time for the block

Performance Checking - How to Count the execution time for the block

                long startTime = System.nanoTime();  // added
                long endTime = 0;                              //added

//Put your testing block here.

                endTime = System.nanoTime();                            //added
                long timeneeded = endTime - startTime;               //added
               
                System.out.println("Start Time:"+startTime);         //added
                System.out.println("End Time:"+endTime);           //added
                System.out.println("Needed Time:"+timeneeded); //added

No comments:

Post a Comment