package umontreal.iro.lecuyer.util;

/**
 * The {@link Chrono} class extends the 
 * {@link umontreal.iro.lecuyer.util.AbstractChrono AbstractChrono} 
 * class and computes the CPU time for the current thread only.
 * This is the simplest way to use chronos. Classes AbstractChrono,
 * {@link umontreal.iro.lecuyer.util.SystemTimeChrono SystemTimeChrono}, 
 * {@link umontreal.iro.lecuyer.util.GlobalCPUTimeChrono GlobalCPUTimeChrono} and 
 * {@link umontreal.iro.lecuyer.util.ThreadCPUTimeChrono ThreadCPUTimeChrono} 
 * provide different chronos implementations.
 * See these classes to learn more about SSJ chronos, if problems appear with
 * class Chrono.
 * 
 */
public class Chrono extends AbstractChrono  {
   private ThreadCPUTimeChrono chrono = new ThreadCPUTimeChrono();

   protected void getTime (long[] tab) {
         chrono.getTime(tab);
   }


   /**
    * Constructs a Chrono object and
    *     initializes it to zero.
    * 
    */
   public Chrono() {
      chrono.init();
      init();
   }


   /**
    * Creates a Chrono instance adapted for a program
    *    using a single thread.  Under Java 1.5, this method returns
    *    an instance of {@link ChronoSingleThread} which can
    *    measure CPU time for one thread.  Under Java versions prior to
    *    1.5, this returns an instance of this class.
    *    This method must not be used to create a timer for a
    *    multi-threaded program, because the obtained CPU times
    *    will differ depending on the used Java version.
    * 
    * @return the constructed timer.
    * 
    */
   public static Chrono createForSingleThread () {
         return new Chrono();
   }


}

 

Ads help maintain this website.