mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8199712: Flight Recorder
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com> Reviewed-by: coleenp, ihse, erikj, dsamersoff, mseledtsov, egahlin, mgronlun
This commit is contained in:
parent
f575533a17
commit
a060be188d
1062 changed files with 119159 additions and 3164 deletions
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/vmSymbols.hpp"
|
||||
#include "jfr/jfrEvents.hpp"
|
||||
#include "jfr/support/jfrThreadId.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/markOop.hpp"
|
||||
|
@ -41,11 +43,12 @@
|
|||
#include "runtime/stubRoutines.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
#include "services/threadService.hpp"
|
||||
#include "trace/tracing.hpp"
|
||||
#include "trace/traceMacros.hpp"
|
||||
#include "utilities/dtrace.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
#include "utilities/preserveException.hpp"
|
||||
#if INCLUDE_JFR
|
||||
#include "jfr/support/jfrFlush.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef DTRACE_ENABLED
|
||||
|
||||
|
@ -317,7 +320,12 @@ void ObjectMonitor::enter(TRAPS) {
|
|||
// Ensure the object-monitor relationship remains stable while there's contention.
|
||||
Atomic::inc(&_count);
|
||||
|
||||
JFR_ONLY(JfrConditionalFlushWithStacktrace<EventJavaMonitorEnter> flush(jt);)
|
||||
EventJavaMonitorEnter event;
|
||||
if (event.should_commit()) {
|
||||
event.set_monitorClass(((oop)this->object())->klass());
|
||||
event.set_address((uintptr_t)(this->object_addr()));
|
||||
}
|
||||
|
||||
{ // Change java thread status to indicate blocked on monitor enter.
|
||||
JavaThreadBlockedOnMonitorEnterState jtbmes(jt, this);
|
||||
|
@ -403,18 +411,13 @@ void ObjectMonitor::enter(TRAPS) {
|
|||
// event handler consumed an unpark() issued by the thread that
|
||||
// just exited the monitor.
|
||||
}
|
||||
|
||||
if (event.should_commit()) {
|
||||
event.set_monitorClass(((oop)this->object())->klass());
|
||||
event.set_previousOwner((TYPE_THREAD)_previous_owner_tid);
|
||||
event.set_address((TYPE_ADDRESS)(uintptr_t)(this->object_addr()));
|
||||
event.set_previousOwner((uintptr_t)_previous_owner_tid);
|
||||
event.commit();
|
||||
}
|
||||
|
||||
OM_PERFDATA_OP(ContendedLockAttempts, inc());
|
||||
}
|
||||
|
||||
|
||||
// Caveat: TryLock() is not necessarily serializing if it returns failure.
|
||||
// Callers must compensate as needed.
|
||||
|
||||
|
@ -938,11 +941,11 @@ void ObjectMonitor::exit(bool not_suspended, TRAPS) {
|
|||
_Responsible = NULL;
|
||||
}
|
||||
|
||||
#if INCLUDE_TRACE
|
||||
#if INCLUDE_JFR
|
||||
// get the owner's thread id for the MonitorEnter event
|
||||
// if it is enabled and the thread isn't suspended
|
||||
if (not_suspended && Tracing::is_event_enabled(TraceJavaMonitorEnterEvent)) {
|
||||
_previous_owner_tid = THREAD_TRACE_ID(Self);
|
||||
if (not_suspended && EventJavaMonitorEnter::is_enabled()) {
|
||||
_previous_owner_tid = JFR_THREAD_ID(Self);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1390,15 +1393,16 @@ static int Adjust(volatile int * adr, int dx) {
|
|||
return v;
|
||||
}
|
||||
|
||||
// helper method for posting a monitor wait event
|
||||
void ObjectMonitor::post_monitor_wait_event(EventJavaMonitorWait* event,
|
||||
jlong notifier_tid,
|
||||
jlong timeout,
|
||||
bool timedout) {
|
||||
static void post_monitor_wait_event(EventJavaMonitorWait* event,
|
||||
ObjectMonitor* monitor,
|
||||
jlong notifier_tid,
|
||||
jlong timeout,
|
||||
bool timedout) {
|
||||
assert(event != NULL, "invariant");
|
||||
event->set_monitorClass(((oop)this->object())->klass());
|
||||
assert(monitor != NULL, "invariant");
|
||||
event->set_monitorClass(((oop)monitor->object())->klass());
|
||||
event->set_timeout(timeout);
|
||||
event->set_address((TYPE_ADDRESS)this->object_addr());
|
||||
event->set_address((uintptr_t)monitor->object_addr());
|
||||
event->set_notifier(notifier_tid);
|
||||
event->set_timedOut(timedout);
|
||||
event->commit();
|
||||
|
@ -1438,7 +1442,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
|
|||
// this ObjectMonitor.
|
||||
}
|
||||
if (event.should_commit()) {
|
||||
post_monitor_wait_event(&event, 0, millis, false);
|
||||
post_monitor_wait_event(&event, this, 0, millis, false);
|
||||
}
|
||||
TEVENT(Wait - Throw IEX);
|
||||
THROW(vmSymbols::java_lang_InterruptedException());
|
||||
|
@ -1580,7 +1584,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
|
|||
}
|
||||
|
||||
if (event.should_commit()) {
|
||||
post_monitor_wait_event(&event, node._notifier_tid, millis, ret == OS_TIMEOUT);
|
||||
post_monitor_wait_event(&event, this, node._notifier_tid, millis, ret == OS_TIMEOUT);
|
||||
}
|
||||
|
||||
OrderAccess::fence();
|
||||
|
@ -1660,7 +1664,7 @@ void ObjectMonitor::INotify(Thread * Self) {
|
|||
iterator->TState = ObjectWaiter::TS_ENTER;
|
||||
}
|
||||
iterator->_notified = 1;
|
||||
iterator->_notifier_tid = THREAD_TRACE_ID(Self);
|
||||
iterator->_notifier_tid = JFR_THREAD_ID(Self);
|
||||
|
||||
ObjectWaiter * list = _EntryList;
|
||||
if (list != NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue