diff options
author | 2025-01-13 07:48:21 -0800 | |
---|---|---|
committer | 2025-01-13 07:48:21 -0800 | |
commit | c09f9fa24c60880b92ed7b42a454824e559b2027 (patch) | |
tree | 26aed76bce3c2757c4544b5beca60dca318f514f /cmds/dumpstate/dumpstate.cpp | |
parent | f9fc9e74167954f1e6d10c45bb65552a684bc207 (diff) | |
parent | 77f0c5506d0d1027abf1b15fa2de6e8662f00ec0 (diff) |
Merge "dumpstate: notes on usage" into main am: cbd1764034 am: 77f0c5506d
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3446594
Change-Id: I64d356bbfc983ec1ac2cbf93bb01f6a62637bfad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'cmds/dumpstate/dumpstate.cpp')
-rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index fcc6108f5f..feca18d810 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -128,6 +128,9 @@ using android::os::dumpstate::PropertiesHelper; using android::os::dumpstate::TaskQueue; using android::os::dumpstate::WaitForTask; +// BAD - See README.md: "Dumpstate philosophy: exec not link" +// Do not add more complicated variables here, prefer to execute only. Don't link more code here. + // Keep in sync with // frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java static const int TRACE_DUMP_TIMEOUT_MS = 10000; // 10 seconds @@ -1273,6 +1276,8 @@ static void DumpKernelMemoryAllocations() { } } +// BAD - See README.md: "Dumpstate philosophy: exec not link" +// This should all be moved into a separate binary rather than have complex logic here. static Dumpstate::RunStatus RunDumpsysTextByPriority(const std::string& title, int priority, std::chrono::milliseconds timeout, std::chrono::milliseconds service_timeout) { @@ -1353,6 +1358,8 @@ static Dumpstate::RunStatus RunDumpsysTextNormalPriority(const std::string& titl service_timeout); } +// BAD - See README.md: "Dumpstate philosophy: exec not link" +// This should all be moved into a separate binary rather than have complex logic here. static Dumpstate::RunStatus RunDumpsysProto(const std::string& title, int priority, std::chrono::milliseconds timeout, std::chrono::milliseconds service_timeout) { @@ -1434,6 +1441,8 @@ static Dumpstate::RunStatus RunDumpsysNormal() { * Dumpstate can pick up later and output to the bugreport. Using STDOUT_FILENO * if it's not running in the parallel task. */ +// BAD - See README.md: "Dumpstate philosophy: exec not link" +// This should all be moved into a separate binary rather than have complex logic here. static void DumpHals(int out_fd = STDOUT_FILENO) { RunCommand("HARDWARE HALS", {"lshal", "--all", "--types=all"}, CommandOptions::WithTimeout(10).AsRootIfAvailable().Build(), @@ -1490,6 +1499,9 @@ static void DumpHals(int out_fd = STDOUT_FILENO) { } } +// BAD - See README.md: "Dumpstate philosophy: exec not link" +// This should all be moved into a separate binary rather than have complex logic here. +// // Dump all of the files that make up the vendor interface. // See the files listed in dumpFileList() for the latest list of files. static void DumpVintf() { @@ -1519,6 +1531,8 @@ static void DumpExternalFragmentationInfo() { printf("------ EXTERNAL FRAGMENTATION INFO ------\n"); std::ifstream ifs("/proc/buddyinfo"); auto unusable_index_regex = std::regex{"Node\\s+([0-9]+),\\s+zone\\s+(\\S+)\\s+(.*)"}; + // BAD - See README.md: "Dumpstate philosophy: exec not link" + // This should all be moved into a separate binary rather than have complex logic here. for (std::string line; std::getline(ifs, line);) { std::smatch match_results; if (std::regex_match(line, match_results, unusable_index_regex)) { @@ -2464,6 +2478,8 @@ static dumpstate_hal_aidl::IDumpstateDevice::DumpstateMode GetDumpstateHalModeAi return dumpstate_hal_aidl::IDumpstateDevice::DumpstateMode::DEFAULT; } +// BAD - See README.md: "Dumpstate philosophy: exec not link" +// This should all be moved into a separate binary rather than have complex logic here. static void DoDumpstateBoardHidl( const sp<dumpstate_hal_hidl_1_0::IDumpstateDevice> dumpstate_hal_1_0, const std::vector<::ndk::ScopedFileDescriptor>& dumpstate_fds, |