Skip to content

Commit

Permalink
Fixing formating
Browse files Browse the repository at this point in the history
  • Loading branch information
neethu-prasad committed Aug 1, 2024
1 parent c6b66ce commit 639578c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 29 deletions.
38 changes: 23 additions & 15 deletions src/hotspot/share/gc/shared/gcLocker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
}
}
14 changes: 0 additions & 14 deletions src/hotspot/share/gc/shared/gcLocker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "memory/allStatic.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
#include "utilities/ticks.hpp"

class JavaThread;

Expand Down Expand Up @@ -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();
};

0 comments on commit 639578c

Please sign in to comment.