Skip to content

Commit

Permalink
8289436: Make the redefine timer statistics more accurate
Browse files Browse the repository at this point in the history
Reviewed-by: sspitsyn, cjplummer, lmesnik
  • Loading branch information
tbzhang authored and DamonFool committed Jul 6, 2022
1 parent a40c17b commit 403a9bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/hotspot/share/prims/jvmtiRedefineClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ bool VM_RedefineClasses::doit_prologue() {
void VM_RedefineClasses::doit() {
Thread* current = Thread::current();

if (log_is_enabled(Info, redefine, class, timer)) {
_timer_vm_op_doit.start();
}

#if INCLUDE_CDS
if (UseSharedSpaces) {
// Sharing is enabled so we remap the shared readonly space to
Expand All @@ -246,6 +250,7 @@ void VM_RedefineClasses::doit() {
if (!MetaspaceShared::remap_shared_readonly_as_readwrite()) {
log_info(redefine, class, load)("failed to remap shared readonly space to readwrite, private");
_res = JVMTI_ERROR_INTERNAL;
_timer_vm_op_doit.stop();
return;
}
}
Expand Down Expand Up @@ -295,6 +300,8 @@ void VM_RedefineClasses::doit() {

// Clean up any metadata now unreferenced while MetadataOnStackMark is set.
ClassLoaderDataGraph::clean_deallocate_lists(false);

_timer_vm_op_doit.stop();
}

void VM_RedefineClasses::doit_epilogue() {
Expand All @@ -309,8 +316,7 @@ void VM_RedefineClasses::doit_epilogue() {
if (log_is_enabled(Info, redefine, class, timer)) {
// Used to have separate timers for "doit" and "all", but the timer
// overhead skewed the measurements.
julong doit_time = _timer_rsc_phase1.milliseconds() +
_timer_rsc_phase2.milliseconds();
julong doit_time = _timer_vm_op_doit.milliseconds();
julong all_time = _timer_vm_op_prologue.milliseconds() + doit_time;

log_info(redefine, class, timer)
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/prims/jvmtiRedefineClasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ class VM_RedefineClasses: public VM_Operation {
// the heavy lifting.
elapsedTimer _timer_rsc_phase1;
elapsedTimer _timer_rsc_phase2;
elapsedTimer _timer_vm_op_doit;
elapsedTimer _timer_vm_op_prologue;

// Redefinition id used by JFR
Expand Down

1 comment on commit 403a9bc

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.