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.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libartbase/base/utils.cc') diff --git a/libartbase/base/utils.cc b/libartbase/base/utils.cc index e77d37d29b..efb727f950 100644 --- a/libartbase/base/utils.cc +++ b/libartbase/base/utils.cc @@ -424,6 +424,18 @@ std::string GetOsThreadStatQuick(pid_t tid) { #endif } +char GetStateFromStatString(const std::string& stat_output) { + size_t rparen_pos = stat_output.find(")"); + if (rparen_pos == std::string::npos || rparen_pos >= stat_output.length() - 3) { + return '?'; + } + size_t state_pos = stat_output.find_first_not_of(" ", rparen_pos + 1); + if (rparen_pos == std::string::npos) { + return '?'; + } + return stat_output[state_pos]; +} + std::string GetOtherThreadOsStats() { #if defined(__linux__) DIR* dir = opendir("/proc/self/task"); -- cgit v1.2.3-59-g8ed1b