Loading cmds/dumpstate/bugreport-format.md +14 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,20 @@ files upon the end user’s request: - `description.txt`: whose value is a multi-line, detailed description of the problem. ## Android O versions On _Android O (OhMightyAndroidWhatsYourNextReleaseName?)_, the following changes were made: - The ANR traces are added to the `FS` folder, typically under `FS/data/anr` (version `2.0-dev-1`). On _Android O (Oreo)_, the following changes were made: - The ANR traces are added to the `FS` folder, typically under `FS/data/anr` (version `2.0-dev-split-anr`). ## Android P versions On _Android P (PleaseMightyAndroidWhatsYourNextReleaseName?)_, the following changes were made: - Dumpsys sections are dumped by priority (version `2.0-dev-priority-dumps`). Supported priorities can be specified when registering framework services. Section headers are changed to contain priority info. `DUMPSYS` -> `DUMPSYS CRITICAL/HIGH/NORMAL` `DUMP OF SERVICE <servicename>` -> `DUMP OF SERVICE CRITICAL/HIGH/NORMAL <servicename>` Supported Priorities: - CRITICAL - services that must dump first, and fast (under 100ms). Ex: cpuinfo. - HIGH - services that also must dump first, but can take longer (under 250ms) to dump. Ex: meminfo. - NORMAL - services that have no rush to dump and can take a long time (under 10s). ## Intermediate versions During development, the versions will be suffixed with _-devX_ or Loading cmds/dumpstate/dumpstate.cpp +44 −13 Original line number Diff line number Diff line Loading @@ -1038,6 +1038,40 @@ static void DumpIpAddrAndRules() { RunCommand("IP RULES v6", {"ip", "-6", "rule", "show"}); } // Runs dumpsys on services that must dump first and and will take less than 100ms to dump. static void RunDumpsysCritical() { if (ds.CurrentVersionSupportsPriorityDumps()) { RunDumpsys("DUMPSYS CRITICAL", {"--priority", "CRITICAL"}, CommandOptions::WithTimeout(5).DropRoot().Build()); } else { RunDumpsys("DUMPSYS MEMINFO", {"meminfo", "-a"}, CommandOptions::WithTimeout(90).DropRoot().Build()); RunDumpsys("DUMPSYS CPUINFO", {"cpuinfo", "-a"}, CommandOptions::WithTimeout(10).DropRoot().Build()); } } // Runs dumpsys on services that must dump first but can take up to 250ms to dump. static void RunDumpsysHigh() { if (ds.CurrentVersionSupportsPriorityDumps()) { RunDumpsys("DUMPSYS HIGH", {"--priority", "HIGH"}, CommandOptions::WithTimeout(20).DropRoot().Build()); } else { RunDumpsys("NETWORK DIAGNOSTICS", {"connectivity", "--diag"}); } } // Runs dumpsys on services that must dump but can take up to 10s to dump. static void RunDumpsysNormal() { if (ds.CurrentVersionSupportsPriorityDumps()) { RunDumpsys("DUMPSYS NORMAL", {"--priority", "NORMAL"}, CommandOptions::WithTimeout(90).DropRoot().Build()); } else { RunDumpsys("DUMPSYS", {"--skip", "meminfo", "cpuinfo"}, CommandOptions::WithTimeout(90).Build(), 10); } } static void dumpstate() { DurationReporter duration_reporter("DUMPSTATE"); Loading Loading @@ -1128,15 +1162,14 @@ static void dumpstate() { RunCommand("IPv6 ND CACHE", {"ip", "-6", "neigh", "show"}); RunCommand("MULTICAST ADDRESSES", {"ip", "maddr"}); RunDumpsys("NETWORK DIAGNOSTICS", {"connectivity", "--diag"}, CommandOptions::WithTimeout(10).Build()); RunDumpsysHigh(); RunCommand("SYSTEM PROPERTIES", {"getprop"}); RunCommand("VOLD DUMP", {"vdc", "dump"}); RunCommand("SECURE CONTAINERS", {"vdc", "asec", "list"}); RunCommand("STORAGED UID IO INFO", {"storaged", "-u"}); RunCommand("STORAGED IO INFO", {"storaged", "-u", "-p"}); RunCommand("FILESYSTEMS & FREE SPACE", {"df"}); Loading Loading @@ -1182,8 +1215,7 @@ static void dumpstate() { printf("== Android Framework Services\n"); printf("========================================================\n"); RunDumpsys("DUMPSYS", {"--skip", "meminfo", "cpuinfo"}, CommandOptions::WithTimeout(90).Build(), 10); RunDumpsysNormal(); printf("========================================================\n"); printf("== Checkins\n"); Loading Loading @@ -1624,10 +1656,12 @@ int main(int argc, char *argv[]) { ds.version_ = VERSION_CURRENT; } if (ds.version_ != VERSION_CURRENT && ds.version_ != VERSION_SPLIT_ANR) { MYLOGE("invalid version requested ('%s'); suppported values are: ('%s', '%s', '%s')\n", if (ds.version_ != VERSION_CURRENT && ds.version_ != VERSION_SPLIT_ANR && ds.version_ != VERSION_PRIORITY_DUMPS) { MYLOGE( "invalid version requested ('%s'); suppported values are: ('%s', '%s', '%s', '%s')\n", ds.version_.c_str(), VERSION_DEFAULT.c_str(), VERSION_CURRENT.c_str(), VERSION_SPLIT_ANR.c_str()); VERSION_SPLIT_ANR.c_str(), VERSION_PRIORITY_DUMPS.c_str()); exit(1); } Loading Loading @@ -1818,10 +1852,7 @@ int main(int argc, char *argv[]) { // Invoking the following dumpsys calls before dump_traces() to try and // keep the system stats as close to its initial state as possible. RunDumpsys("DUMPSYS MEMINFO", {"meminfo", "-a"}, CommandOptions::WithTimeout(90).DropRoot().Build()); RunDumpsys("DUMPSYS CPUINFO", {"cpuinfo", "-a"}, CommandOptions::WithTimeout(10).DropRoot().Build()); RunDumpsysCritical(); // TODO: Drop root user and move into dumpstate() once b/28633932 is fixed. dump_raft(); Loading cmds/dumpstate/dumpstate.h +11 −2 Original line number Diff line number Diff line Loading @@ -149,9 +149,15 @@ static std::string VERSION_CURRENT = "1.0"; /* * Temporary version that adds a anr-traces.txt entry. Once tools support it, the current version * will be bumped to 2.0-dev-1. * will be bumped to 2.0. */ static std::string VERSION_SPLIT_ANR = "2.0-dev-1"; static std::string VERSION_SPLIT_ANR = "2.0-dev-split-anr"; /* * Temporary version that adds priority based dumps. Once tools support it, the current version * will be bumped to 2.0. */ static std::string VERSION_PRIORITY_DUMPS = "2.0-dev-priority-dumps"; /* * "Alias" for the current version. Loading Loading @@ -266,6 +272,9 @@ class Dumpstate { /* Gets the path of a bugreport file with the given suffix. */ std::string GetPath(const std::string& suffix) const; /* Returns true if the current version supports priority dump feature. */ bool CurrentVersionSupportsPriorityDumps() const; // TODO: initialize fields on constructor // dumpstate id - unique after each device reboot. Loading cmds/dumpstate/utils.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -257,6 +257,10 @@ std::string Dumpstate::GetPath(const std::string& suffix) const { name_.c_str(), suffix.c_str()); } bool Dumpstate::CurrentVersionSupportsPriorityDumps() const { return (version_ == VERSION_PRIORITY_DUMPS); } void Dumpstate::SetProgress(std::unique_ptr<Progress> progress) { progress_ = std::move(progress); } Loading cmds/dumpsys/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,10 @@ cc_defaults { "libbinder", ], static_libs: [ "libserviceutils", ], clang: true, } Loading Loading
cmds/dumpstate/bugreport-format.md +14 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,20 @@ files upon the end user’s request: - `description.txt`: whose value is a multi-line, detailed description of the problem. ## Android O versions On _Android O (OhMightyAndroidWhatsYourNextReleaseName?)_, the following changes were made: - The ANR traces are added to the `FS` folder, typically under `FS/data/anr` (version `2.0-dev-1`). On _Android O (Oreo)_, the following changes were made: - The ANR traces are added to the `FS` folder, typically under `FS/data/anr` (version `2.0-dev-split-anr`). ## Android P versions On _Android P (PleaseMightyAndroidWhatsYourNextReleaseName?)_, the following changes were made: - Dumpsys sections are dumped by priority (version `2.0-dev-priority-dumps`). Supported priorities can be specified when registering framework services. Section headers are changed to contain priority info. `DUMPSYS` -> `DUMPSYS CRITICAL/HIGH/NORMAL` `DUMP OF SERVICE <servicename>` -> `DUMP OF SERVICE CRITICAL/HIGH/NORMAL <servicename>` Supported Priorities: - CRITICAL - services that must dump first, and fast (under 100ms). Ex: cpuinfo. - HIGH - services that also must dump first, but can take longer (under 250ms) to dump. Ex: meminfo. - NORMAL - services that have no rush to dump and can take a long time (under 10s). ## Intermediate versions During development, the versions will be suffixed with _-devX_ or Loading
cmds/dumpstate/dumpstate.cpp +44 −13 Original line number Diff line number Diff line Loading @@ -1038,6 +1038,40 @@ static void DumpIpAddrAndRules() { RunCommand("IP RULES v6", {"ip", "-6", "rule", "show"}); } // Runs dumpsys on services that must dump first and and will take less than 100ms to dump. static void RunDumpsysCritical() { if (ds.CurrentVersionSupportsPriorityDumps()) { RunDumpsys("DUMPSYS CRITICAL", {"--priority", "CRITICAL"}, CommandOptions::WithTimeout(5).DropRoot().Build()); } else { RunDumpsys("DUMPSYS MEMINFO", {"meminfo", "-a"}, CommandOptions::WithTimeout(90).DropRoot().Build()); RunDumpsys("DUMPSYS CPUINFO", {"cpuinfo", "-a"}, CommandOptions::WithTimeout(10).DropRoot().Build()); } } // Runs dumpsys on services that must dump first but can take up to 250ms to dump. static void RunDumpsysHigh() { if (ds.CurrentVersionSupportsPriorityDumps()) { RunDumpsys("DUMPSYS HIGH", {"--priority", "HIGH"}, CommandOptions::WithTimeout(20).DropRoot().Build()); } else { RunDumpsys("NETWORK DIAGNOSTICS", {"connectivity", "--diag"}); } } // Runs dumpsys on services that must dump but can take up to 10s to dump. static void RunDumpsysNormal() { if (ds.CurrentVersionSupportsPriorityDumps()) { RunDumpsys("DUMPSYS NORMAL", {"--priority", "NORMAL"}, CommandOptions::WithTimeout(90).DropRoot().Build()); } else { RunDumpsys("DUMPSYS", {"--skip", "meminfo", "cpuinfo"}, CommandOptions::WithTimeout(90).Build(), 10); } } static void dumpstate() { DurationReporter duration_reporter("DUMPSTATE"); Loading Loading @@ -1128,15 +1162,14 @@ static void dumpstate() { RunCommand("IPv6 ND CACHE", {"ip", "-6", "neigh", "show"}); RunCommand("MULTICAST ADDRESSES", {"ip", "maddr"}); RunDumpsys("NETWORK DIAGNOSTICS", {"connectivity", "--diag"}, CommandOptions::WithTimeout(10).Build()); RunDumpsysHigh(); RunCommand("SYSTEM PROPERTIES", {"getprop"}); RunCommand("VOLD DUMP", {"vdc", "dump"}); RunCommand("SECURE CONTAINERS", {"vdc", "asec", "list"}); RunCommand("STORAGED UID IO INFO", {"storaged", "-u"}); RunCommand("STORAGED IO INFO", {"storaged", "-u", "-p"}); RunCommand("FILESYSTEMS & FREE SPACE", {"df"}); Loading Loading @@ -1182,8 +1215,7 @@ static void dumpstate() { printf("== Android Framework Services\n"); printf("========================================================\n"); RunDumpsys("DUMPSYS", {"--skip", "meminfo", "cpuinfo"}, CommandOptions::WithTimeout(90).Build(), 10); RunDumpsysNormal(); printf("========================================================\n"); printf("== Checkins\n"); Loading Loading @@ -1624,10 +1656,12 @@ int main(int argc, char *argv[]) { ds.version_ = VERSION_CURRENT; } if (ds.version_ != VERSION_CURRENT && ds.version_ != VERSION_SPLIT_ANR) { MYLOGE("invalid version requested ('%s'); suppported values are: ('%s', '%s', '%s')\n", if (ds.version_ != VERSION_CURRENT && ds.version_ != VERSION_SPLIT_ANR && ds.version_ != VERSION_PRIORITY_DUMPS) { MYLOGE( "invalid version requested ('%s'); suppported values are: ('%s', '%s', '%s', '%s')\n", ds.version_.c_str(), VERSION_DEFAULT.c_str(), VERSION_CURRENT.c_str(), VERSION_SPLIT_ANR.c_str()); VERSION_SPLIT_ANR.c_str(), VERSION_PRIORITY_DUMPS.c_str()); exit(1); } Loading Loading @@ -1818,10 +1852,7 @@ int main(int argc, char *argv[]) { // Invoking the following dumpsys calls before dump_traces() to try and // keep the system stats as close to its initial state as possible. RunDumpsys("DUMPSYS MEMINFO", {"meminfo", "-a"}, CommandOptions::WithTimeout(90).DropRoot().Build()); RunDumpsys("DUMPSYS CPUINFO", {"cpuinfo", "-a"}, CommandOptions::WithTimeout(10).DropRoot().Build()); RunDumpsysCritical(); // TODO: Drop root user and move into dumpstate() once b/28633932 is fixed. dump_raft(); Loading
cmds/dumpstate/dumpstate.h +11 −2 Original line number Diff line number Diff line Loading @@ -149,9 +149,15 @@ static std::string VERSION_CURRENT = "1.0"; /* * Temporary version that adds a anr-traces.txt entry. Once tools support it, the current version * will be bumped to 2.0-dev-1. * will be bumped to 2.0. */ static std::string VERSION_SPLIT_ANR = "2.0-dev-1"; static std::string VERSION_SPLIT_ANR = "2.0-dev-split-anr"; /* * Temporary version that adds priority based dumps. Once tools support it, the current version * will be bumped to 2.0. */ static std::string VERSION_PRIORITY_DUMPS = "2.0-dev-priority-dumps"; /* * "Alias" for the current version. Loading Loading @@ -266,6 +272,9 @@ class Dumpstate { /* Gets the path of a bugreport file with the given suffix. */ std::string GetPath(const std::string& suffix) const; /* Returns true if the current version supports priority dump feature. */ bool CurrentVersionSupportsPriorityDumps() const; // TODO: initialize fields on constructor // dumpstate id - unique after each device reboot. Loading
cmds/dumpstate/utils.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -257,6 +257,10 @@ std::string Dumpstate::GetPath(const std::string& suffix) const { name_.c_str(), suffix.c_str()); } bool Dumpstate::CurrentVersionSupportsPriorityDumps() const { return (version_ == VERSION_PRIORITY_DUMPS); } void Dumpstate::SetProgress(std::unique_ptr<Progress> progress) { progress_ = std::move(progress); } Loading
cmds/dumpsys/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,10 @@ cc_defaults { "libbinder", ], static_libs: [ "libserviceutils", ], clang: true, } Loading