summaryrefslogtreecommitdiffstats
path: root/runtime/monitor.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-06-24 11:21:59 -0700
committerMathieu Chartier <mathieuc@google.com>2014-06-24 14:49:48 -0700
commit48ab687d1f864fec93c2682de6fdc44ab784e2f8 (patch)
treea014f5ea92632b8c4409e2c763d87a84aa1a644f /runtime/monitor.cc
parentcbb0e809c0a4e8a4e8b7f5d3768a1864cfb381bb (diff)
downloadart-48ab687d1f864fec93c2682de6fdc44ab784e2f8.tar.gz
art-48ab687d1f864fec93c2682de6fdc44ab784e2f8.tar.bz2
art-48ab687d1f864fec93c2682de6fdc44ab784e2f8.zip
Add logging to monitor deflation.
Change-Id: I0251ff19e0a3c3b9edc7c7e296f15eb3229f8f7c
Diffstat (limited to 'runtime/monitor.cc')
-rw-r--r--runtime/monitor.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index a19445b189..999a9e504b 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -1115,20 +1115,29 @@ void MonitorList::SweepMonitorList(IsMarkedCallback* callback, void* arg) {
}
}
+struct MonitorDeflateArgs {
+ MonitorDeflateArgs() : self(Thread::Current()), deflate_count(0) {}
+ Thread* const self;
+ size_t deflate_count;
+};
+
static mirror::Object* MonitorDeflateCallback(mirror::Object* object, void* arg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- if (Monitor::Deflate(reinterpret_cast<Thread*>(arg), object)) {
+ MonitorDeflateArgs* args = reinterpret_cast<MonitorDeflateArgs*>(arg);
+ if (Monitor::Deflate(args->self, object)) {
DCHECK_NE(object->GetLockWord(true).GetState(), LockWord::kFatLocked);
+ ++args->deflate_count;
// If we deflated, return nullptr so that the monitor gets removed from the array.
return nullptr;
}
return object; // Monitor was not deflated.
}
-void MonitorList::DeflateMonitors() {
- Thread* self = Thread::Current();
- Locks::mutator_lock_->AssertExclusiveHeld(self);
- SweepMonitorList(MonitorDeflateCallback, reinterpret_cast<Thread*>(self));
+size_t MonitorList::DeflateMonitors() {
+ MonitorDeflateArgs args;
+ Locks::mutator_lock_->AssertExclusiveHeld(args.self);
+ SweepMonitorList(MonitorDeflateCallback, &args);
+ return args.deflate_count;
}
MonitorInfo::MonitorInfo(mirror::Object* obj) : owner_(NULL), entry_count_(0) {