From 85fdd2cc12660bef0d4334ef96afe1865ddd0c38 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Mon, 20 Jan 2025 12:18:05 +0000 Subject: [PATCH] 8347434: Richer VM operations events logging Reviewed-by: dholmes, jsjolen --- src/hotspot/share/runtime/vmThread.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hotspot/share/runtime/vmThread.cpp b/src/hotspot/share/runtime/vmThread.cpp index 45ebae1f61e..a517d4023da 100644 --- a/src/hotspot/share/runtime/vmThread.cpp +++ b/src/hotspot/share/runtime/vmThread.cpp @@ -401,17 +401,17 @@ void VMThread::inner_execute(VM_Operation* op) { HandleMark hm(VMThread::vm_thread()); const char* const cause = op->cause(); - EventMarkVMOperation em("Executing %sVM operation: %s%s%s%s", - prev_vm_operation != nullptr ? "nested " : "", - op->name(), - cause != nullptr ? " (" : "", - cause != nullptr ? cause : "", - cause != nullptr ? ")" : ""); + stringStream ss; + ss.print("Executing%s%s VM operation: %s", + prev_vm_operation != nullptr ? " nested" : "", + op->evaluate_at_safepoint() ? " safepoint" : " non-safepoint", + op->name()); + if (cause != nullptr) { + ss.print(" (%s)", cause); + } - log_debug(vmthread)("Evaluating %s %s VM operation: %s", - prev_vm_operation != nullptr ? "nested" : "", - _cur_vm_operation->evaluate_at_safepoint() ? "safepoint" : "non-safepoint", - _cur_vm_operation->name()); + EventMarkVMOperation em("%s", ss.freeze()); + log_debug(vmthread)("%s", ss.freeze()); bool end_safepoint = false; bool has_timeout_task = (_timeout_task != nullptr);