< prev index next >

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

Print this page




  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     void* old = Atomic::cmpxchg_ptr(time_stamps, &_time_stamps, NULL);
  81     if (old != NULL) {
  82       // Someone already setup the time stamps
  83       FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps);
  84     }
  85   }
  86   return &(_time_stamps[index]);
  87 }
  88 
  89 void GCTaskThread::print_task_time_stamps() {
  90   assert(log_is_enabled(Debug, gc, task, time), "Sanity");
  91 
  92   // Since _time_stamps is now lazily allocated we need to check that it
  93   // has in fact been allocated when calling this function.
  94   if (_time_stamps != NULL) {
  95     log_debug(gc, task, time)("GC-Thread %u entries: %d%s", id(),
  96                               _time_stamp_index,
  97                               _time_stamp_index >= GCTaskTimeStampEntries ? " (overflow)" : "");
  98     const uint max_index = MIN2(_time_stamp_index, GCTaskTimeStampEntries);
  99     for (uint i = 0; i < max_index; i++) {
 100       GCTaskTimeStamp* time_stamp = time_stamp_at(i);
 101       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 >