< prev index next >

src/share/vm/gc/parallel/gcTaskThread.cpp

Print this page
rev 11508 : 8157240: GC task trace logging is incomprehensible
Reviewed-by: tschatzl
rev 11509 : imported patch code_review2


  28 #include "gc/shared/gcId.hpp"
  29 #include "logging/log.hpp"
  30 #include "memory/allocation.hpp"
  31 #include "memory/allocation.inline.hpp"
  32 #include "memory/resourceArea.hpp"
  33 #include "runtime/atomic.inline.hpp"
  34 #include "runtime/handles.hpp"
  35 #include "runtime/handles.inline.hpp"
  36 #include "runtime/os.hpp"
  37 #include "runtime/thread.hpp"
  38 
  39 GCTaskThread::GCTaskThread(GCTaskManager* manager,
  40                            uint           which,
  41                            uint           processor_id) :
  42   _manager(manager),
  43   _processor_id(processor_id),
  44   _time_stamps(NULL),
  45   _time_stamp_index(0)
  46 {
  47   set_id(which);
  48   set_name("ParGC Thread#%d", which);
  49 }
  50 
  51 GCTaskThread::~GCTaskThread() {
  52   if (_time_stamps != NULL) {
  53     FREE_C_HEAP_ARRAY(GCTaskTimeStamp, _time_stamps);
  54   }
  55 }
  56 
  57 GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) {
  58   guarantee(index < GCTaskTimeStampEntries, "increase GCTaskTimeStampEntries");
  59   if (_time_stamps == NULL) {
  60     // We allocate the _time_stamps array lazily since logging can be enabled dynamically
  61     GCTaskTimeStamp* time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
  62     void* old = Atomic::cmpxchg_ptr(time_stamps, &_time_stamps, NULL);
  63     if (old != NULL) {
  64       // Someone already setup the time stamps
  65       FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps);
  66     }
  67   }
  68 




  28 #include "gc/shared/gcId.hpp"
  29 #include "logging/log.hpp"
  30 #include "memory/allocation.hpp"
  31 #include "memory/allocation.inline.hpp"
  32 #include "memory/resourceArea.hpp"
  33 #include "runtime/atomic.inline.hpp"
  34 #include "runtime/handles.hpp"
  35 #include "runtime/handles.inline.hpp"
  36 #include "runtime/os.hpp"
  37 #include "runtime/thread.hpp"
  38 
  39 GCTaskThread::GCTaskThread(GCTaskManager* manager,
  40                            uint           which,
  41                            uint           processor_id) :
  42   _manager(manager),
  43   _processor_id(processor_id),
  44   _time_stamps(NULL),
  45   _time_stamp_index(0)
  46 {
  47   set_id(which);
  48   set_name("%s#%d", manager->group_name(), which);
  49 }
  50 
  51 GCTaskThread::~GCTaskThread() {
  52   if (_time_stamps != NULL) {
  53     FREE_C_HEAP_ARRAY(GCTaskTimeStamp, _time_stamps);
  54   }
  55 }
  56 
  57 GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) {
  58   guarantee(index < GCTaskTimeStampEntries, "increase GCTaskTimeStampEntries");
  59   if (_time_stamps == NULL) {
  60     // We allocate the _time_stamps array lazily since logging can be enabled dynamically
  61     GCTaskTimeStamp* time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
  62     void* old = Atomic::cmpxchg_ptr(time_stamps, &_time_stamps, NULL);
  63     if (old != NULL) {
  64       // Someone already setup the time stamps
  65       FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps);
  66     }
  67   }
  68 


< prev index next >