summaryrefslogtreecommitdiffstats
path: root/runtime/thread_list.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-12-17 10:13:30 -0800
committerMathieu Chartier <mathieuc@google.com>2014-12-17 11:08:15 -0800
commitf0dc8b5519102b3d3e738aed846975ae4239421e (patch)
treecf6c6b20c12e79595fc680f5da6de5575a6ea80f /runtime/thread_list.cc
parent3e2f0fc584463e9da1142a5011ac3f7bcf083e0f (diff)
downloadart-f0dc8b5519102b3d3e738aed846975ae4239421e.zip
art-f0dc8b5519102b3d3e738aed846975ae4239421e.tar.gz
art-f0dc8b5519102b3d3e738aed846975ae4239421e.tar.bz2
Add systrace events to monitors and thread suspension
Added systrace events to SuspendThreadByPeer, SuspendThreadByThreadId and monitor contention. Bug: 18379850 Bug: 17470248 Change-Id: I29eaf97c67361a6c6b437940b8729600d78696df
Diffstat (limited to 'runtime/thread_list.cc')
-rw-r--r--runtime/thread_list.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 6a9111f..65a8bd0 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -454,6 +454,9 @@ void ThreadList::ResumeAll() {
}
void ThreadList::Resume(Thread* thread, bool for_debugger) {
+ // This assumes there was an ATRACE_BEGIN when we suspended the thread.
+ ATRACE_END();
+
Thread* self = Thread::Current();
DCHECK_NE(thread, self);
VLOG(threads) << "Resume(" << reinterpret_cast<void*>(thread) << ") starting..."
@@ -564,6 +567,12 @@ Thread* ThreadList::SuspendThreadByPeer(jobject peer, bool request_suspension,
// done.
if (thread->IsSuspended()) {
VLOG(threads) << "SuspendThreadByPeer thread suspended: " << *thread;
+ if (ATRACE_ENABLED()) {
+ std::string name;
+ thread->GetThreadName(name);
+ ATRACE_BEGIN(StringPrintf("SuspendThreadByPeer suspended %s for peer=%p", name.c_str(),
+ peer).c_str());
+ }
return thread;
}
if (total_delay_us >= kTimeoutUs) {
@@ -648,6 +657,12 @@ Thread* ThreadList::SuspendThreadByThreadId(uint32_t thread_id, bool debug_suspe
// count, or else we've waited and it has self suspended) or is the current thread, we're
// done.
if (thread->IsSuspended()) {
+ if (ATRACE_ENABLED()) {
+ std::string name;
+ thread->GetThreadName(name);
+ ATRACE_BEGIN(StringPrintf("SuspendThreadByThreadId suspended %s id=%d",
+ name.c_str(), thread_id).c_str());
+ }
VLOG(threads) << "SuspendThreadByThreadId thread suspended: " << *thread;
return thread;
}