From 31e0b0e3e221c59893e4054b92f3edc94bc496dd Mon Sep 17 00:00:00 2001 From: Neethu Prasad Date: Wed, 7 Aug 2024 20:06:52 +0000 Subject: [PATCH] address code style feedback --- src/hotspot/share/gc/shared/gcLocker.cpp | 30 +++++++++++------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/hotspot/share/gc/shared/gcLocker.cpp b/src/hotspot/share/gc/shared/gcLocker.cpp index f244f066652ad..54ba713923d2e 100644 --- a/src/hotspot/share/gc/shared/gcLocker.cpp +++ b/src/hotspot/share/gc/shared/gcLocker.cpp @@ -41,25 +41,23 @@ unsigned int GCLocker::_total_collections = 0; // GCLockerTimingDebugLogger tracks specific timing information for GC lock waits. class GCLockerTimingDebugLogger : public StackObj { - private: - const char* _log_message; - Ticks _start; - - public: - GCLockerTimingDebugLogger(const char* log_message) : - _log_message(log_message) { - assert(_log_message != nullptr, "GC locker debug message must be set."); - _start = Ticks::now(); - } + const char* _log_message; + Ticks _start; + +public: + GCLockerTimingDebugLogger(const char* log_message) : _log_message(log_message) { + assert(_log_message != nullptr, "GC locker debug message must be set."); + _start = Ticks::now(); + } - ~GCLockerTimingDebugLogger() { + ~GCLockerTimingDebugLogger() { + Log(gc, jni) log; + if (log.is_debug()) { + ResourceMark rm; // JavaThread::name() allocates to convert to UTF8 const Tickspan elapsed_time = Ticks::now() - _start; - Log(gc, jni) log; - if (log.is_debug()) { - ResourceMark rm; // JavaThread::name() allocates to convert to UTF8 - log.debug("%s Resumed after " UINT64_FORMAT "ms. Thread \"%s\".", _log_message, elapsed_time.milliseconds(), Thread::current()->name()); - } + log.debug("%s Resumed after " UINT64_FORMAT "ms. Thread \"%s\".", _log_message, elapsed_time.milliseconds(), Thread::current()->name()); } + } }; #ifdef ASSERT