src/share/vm/runtime/timer.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc-g1-gc-timestamp Sdiff src/share/vm/runtime

src/share/vm/runtime/timer.cpp

Print this page
rev 3618 : 7198130: G1: PrintReferenceGC output comes out of order
Summary: Move the first part of the GC logging, including timestamp, to the start of the GC
Reviewed-by: johnc


 103   jlong ticks_per_ms = os::elapsed_frequency() / 1000;
 104   return count / ticks_per_ms;
 105 }
 106 
 107 jlong TimeStamp::ticks_since_update() const {
 108   assert(is_updated(), "must not be clear");
 109   return os::elapsed_counter() - _counter;
 110 }
 111 
 112 TraceTime::TraceTime(const char* title,
 113                      bool doit,
 114                      bool print_cr,
 115                      outputStream* logfile) {
 116   _active   = doit;
 117   _verbose  = true;
 118   _print_cr = print_cr;
 119   _logfile = (logfile != NULL) ? logfile : tty;
 120 
 121   if (_active) {
 122     _accum = NULL;
 123     if (PrintGCTimeStamps) {
 124       _logfile->stamp();
 125       _logfile->print(": ");
 126     }
 127     _logfile->print("[%s", title);
 128     _logfile->flush();
 129     _t.start();
 130   }
 131 }
 132 
 133 TraceTime::TraceTime(const char* title,
 134                      elapsedTimer* accumulator,
 135                      bool doit,
 136                      bool verbose,
 137                      outputStream* logfile) {
 138   _active = doit;
 139   _verbose = verbose;
 140   _print_cr = true;
 141   _logfile = (logfile != NULL) ? logfile : tty;
 142   if (_active) {
 143     if (_verbose) {
 144       if (PrintGCTimeStamps) {
 145         _logfile->stamp();
 146         _logfile->print(": ");
 147       }
 148       _logfile->print("[%s", title);
 149       _logfile->flush();
 150     }
 151     _accum = accumulator;
 152     _t.start();
 153   }
 154 }
 155 
 156 TraceTime::~TraceTime() {
 157   if (_active) {
 158     _t.stop();
 159     if (_accum!=NULL) _accum->add(_t);
 160     if (_verbose) {
 161       if (_print_cr) {
 162         _logfile->print_cr(", %3.7f secs]", _t.seconds());
 163       } else {
 164         _logfile->print(", %3.7f secs]", _t.seconds());
 165       }
 166       _logfile->flush();
 167     }




 103   jlong ticks_per_ms = os::elapsed_frequency() / 1000;
 104   return count / ticks_per_ms;
 105 }
 106 
 107 jlong TimeStamp::ticks_since_update() const {
 108   assert(is_updated(), "must not be clear");
 109   return os::elapsed_counter() - _counter;
 110 }
 111 
 112 TraceTime::TraceTime(const char* title,
 113                      bool doit,
 114                      bool print_cr,
 115                      outputStream* logfile) {
 116   _active   = doit;
 117   _verbose  = true;
 118   _print_cr = print_cr;
 119   _logfile = (logfile != NULL) ? logfile : tty;
 120 
 121   if (_active) {
 122     _accum = NULL;
 123     _logfile->stamp(PrintGCTimeStamps);



 124     _logfile->print("[%s", title);
 125     _logfile->flush();
 126     _t.start();
 127   }
 128 }
 129 
 130 TraceTime::TraceTime(const char* title,
 131                      elapsedTimer* accumulator,
 132                      bool doit,
 133                      bool verbose,
 134                      outputStream* logfile) {
 135   _active = doit;
 136   _verbose = verbose;
 137   _print_cr = true;
 138   _logfile = (logfile != NULL) ? logfile : tty;
 139   if (_active) {
 140     if (_verbose) {
 141       _logfile->stamp(PrintGCTimeStamps);



 142       _logfile->print("[%s", title);
 143       _logfile->flush();
 144     }
 145     _accum = accumulator;
 146     _t.start();
 147   }
 148 }
 149 
 150 TraceTime::~TraceTime() {
 151   if (_active) {
 152     _t.stop();
 153     if (_accum!=NULL) _accum->add(_t);
 154     if (_verbose) {
 155       if (_print_cr) {
 156         _logfile->print_cr(", %3.7f secs]", _t.seconds());
 157       } else {
 158         _logfile->print(", %3.7f secs]", _t.seconds());
 159       }
 160       _logfile->flush();
 161     }


src/share/vm/runtime/timer.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File