mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8220151
: SafepointTracing::end_of_last_safepoint_ms should return ms since epoch
Reviewed-by: dholmes, redestad
This commit is contained in:
parent
26702d005b
commit
d569301f4e
3 changed files with 11 additions and 4 deletions
|
@ -1121,6 +1121,7 @@ jlong SafepointTracing::_last_safepoint_begin_time_ns = 0;
|
||||||
jlong SafepointTracing::_last_safepoint_sync_time_ns = 0;
|
jlong SafepointTracing::_last_safepoint_sync_time_ns = 0;
|
||||||
jlong SafepointTracing::_last_safepoint_cleanup_time_ns = 0;
|
jlong SafepointTracing::_last_safepoint_cleanup_time_ns = 0;
|
||||||
jlong SafepointTracing::_last_safepoint_end_time_ns = 0;
|
jlong SafepointTracing::_last_safepoint_end_time_ns = 0;
|
||||||
|
jlong SafepointTracing::_last_safepoint_end_time_epoch_ms = 0;
|
||||||
jlong SafepointTracing::_last_app_time_ns = 0;
|
jlong SafepointTracing::_last_app_time_ns = 0;
|
||||||
int SafepointTracing::_nof_threads = 0;
|
int SafepointTracing::_nof_threads = 0;
|
||||||
int SafepointTracing::_nof_running = 0;
|
int SafepointTracing::_nof_running = 0;
|
||||||
|
@ -1133,6 +1134,8 @@ uint64_t SafepointTracing::_op_count[VM_Operation::VMOp_Terminating] = {0};
|
||||||
void SafepointTracing::init() {
|
void SafepointTracing::init() {
|
||||||
// Application start
|
// Application start
|
||||||
_last_safepoint_end_time_ns = os::javaTimeNanos();
|
_last_safepoint_end_time_ns = os::javaTimeNanos();
|
||||||
|
// amount of time since epoch
|
||||||
|
_last_safepoint_end_time_epoch_ms = os::javaTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to print the header.
|
// Helper method to print the header.
|
||||||
|
@ -1232,6 +1235,8 @@ void SafepointTracing::cleanup() {
|
||||||
|
|
||||||
void SafepointTracing::end() {
|
void SafepointTracing::end() {
|
||||||
_last_safepoint_end_time_ns = os::javaTimeNanos();
|
_last_safepoint_end_time_ns = os::javaTimeNanos();
|
||||||
|
// amount of time since epoch
|
||||||
|
_last_safepoint_end_time_epoch_ms = os::javaTimeMillis();
|
||||||
|
|
||||||
if (_max_sync_time < (_last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns)) {
|
if (_max_sync_time < (_last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns)) {
|
||||||
_max_sync_time = _last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns;
|
_max_sync_time = _last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns;
|
||||||
|
|
|
@ -240,6 +240,8 @@ private:
|
||||||
static jlong _last_safepoint_sync_time_ns;
|
static jlong _last_safepoint_sync_time_ns;
|
||||||
static jlong _last_safepoint_cleanup_time_ns;
|
static jlong _last_safepoint_cleanup_time_ns;
|
||||||
static jlong _last_safepoint_end_time_ns;
|
static jlong _last_safepoint_end_time_ns;
|
||||||
|
// amount of ms since epoch
|
||||||
|
static jlong _last_safepoint_end_time_epoch_ms;
|
||||||
// Relative
|
// Relative
|
||||||
static jlong _last_app_time_ns;
|
static jlong _last_app_time_ns;
|
||||||
|
|
||||||
|
@ -268,8 +270,8 @@ public:
|
||||||
return (os::javaTimeNanos() - _last_safepoint_end_time_ns) / (NANOUNITS / MILLIUNITS);
|
return (os::javaTimeNanos() - _last_safepoint_end_time_ns) / (NANOUNITS / MILLIUNITS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static jlong end_of_last_safepoint_ms() {
|
static jlong end_of_last_safepoint_epoch_ms() {
|
||||||
return _last_safepoint_end_time_ns / (NANOUNITS / MILLIUNITS);
|
return _last_safepoint_end_time_epoch_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jlong start_of_safepoint() {
|
static jlong start_of_safepoint() {
|
||||||
|
|
|
@ -479,7 +479,7 @@ void TieredThresholdPolicy::update_rate(jlong t, Method* m) {
|
||||||
|
|
||||||
// We don't update the rate if we've just came out of a safepoint.
|
// We don't update the rate if we've just came out of a safepoint.
|
||||||
// delta_s is the time since last safepoint in milliseconds.
|
// delta_s is the time since last safepoint in milliseconds.
|
||||||
jlong delta_s = t - SafepointTracing::end_of_last_safepoint_ms();
|
jlong delta_s = t - SafepointTracing::end_of_last_safepoint_epoch_ms();
|
||||||
jlong delta_t = t - (m->prev_time() != 0 ? m->prev_time() : start_time()); // milliseconds since the last measurement
|
jlong delta_t = t - (m->prev_time() != 0 ? m->prev_time() : start_time()); // milliseconds since the last measurement
|
||||||
// How many events were there since the last time?
|
// How many events were there since the last time?
|
||||||
int event_count = m->invocation_count() + m->backedge_count();
|
int event_count = m->invocation_count() + m->backedge_count();
|
||||||
|
@ -504,7 +504,7 @@ void TieredThresholdPolicy::update_rate(jlong t, Method* m) {
|
||||||
// Check if this method has been stale from a given number of milliseconds.
|
// Check if this method has been stale from a given number of milliseconds.
|
||||||
// See select_task().
|
// See select_task().
|
||||||
bool TieredThresholdPolicy::is_stale(jlong t, jlong timeout, Method* m) {
|
bool TieredThresholdPolicy::is_stale(jlong t, jlong timeout, Method* m) {
|
||||||
jlong delta_s = t - SafepointTracing::end_of_last_safepoint_ms();
|
jlong delta_s = t - SafepointTracing::end_of_last_safepoint_epoch_ms();
|
||||||
jlong delta_t = t - m->prev_time();
|
jlong delta_t = t - m->prev_time();
|
||||||
if (delta_t > timeout && delta_s > timeout) {
|
if (delta_t > timeout && delta_s > timeout) {
|
||||||
int event_count = m->invocation_count() + m->backedge_count();
|
int event_count = m->invocation_count() + m->backedge_count();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue