TimeCheck: Track waiting through thread join in AudioFlinger
The TimeCheck watchdog is used to diagnose binder stalls.
When one occurs, it does a thread-wait analysis, tracking
downstream to the ultimate thread the target is blocked on.
We add thread join diagnostic tracing in AudioFlinger
ThreadBase::exit().
Test: atest CtsMediaAudioTestCases
Bug: 328693634
Change-Id: Id633d1371c6aedd111a04510c49e95729a0c7790
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index b519289..b6021c2 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -694,6 +694,10 @@
}
// When Thread::requestExitAndWait is made virtual and this method is renamed to
// "virtual status_t requestExitAndWait()", replace by "return Thread::requestExitAndWait();"
+
+ // For TimeCheck: track waiting on the thread join of getTid().
+ audio_utils::mutex::scoped_join_wait_check sjw(getTid());
+
requestExitAndWait();
}