From 4bcbbe50ab5c85c5b988fe8bcf46895c850cc4ca Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Fri, 24 Jan 2025 13:42:17 -0800 Subject: Extend suspend timeout for debug activities Extend the debugging suspend timeout substantially if it appears we are running concurrently with an ANR dump. There is some concern that we may be regularly getting suspend timeouts because too many cycles are devoted to an ANR dump at the time. Extend it almost indefinitely if the cuplrit thread is in a tracing stop 't' state. This makes debugging slightly easier, and should reduce the number of spurious bug reports we have to process. Add GetOsThreadStatQuick test and include minimal test for GetStateFromStatString. Bug: 330444460 Bug: 392053307 Test: Treehugger Change-Id: I820e7283fda84fa9fd9820ff9948b992e10547ec --- libartbase/base/utils.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libartbase/base/utils.h') diff --git a/libartbase/base/utils.h b/libartbase/base/utils.h index 4b86651f95..fdb7f6650a 100644 --- a/libartbase/base/utils.h +++ b/libartbase/base/utils.h @@ -152,14 +152,18 @@ inline void ForceRead(const T* pointer) { // there is an I/O error. std::string GetProcessStatus(const char* key); -// Copy a prefix of /proc/tid/stat of the given length into buf. Return the number of bytes -// actually read, 0 on error. +// Copy a prefix of /proc/pid/task/tid/stat of the given length into buf. Return the number of +// bytes actually read, 0 on error. size_t GetOsThreadStat(pid_t tid, char* buf, size_t len); -// Return a short prefix of /proc/tid/stat as quickly and robustly as possible. Used for debugging -// timing issues and possibly issues with /proc itself. Always atomic. +// Return a short prefix of /proc/pid/task/tid/stat as quickly and robustly as possible. Used for +// debugging timing issues and possibly issues with /proc itself. Always atomic. std::string GetOsThreadStatQuick(pid_t tid); +// Given a /proc/.../stat string or prefix, such as those returned by the above, return the single +// character representation of the thread state from that string, or '?' if it can't be found. +char GetStateFromStatString(const std::string& stat_output); + // Return a concatenation of the output of GetOsThreadStatQuick(tid) for all other tids. // Less robust against concurrent change, but individual stat strings should still always // be consistent. Called only when we are nearly certain to crash anyway. -- cgit v1.2.3-59-g8ed1b