src/share/vm/gc_implementation/shared/gcTraceTime.cpp

changeset 6131
86e6d691f2e1
parent 5237
f2110083203d
child 6876
710a3c8b516e
child 6904
0982ec23da03
     1.1 --- a/src/share/vm/gc_implementation/shared/gcTraceTime.cpp	Sat Nov 23 09:56:59 2013 +0100
     1.2 +++ b/src/share/vm/gc_implementation/shared/gcTraceTime.cpp	Sat Nov 23 12:25:13 2013 +0100
     1.3 @@ -31,12 +31,13 @@
     1.4  #include "runtime/thread.inline.hpp"
     1.5  #include "runtime/timer.hpp"
     1.6  #include "utilities/ostream.hpp"
     1.7 +#include "utilities/ticks.inline.hpp"
     1.8  
     1.9  
    1.10  GCTraceTime::GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* timer) :
    1.11 -    _title(title), _doit(doit), _print_cr(print_cr), _timer(timer) {
    1.12 +    _title(title), _doit(doit), _print_cr(print_cr), _timer(timer), _start_counter() {
    1.13    if (_doit || _timer != NULL) {
    1.14 -    _start_counter = os::elapsed_counter();
    1.15 +    _start_counter.stamp();
    1.16    }
    1.17  
    1.18    if (_timer != NULL) {
    1.19 @@ -57,10 +58,10 @@
    1.20  }
    1.21  
    1.22  GCTraceTime::~GCTraceTime() {
    1.23 -  jlong stop_counter = 0;
    1.24 +  Ticks stop_counter;
    1.25  
    1.26    if (_doit || _timer != NULL) {
    1.27 -    stop_counter = os::elapsed_counter();
    1.28 +    stop_counter.stamp();
    1.29    }
    1.30  
    1.31    if (_timer != NULL) {
    1.32 @@ -68,11 +69,12 @@
    1.33    }
    1.34  
    1.35    if (_doit) {
    1.36 -    double seconds = TimeHelper::counter_to_seconds(stop_counter - _start_counter);
    1.37 +    const Tickspan duration = stop_counter - _start_counter;
    1.38 +    double duration_in_seconds = TicksToTimeHelper::seconds(duration);
    1.39      if (_print_cr) {
    1.40 -      gclog_or_tty->print_cr(", %3.7f secs]", seconds);
    1.41 +      gclog_or_tty->print_cr(", %3.7f secs]", duration_in_seconds);
    1.42      } else {
    1.43 -      gclog_or_tty->print(", %3.7f secs]", seconds);
    1.44 +      gclog_or_tty->print(", %3.7f secs]", duration_in_seconds);
    1.45      }
    1.46      gclog_or_tty->flush();
    1.47    }

mercurial