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