1 25 38 package org.jgrapht.util; 39 40 44 public class StopWatch 45 { 46 47 49 long beforeTime; 50 51 53 public void start() 54 { 55 this.beforeTime = System.currentTimeMillis(); 56 } 57 58 public void stopAndReport() 59 { 60 long deltaTime = System.currentTimeMillis() - beforeTime; 61 if (deltaTime > 9999) { 62 double deltaTimeSec = deltaTime / 1000.0; 63 System.out.println( 64 "# Performence: " + deltaTimeSec + " full Seconds"); 65 } else { 66 String timeDesc; 67 timeDesc = 68 (deltaTime <= 10) ? "<10ms [less than minumun measurement time]" 69 : String.valueOf(deltaTime); 70 System.out.println("# Performence: in MiliSeconds:" + timeDesc); 71 } 72 } 73 } 74 | Popular Tags |