Skip to content

Commit

Permalink
address code style feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
neethu-prasad committed Aug 9, 2024
1 parent c53dc9c commit 77fd9d5
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/hotspot/share/gc/shared/gcLocker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -155,7 +153,6 @@ void GCLocker::jni_lock(JavaThread* thread) {
if (needs_gc()) {
log_debug_jni("Blocking thread as there is a pending GC request");
}

while (needs_gc()) {
GCLockerTimingDebugLogger logger("Thread blocked to enter critical region.");
// There's at least one thread that has not left the critical region (CR)
Expand Down

0 comments on commit 77fd9d5

Please sign in to comment.