< prev index next >
src/share/vm/runtime/timer.cpp
Print this page
rev 7854 : imported patch 8027962-per-phase-timing-measurements-for-strong-roots-processing
rev 7855 : [mq]: 8027962-bengt-suggestions
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -138,10 +138,24 @@
tty->flush();
}
}
}
+TrackPhaseTime::TrackPhaseTime(PhaseTimeData *data, uint phase) :
+ _data(data), _phase(phase) {
+ if (_data != NULL && _data->active()) {
+ _last = os::elapsed_counter();
+ }
+}
+
+TrackPhaseTime::~TrackPhaseTime() {
+ if (_data != NULL && _data->active()) {
+ double time = (double)(os::elapsed_counter() - _last) * 1000.0 / os::elapsed_frequency();
+ _data->set_value(_phase, time);
+ }
+}
+
TraceCPUTime::TraceCPUTime(bool doit,
bool print_cr,
outputStream *logfile) :
_active(doit),
_print_cr(print_cr),
< prev index next >