< prev index next >

src/share/vm/runtime/timer.cpp

Print this page




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




 103 }
 104 
 105 jlong TimeStamp::milliseconds() const {
 106   assert(is_updated(), "must not be clear");
 107   jlong new_count = os::elapsed_counter();
 108   return (jlong)TimeHelper::counter_to_millis(new_count - _counter);
 109 }
 110 
 111 jlong TimeStamp::ticks_since_update() const {
 112   assert(is_updated(), "must not be clear");
 113   return os::elapsed_counter() - _counter;
 114 }
 115 
 116 TraceTime::TraceTime(const char* title,
 117                      bool doit) {
 118   _active   = doit;
 119   _verbose  = true;
 120 
 121   if (_active) {
 122     _accum = NULL;

 123     tty->print("[%s", title);
 124     tty->flush();
 125     _t.start();
 126   }
 127 }
 128 
 129 TraceTime::TraceTime(const char* title,
 130                      elapsedTimer* accumulator,
 131                      bool doit,
 132                      bool verbose) {
 133   _active = doit;
 134   _verbose = verbose;
 135   if (_active) {
 136     if (_verbose) {

 137       tty->print("[%s", title);
 138       tty->flush();
 139     }
 140     _accum = accumulator;
 141     _t.start();
 142   }
 143 }
 144 
 145 TraceTime::~TraceTime() {
 146   if (_active) {
 147     _t.stop();
 148     if (_accum!=NULL) _accum->add(_t);
 149     if (_verbose) {
 150       tty->print_cr(", %3.7f secs]", _t.seconds());
 151       tty->flush();
 152     }
 153   }
 154 }
 155 
 156 TraceCPUTime::TraceCPUTime(bool doit,


< prev index next >