mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8224119: Safepoint cleanup logging logs times for things it doesn't do
Test condition before reporting times for cleanup actions. Reviewed-by: rehn, hseigel
This commit is contained in:
parent
b730805159
commit
168e5cbf66
4 changed files with 29 additions and 28 deletions
|
@ -596,14 +596,13 @@ void ClassLoaderDataGraph::purge() {
|
||||||
DependencyContext::purge_dependency_contexts();
|
DependencyContext::purge_dependency_contexts();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClassLoaderDataGraph::resize_if_needed() {
|
int ClassLoaderDataGraph::resize_dictionaries() {
|
||||||
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
|
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
|
||||||
int resized = 0;
|
int resized = 0;
|
||||||
if (Dictionary::does_any_dictionary_needs_resizing()) {
|
assert (Dictionary::does_any_dictionary_needs_resizing(), "some dictionary should need resizing");
|
||||||
FOR_ALL_DICTIONARY(cld) {
|
FOR_ALL_DICTIONARY(cld) {
|
||||||
if (cld->dictionary()->resize_if_needed()) {
|
if (cld->dictionary()->resize_if_needed()) {
|
||||||
resized++;
|
resized++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resized;
|
return resized;
|
||||||
|
|
|
@ -119,16 +119,14 @@ class ClassLoaderDataGraph : public AllStatic {
|
||||||
static GrowableArray<ClassLoaderData*>* new_clds();
|
static GrowableArray<ClassLoaderData*>* new_clds();
|
||||||
|
|
||||||
static void set_should_purge(bool b) { _should_purge = b; }
|
static void set_should_purge(bool b) { _should_purge = b; }
|
||||||
static void purge_if_needed() {
|
static bool should_purge_and_reset() {
|
||||||
// Only purge the CLDG for CMS if concurrent sweep is complete.
|
bool res = _should_purge;
|
||||||
if (_should_purge) {
|
// reset for next time.
|
||||||
purge();
|
set_should_purge(false);
|
||||||
// reset for next time.
|
return res;
|
||||||
set_should_purge(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int resize_if_needed();
|
static int resize_dictionaries();
|
||||||
|
|
||||||
static bool has_metaspace_oom() { return _metaspace_oom; }
|
static bool has_metaspace_oom() { return _metaspace_oom; }
|
||||||
static void set_metaspace_oom(bool value) { _metaspace_oom = value; }
|
static void set_metaspace_oom(bool value) { _metaspace_oom = value; }
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "classfile/classLoaderDataGraph.inline.hpp"
|
#include "classfile/classLoaderDataGraph.inline.hpp"
|
||||||
|
#include "classfile/dictionary.hpp"
|
||||||
#include "classfile/stringTable.hpp"
|
#include "classfile/stringTable.hpp"
|
||||||
#include "classfile/symbolTable.hpp"
|
#include "classfile/symbolTable.hpp"
|
||||||
#include "classfile/systemDictionary.hpp"
|
#include "classfile/systemDictionary.hpp"
|
||||||
|
@ -610,23 +611,27 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_CLD_PURGE)) {
|
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_CLD_PURGE)) {
|
||||||
// CMS delays purging the CLDG until the beginning of the next safepoint and to
|
if (ClassLoaderDataGraph::should_purge_and_reset()) {
|
||||||
// make sure concurrent sweep is done
|
// CMS delays purging the CLDG until the beginning of the next safepoint and to
|
||||||
const char* name = "purging class loader data graph";
|
// make sure concurrent sweep is done
|
||||||
EventSafepointCleanupTask event;
|
const char* name = "purging class loader data graph";
|
||||||
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
|
EventSafepointCleanupTask event;
|
||||||
ClassLoaderDataGraph::purge_if_needed();
|
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
|
||||||
|
ClassLoaderDataGraph::purge();
|
||||||
|
|
||||||
post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE)) {
|
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE)) {
|
||||||
const char* name = "resizing system dictionaries";
|
if (Dictionary::does_any_dictionary_needs_resizing()) {
|
||||||
EventSafepointCleanupTask event;
|
const char* name = "resizing system dictionaries";
|
||||||
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
|
EventSafepointCleanupTask event;
|
||||||
ClassLoaderDataGraph::resize_if_needed();
|
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
|
||||||
|
ClassLoaderDataGraph::resize_dictionaries();
|
||||||
|
|
||||||
post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_subtasks.all_tasks_completed(_num_workers);
|
_subtasks.all_tasks_completed(_num_workers);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -43,7 +43,6 @@ public class SafepointCleanupTest {
|
||||||
output.shouldContain("deflating per-thread idle monitors");
|
output.shouldContain("deflating per-thread idle monitors");
|
||||||
output.shouldContain("updating inline caches");
|
output.shouldContain("updating inline caches");
|
||||||
output.shouldContain("compilation policy safepoint handler");
|
output.shouldContain("compilation policy safepoint handler");
|
||||||
output.shouldContain("purging class loader data graph");
|
|
||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue