package test;

public class StopWatch {
   private long c0;
   private long c1;
   private long total;
   int size = 0;

   public void reset() {
      this.total = 0L;
      this.c0 = 0L;
      this.c1 = 0L;
      this.size = 0;
   }

   public void begin() {
      ++this.size;
      this.c0 = System.nanoTime();
   }

   public void end() {
      this.c1 = System.nanoTime();
      this.total += this.c1 - this.c0;
   }

   public void print() {
      System.out.println(" elasped :" + (double)(this.c1 - this.c0) / (double)1000000.0F + "ms");
   }

   public void print(String prefix) {
      System.out.println(prefix + "elasped :" + (double)(this.c1 - this.c0) / (double)1000000.0F + "ms");
   }

   public void printAvg() {
      System.out.println(" avg :" + (double)(this.total / (long)this.size) / (double)1000000.0F + "ms");
   }
}
