< prev index next >

src/hotspot/share/runtime/timerTrace.cpp

Print this page

55 
56 TraceTime::TraceTime(const char* title,
57                      TraceTimerLogPrintFunc ttlpf) {
58   _active   = ttlpf!= nullptr;
59   _verbose  = true;
60   _title    = title;
61   _print    = ttlpf;
62 
63   if (_active) {
64     _accum = nullptr;
65     _t.start();
66   }
67 }
68 
69 TraceTime::~TraceTime() {
70   if (!_active) {
71     return;
72   }
73   _t.stop();
74   if (_accum != nullptr) {
75     _accum->add(_t);
76   }
77   if (!_verbose) {
78     return;
79   }
80   if (_print) {
81     _print("%s, %3.7f secs", _title, _t.seconds());
82   } else {
83     tty->print_cr("[%s, %3.7f secs]", _title, _t.seconds());
84     tty->flush();
85   }
86 }
87 

55 
56 TraceTime::TraceTime(const char* title,
57                      TraceTimerLogPrintFunc ttlpf) {
58   _active   = ttlpf!= nullptr;
59   _verbose  = true;
60   _title    = title;
61   _print    = ttlpf;
62 
63   if (_active) {
64     _accum = nullptr;
65     _t.start();
66   }
67 }
68 
69 TraceTime::~TraceTime() {
70   if (!_active) {
71     return;
72   }
73   _t.stop();
74   if (_accum != nullptr) {
75     _accum->add(&_t);
76   }
77   if (!_verbose) {
78     return;
79   }
80   if (_print) {
81     _print("%s, %3.7f secs", _title, _t.seconds());
82   } else {
83     tty->print_cr("[%s, %3.7f secs]", _title, _t.seconds());
84     tty->flush();
85   }
86 }
87 
< prev index next >