< prev index next >

src/share/vm/runtime/timer.hpp

Print this page




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_TIMER_HPP
  26 #define SHARE_VM_RUNTIME_TIMER_HPP
  27 
  28 #include "utilities/globalDefinitions.hpp"
  29 
  30 // Timers for simple measurement.
  31 
  32 class elapsedTimer VALUE_OBJ_CLASS_SPEC {
  33   friend class VMStructs;
  34  private:
  35   jlong _counter;
  36   jlong _start_counter;
  37   bool  _active;
  38  public:
  39   elapsedTimer()             { _active = false; reset(); }

  40   void add(elapsedTimer t);
  41   void start();
  42   void stop();
  43   void reset()               { _counter = 0; }
  44   double seconds() const;
  45   jlong milliseconds() const;
  46   jlong ticks() const        { return _counter; }
  47   jlong active_ticks() const;
  48   bool  is_active() const { return _active; }
  49 };
  50 
  51 // TimeStamp is used for recording when an event took place.
  52 class TimeStamp VALUE_OBJ_CLASS_SPEC {
  53  private:
  54   jlong _counter;
  55  public:
  56   TimeStamp()  { _counter = 0; }
  57   void clear() { _counter = 0; }
  58   // has the timestamp been updated since being created or cleared?
  59   bool is_updated() const { return _counter != 0; }




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_TIMER_HPP
  26 #define SHARE_VM_RUNTIME_TIMER_HPP
  27 
  28 #include "utilities/globalDefinitions.hpp"
  29 
  30 // Timers for simple measurement.
  31 
  32 class elapsedTimer VALUE_OBJ_CLASS_SPEC {
  33   friend class VMStructs;
  34  private:
  35   jlong _counter;
  36   jlong _start_counter;
  37   bool  _active;
  38  public:
  39   elapsedTimer()             { _active = false; reset(); }
  40   elapsedTimer(jlong time, jlong timeUnitsPerSecond);
  41   void add(elapsedTimer t);
  42   void start();
  43   void stop();
  44   void reset()               { _counter = 0; }
  45   double seconds() const;
  46   jlong milliseconds() const;
  47   jlong ticks() const        { return _counter; }
  48   jlong active_ticks() const;
  49   bool  is_active() const { return _active; }
  50 };
  51 
  52 // TimeStamp is used for recording when an event took place.
  53 class TimeStamp VALUE_OBJ_CLASS_SPEC {
  54  private:
  55   jlong _counter;
  56  public:
  57   TimeStamp()  { _counter = 0; }
  58   void clear() { _counter = 0; }
  59   // has the timestamp been updated since being created or cleared?
  60   bool is_updated() const { return _counter != 0; }


< prev index next >