src/share/vm/utilities/events.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8047290absolutely_final Sdiff src/share/vm/utilities

src/share/vm/utilities/events.hpp

Print this page




  73    public:
  74     double  timestamp;
  75     Thread* thread;
  76     X       data;
  77   };
  78 
  79  protected:
  80   Mutex           _mutex;
  81   const char*     _name;
  82   int             _length;
  83   int             _index;
  84   int             _count;
  85   EventRecord<T>* _records;
  86 
  87  public:
  88   EventLogBase<T>(const char* name, int length = LogEventsBufferEntries):
  89     _name(name),
  90     _length(length),
  91     _count(0),
  92     _index(0),
  93     _mutex(Mutex::event, name) {
  94     _records = new EventRecord<T>[length];
  95   }
  96 
  97   double fetch_timestamp() {
  98     return os::elapsedTime();
  99   }
 100 
 101   // move the ring buffer to next open slot and return the index of
 102   // the slot to use for the current message.  Should only be called
 103   // while mutex is held.
 104   int compute_log_index() {
 105     int index = _index;
 106     if (_count < _length) _count++;
 107     _index++;
 108     if (_index >= _length) _index = 0;
 109     return index;
 110   }
 111 
 112   bool should_log() {
 113     // Don't bother adding new entries when we're crashing.  This also




  73    public:
  74     double  timestamp;
  75     Thread* thread;
  76     X       data;
  77   };
  78 
  79  protected:
  80   Mutex           _mutex;
  81   const char*     _name;
  82   int             _length;
  83   int             _index;
  84   int             _count;
  85   EventRecord<T>* _records;
  86 
  87  public:
  88   EventLogBase<T>(const char* name, int length = LogEventsBufferEntries):
  89     _name(name),
  90     _length(length),
  91     _count(0),
  92     _index(0),
  93     _mutex(Mutex::event, name, false, Monitor::_safepoint_check_never) {
  94     _records = new EventRecord<T>[length];
  95   }
  96 
  97   double fetch_timestamp() {
  98     return os::elapsedTime();
  99   }
 100 
 101   // move the ring buffer to next open slot and return the index of
 102   // the slot to use for the current message.  Should only be called
 103   // while mutex is held.
 104   int compute_log_index() {
 105     int index = _index;
 106     if (_count < _length) _count++;
 107     _index++;
 108     if (_index >= _length) _index = 0;
 109     return index;
 110   }
 111 
 112   bool should_log() {
 113     // Don't bother adding new entries when we're crashing.  This also


src/share/vm/utilities/events.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File