From 77fee87b262e969b29a9ac121a8bcbf87b68d9ce Mon Sep 17 00:00:00 2001 From: Alex Light Date: Tue, 5 Sep 2017 14:51:49 -0700 Subject: Add support for JVMTI monitor events. Adds support for the JVMTI can_generate_monitor_events capability and all associated events. This adds support for the JVMTI_EVENT_MONITOR_WAIT, JVMTI_EVENT_MONITOR_WAITED, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, and JVMTI_EVENT_MONITOR_CONTENDED_ENTERED events. Bug: 65558434 Bug: 62821960 Bug: 34415266 Test: ./test.py --host -j50 Change-Id: I0fe8038e6c4249e77d37a67e5056b5d2a94b6f48 --- runtime/runtime_callbacks.cc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'runtime/runtime_callbacks.cc') diff --git a/runtime/runtime_callbacks.cc b/runtime/runtime_callbacks.cc index 16d6c13722..88d3f28583 100644 --- a/runtime/runtime_callbacks.cc +++ b/runtime/runtime_callbacks.cc @@ -21,6 +21,7 @@ #include "art_method.h" #include "base/macros.h" #include "class_linker.h" +#include "monitor.h" #include "thread.h" namespace art { @@ -38,6 +39,38 @@ static inline void Remove(T* cb, std::vector* data) { } } +void RuntimeCallbacks::MonitorContendedLocking(Monitor* m) { + for (MonitorCallback* cb : monitor_callbacks_) { + cb->MonitorContendedLocking(m); + } +} + +void RuntimeCallbacks::MonitorContendedLocked(Monitor* m) { + for (MonitorCallback* cb : monitor_callbacks_) { + cb->MonitorContendedLocked(m); + } +} + +void RuntimeCallbacks::ObjectWaitStart(Handle m, int64_t timeout) { + for (MonitorCallback* cb : monitor_callbacks_) { + cb->ObjectWaitStart(m, timeout); + } +} + +void RuntimeCallbacks::MonitorWaitFinished(Monitor* m, bool timeout) { + for (MonitorCallback* cb : monitor_callbacks_) { + cb->MonitorWaitFinished(m, timeout); + } +} + +void RuntimeCallbacks::AddMonitorCallback(MonitorCallback* cb) { + monitor_callbacks_.push_back(cb); +} + +void RuntimeCallbacks::RemoveMonitorCallback(MonitorCallback* cb) { + Remove(cb, &monitor_callbacks_); +} + void RuntimeCallbacks::RemoveThreadLifecycleCallback(ThreadLifecycleCallback* cb) { Remove(cb, &thread_callbacks_); } -- cgit v1.2.3-59-g8ed1b