< prev index next >

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

Print this page
rev 47408 : [mq]: no_cmpxchg_if_null
rev 47401 : [mq]: cmpxchg_if_null
rev 47400 : [mq]: cmpxchg_ptr
rev 47216 : 8187443: Forest Consolidation: Move files to unified layout
Reviewed-by: darcy, ihse


  60     time_stamp->set_name(name);
  61     time_stamp->set_entry_time(t_entry);
  62     time_stamp->set_exit_time(t_exit);
  63   } else {
  64     if (_time_stamp_index ==  GCTaskTimeStampEntries) {
  65       log_warning(gc, task, time)("GC-thread %u: Too many timestamps, ignoring future ones. "
  66                                   "Increase GCTaskTimeStampEntries to get more info.",
  67                                   id());
  68     }
  69     // Let _time_stamp_index keep counting to give the user an idea about how many
  70     // are needed.
  71   }
  72   _time_stamp_index++;
  73 }
  74 
  75 GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) {
  76   assert(index < GCTaskTimeStampEntries, "Precondition");
  77   if (_time_stamps == NULL) {
  78     // We allocate the _time_stamps array lazily since logging can be enabled dynamically
  79     GCTaskTimeStamp* time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
  80     if (!Atomic::cmpxchg_if_null(time_stamps, &_time_stamps)) {
  81       // Someone already setup the time stamps
  82       FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps);
  83     }
  84   }
  85   return &(_time_stamps[index]);
  86 }
  87 
  88 void GCTaskThread::print_task_time_stamps() {
  89   assert(log_is_enabled(Debug, gc, task, time), "Sanity");
  90 
  91   // Since _time_stamps is now lazily allocated we need to check that it
  92   // has in fact been allocated when calling this function.
  93   if (_time_stamps != NULL) {
  94     log_debug(gc, task, time)("GC-Thread %u entries: %d%s", id(),
  95                               _time_stamp_index,
  96                               _time_stamp_index >= GCTaskTimeStampEntries ? " (overflow)" : "");
  97     const uint max_index = MIN2(_time_stamp_index, GCTaskTimeStampEntries);
  98     for (uint i = 0; i < max_index; i++) {
  99       GCTaskTimeStamp* time_stamp = time_stamp_at(i);
 100       log_debug(gc, task, time)("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]",




  60     time_stamp->set_name(name);
  61     time_stamp->set_entry_time(t_entry);
  62     time_stamp->set_exit_time(t_exit);
  63   } else {
  64     if (_time_stamp_index ==  GCTaskTimeStampEntries) {
  65       log_warning(gc, task, time)("GC-thread %u: Too many timestamps, ignoring future ones. "
  66                                   "Increase GCTaskTimeStampEntries to get more info.",
  67                                   id());
  68     }
  69     // Let _time_stamp_index keep counting to give the user an idea about how many
  70     // are needed.
  71   }
  72   _time_stamp_index++;
  73 }
  74 
  75 GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) {
  76   assert(index < GCTaskTimeStampEntries, "Precondition");
  77   if (_time_stamps == NULL) {
  78     // We allocate the _time_stamps array lazily since logging can be enabled dynamically
  79     GCTaskTimeStamp* time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
  80     if (Atomic::cmpxchg(time_stamps, &_time_stamps, (GCTaskTimeStamp*)NULL) != NULL) {
  81       // Someone already setup the time stamps
  82       FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps);
  83     }
  84   }
  85   return &(_time_stamps[index]);
  86 }
  87 
  88 void GCTaskThread::print_task_time_stamps() {
  89   assert(log_is_enabled(Debug, gc, task, time), "Sanity");
  90 
  91   // Since _time_stamps is now lazily allocated we need to check that it
  92   // has in fact been allocated when calling this function.
  93   if (_time_stamps != NULL) {
  94     log_debug(gc, task, time)("GC-Thread %u entries: %d%s", id(),
  95                               _time_stamp_index,
  96                               _time_stamp_index >= GCTaskTimeStampEntries ? " (overflow)" : "");
  97     const uint max_index = MIN2(_time_stamp_index, GCTaskTimeStampEntries);
  98     for (uint i = 0; i < max_index; i++) {
  99       GCTaskTimeStamp* time_stamp = time_stamp_at(i);
 100       log_debug(gc, task, time)("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]",


< prev index next >