hotspot/src/share/vm/gc/g1/g1HRPrinter.cpp
changeset 35061 be6025ebffea
parent 33786 ac8da6513351
equal deleted inserted replaced
35060:382d0689141c 35061:be6025ebffea
    58   }
    58   }
    59   // trying to keep the Windows compiler happy
    59   // trying to keep the Windows compiler happy
    60   return NULL;
    60   return NULL;
    61 }
    61 }
    62 
    62 
    63 const char* G1HRPrinter::phase_name(PhaseType phase) {
       
    64   switch (phase) {
       
    65     case StartGC:     return "StartGC";
       
    66     case EndGC:       return "EndGC";
       
    67     case StartFullGC: return "StartFullGC";
       
    68     case EndFullGC:   return "EndFullGC";
       
    69     default:          ShouldNotReachHere();
       
    70   }
       
    71   // trying to keep the Windows compiler happy
       
    72   return NULL;
       
    73 }
       
    74 
       
    75 #define G1HR_PREFIX     " G1HR"
    63 #define G1HR_PREFIX     " G1HR"
    76 
    64 
    77 void G1HRPrinter::print(ActionType action, RegionType type,
    65 void G1HRPrinter::print(ActionType action, RegionType type,
    78                         HeapRegion* hr, HeapWord* top) {
    66                         HeapRegion* hr, HeapWord* top) {
    79   const char* action_str = action_name(action);
    67   const char* action_str = action_name(action);
    80   const char* type_str   = region_type_name(type);
    68   const char* type_str   = region_type_name(type);
    81   HeapWord* bottom = hr->bottom();
    69   HeapWord* bottom = hr->bottom();
    82 
    70 
    83   if (type_str != NULL) {
    71   if (type_str != NULL) {
    84     if (top != NULL) {
    72     if (top != NULL) {
    85       gclog_or_tty->print_cr(G1HR_PREFIX " %s(%s) " PTR_FORMAT " " PTR_FORMAT,
    73       log_trace(gc, region)(G1HR_PREFIX " %s(%s) " PTR_FORMAT " " PTR_FORMAT,
    86                              action_str, type_str, p2i(bottom), p2i(top));
    74                             action_str, type_str, p2i(bottom), p2i(top));
    87     } else {
    75     } else {
    88       gclog_or_tty->print_cr(G1HR_PREFIX " %s(%s) " PTR_FORMAT,
    76       log_trace(gc, region)(G1HR_PREFIX " %s(%s) " PTR_FORMAT,
    89                              action_str, type_str, p2i(bottom));
    77                             action_str, type_str, p2i(bottom));
    90     }
    78     }
    91   } else {
    79   } else {
    92     if (top != NULL) {
    80     if (top != NULL) {
    93       gclog_or_tty->print_cr(G1HR_PREFIX " %s " PTR_FORMAT " " PTR_FORMAT,
    81       log_trace(gc, region)(G1HR_PREFIX " %s " PTR_FORMAT " " PTR_FORMAT,
    94                              action_str, p2i(bottom), p2i(top));
    82                             action_str, p2i(bottom), p2i(top));
    95     } else {
    83     } else {
    96       gclog_or_tty->print_cr(G1HR_PREFIX " %s " PTR_FORMAT,
    84       log_trace(gc, region)(G1HR_PREFIX " %s " PTR_FORMAT,
    97                              action_str, p2i(bottom));
    85                             action_str, p2i(bottom));
    98     }
    86     }
    99   }
    87   }
   100 }
    88 }
   101 
    89 
   102 void G1HRPrinter::print(ActionType action, HeapWord* bottom, HeapWord* end) {
    90 void G1HRPrinter::print(ActionType action, HeapWord* bottom, HeapWord* end) {
   103   const char* action_str = action_name(action);
    91   const char* action_str = action_name(action);
   104 
    92 
   105   gclog_or_tty->print_cr(G1HR_PREFIX " %s [" PTR_FORMAT "," PTR_FORMAT "]",
    93   log_trace(gc, region)(G1HR_PREFIX " %s [" PTR_FORMAT "," PTR_FORMAT "]",
   106                          action_str, p2i(bottom), p2i(end));
    94                         action_str, p2i(bottom), p2i(end));
   107 }
    95 }
   108 
       
   109 void G1HRPrinter::print(PhaseType phase, size_t phase_num) {
       
   110   const char* phase_str = phase_name(phase);
       
   111   gclog_or_tty->print_cr(G1HR_PREFIX " #%s " SIZE_FORMAT, phase_str, phase_num);
       
   112 }