summaryrefslogtreecommitdiffstats
path: root/runtime/thread_list.h
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-12-17 14:56:47 -0800
committerMathieu Chartier <mathieuc@google.com>2014-12-17 16:03:58 -0800
commit70a596d61f8cf5b6447326c46c3386e0fbd5bfb5 (patch)
treef7affe0a976165eb9ff789270d314463f6e36660 /runtime/thread_list.h
parente9231c0aecc013c61b6cf7f88a228204651d4d41 (diff)
downloadandroid_art-70a596d61f8cf5b6447326c46c3386e0fbd5bfb5.tar.gz
android_art-70a596d61f8cf5b6447326c46c3386e0fbd5bfb5.tar.bz2
android_art-70a596d61f8cf5b6447326c46c3386e0fbd5bfb5.zip
Add thread suspend histogram
Helps measure time to suspend. Example output (maps after a few seconds): suspend all histogram: Sum: 2.806ms 99% C.I. 2us-1090.560us Avg: 43.843us Max: 1126us Change-Id: I7bd9dd3b401fb3e3059e8718556d60910e541611
Diffstat (limited to 'runtime/thread_list.h')
-rw-r--r--runtime/thread_list.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/runtime/thread_list.h b/runtime/thread_list.h
index 13684c7668..43c065ae0a 100644
--- a/runtime/thread_list.h
+++ b/runtime/thread_list.h
@@ -17,6 +17,7 @@
#ifndef ART_RUNTIME_THREAD_LIST_H_
#define ART_RUNTIME_THREAD_LIST_H_
+#include "base/histogram.h"
#include "base/mutex.h"
#include "jni.h"
#include "object_callbacks.h"
@@ -39,11 +40,10 @@ class ThreadList {
~ThreadList();
void DumpForSigQuit(std::ostream& os)
- LOCKS_EXCLUDED(Locks::thread_list_lock_);
+ LOCKS_EXCLUDED(Locks::thread_list_lock_, Locks::mutator_lock_);
// For thread suspend timeout dumps.
void Dump(std::ostream& os)
- LOCKS_EXCLUDED(Locks::thread_list_lock_,
- Locks::thread_suspend_count_lock_);
+ LOCKS_EXCLUDED(Locks::thread_list_lock_, Locks::thread_suspend_count_lock_);
pid_t GetLockOwner(); // For SignalCatcher.
// Thread suspension support.
@@ -169,6 +169,10 @@ class ThreadList {
// Signaled when threads terminate. Used to determine when all non-daemons have terminated.
ConditionVariable thread_exit_cond_ GUARDED_BY(Locks::thread_list_lock_);
+ // Thread suspend time histogram. Only modified when all the threads are suspended, so guarding
+ // by mutator lock ensures no thread can read when another thread is modifying it.
+ Histogram<uint64_t> suspend_all_historam_ GUARDED_BY(Locks::mutator_lock_);
+
friend class Thread;
DISALLOW_COPY_AND_ASSIGN(ThreadList);