1 11 package org.jahia.utils; 12 13 import java.util.Date ; 14 15 public class JahiaChrono 16 { 17 18 private static JahiaChrono theObject = null; 19 20 21 26 private JahiaChrono() 27 { 28 JahiaConsole.println( "JahiaChrono", "Starting JahiaChrono utils" ); 29 } 31 32 33 38 public static JahiaChrono getInstance() 39 { 40 if (theObject == null) { 41 theObject = new JahiaChrono(); 42 } 43 return theObject; 44 } 46 47 48 53 public long start() 54 { 55 return (new Date ()).getTime(); 56 } 58 59 60 65 public long read( long startTime ) 66 { 67 return ((new Date ()).getTime() - startTime); 68 } 70 71 72 77 public void toConsole( long startTime, String message ) 78 { 79 JahiaConsole.println( "JahiaChrono", "[" + read(startTime) + "ms] " + message ); 80 } 82 83 } | Popular Tags |