From 639578c90c1fcb1a7fc81b4abb94d0ee4abe516e Mon Sep 17 00:00:00 2001 From: Neethu Prasad Date: Thu, 1 Aug 2024 15:34:24 +0000 Subject: [PATCH] Fixing formating --- src/hotspot/share/gc/shared/gcLocker.cpp | 38 ++++++++++++++---------- src/hotspot/share/gc/shared/gcLocker.hpp | 14 --------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/src/hotspot/share/gc/shared/gcLocker.cpp b/src/hotspot/share/gc/shared/gcLocker.cpp index 663e8d3e1ead8..f244f066652ad 100644 --- a/src/hotspot/share/gc/shared/gcLocker.cpp +++ b/src/hotspot/share/gc/shared/gcLocker.cpp @@ -39,6 +39,29 @@ volatile jint GCLocker::_jni_lock_count = 0; volatile bool GCLocker::_needs_gc = false; 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(); + } + + ~GCLockerTimingDebugLogger() { + 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()); + } + } +}; + #ifdef ASSERT volatile jint GCLocker::_debug_jni_lock_count = 0; #endif @@ -176,18 +199,3 @@ void GCLocker::jni_unlock(JavaThread* thread) { JNICritical_lock->notify_all(); } } - -GCLockerTimingDebugLogger::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() { - 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 " JLONG_FORMAT "ms. Thread \"%s\".", _log_message, elapsed_time.milliseconds(), Thread::current()->name()); - } -} \ No newline at end of file diff --git a/src/hotspot/share/gc/shared/gcLocker.hpp b/src/hotspot/share/gc/shared/gcLocker.hpp index 3a42064b4d55e..e567d0c1f1689 100644 --- a/src/hotspot/share/gc/shared/gcLocker.hpp +++ b/src/hotspot/share/gc/shared/gcLocker.hpp @@ -29,7 +29,6 @@ #include "memory/allStatic.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" -#include "utilities/ticks.hpp" class JavaThread; @@ -151,16 +150,3 @@ class GCLocker: public AllStatic { }; #endif // SHARE_GC_SHARED_GCLOCKER_HPP - -/* - * 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); - ~GCLockerTimingDebugLogger(); -}; \ No newline at end of file