-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8336299: Improve GCLocker stall diagnostics #20277
Changes from 1 commit
0a245f8
b218518
c6b66ce
c53dc9c
77fd9d5
6ca6f29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
} | ||
}; | ||
|
||
#ifdef ASSERT | ||
|
@@ -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) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this outside the
if
logger-enabled check?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move within the
if
.