Loading cmds/dumpstate/dumpstate.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -2206,6 +2206,16 @@ Dumpstate::RunStatus Dumpstate::DumpTraces(const char** path) { continue; } // Skip cached processes. if (IsCached(pid)) { // For consistency, the header and footer to this message match those // dumped by debuggerd in the success case. dprintf(fd, "\n---- pid %d at [unknown] ----\n", pid); dprintf(fd, "Dump skipped for cached process.\n"); dprintf(fd, "---- end %d ----", pid); continue; } const std::string link_name = android::base::StringPrintf("/proc/%d/exe", pid); std::string exe; if (!android::base::Readlink(link_name, &exe)) { Loading include/input/RingBuffer.h +5 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,11 @@ public: iterator end() { return {*this, mSize}; } const_iterator end() const { return {*this, mSize}; } reference front() { return mBuffer[mBegin]; } const_reference front() const { return mBuffer[mBegin]; } reference back() { return mBuffer[bufferIndex(mSize - 1)]; } const_reference back() const { return mBuffer[bufferIndex(mSize - 1)]; } reference operator[](size_type i) { return mBuffer[bufferIndex(i)]; } const_reference operator[](size_type i) const { return mBuffer[bufferIndex(i)]; } Loading libs/binder/RpcServer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -553,7 +553,7 @@ status_t RpcServer::setupSocketServer(const RpcSocketAddress& addr) { socket(addr.addr()->sa_family, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0))); if (!socket_fd.ok()) { int savedErrno = errno; ALOGE("Could not create socket: %s", strerror(savedErrno)); ALOGE("Could not create socket at %s: %s", addr.toString().c_str(), strerror(savedErrno)); return -savedErrno; } if (0 != TEMP_FAILURE_RETRY(bind(socket_fd.get(), addr.addr(), addr.addrSize()))) { Loading libs/dumputils/dump_utils.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #include <set> #include <android-base/file.h> #include <android-base/parseint.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> Loading Loading @@ -210,3 +211,18 @@ bool IsZygote(int pid) { return cmdline == "zygote" || cmdline == "zygote64" || cmdline == "usap32" || cmdline == "usap64" || cmdline == "webview_zygote"; } bool IsCached(int pid) { std::string oom_score_adj; if (!android::base::ReadFileToString(android::base::StringPrintf("/proc/%d/oom_score_adj", pid), &oom_score_adj)) { return false; } int32_t oom_score_adj_value; if (!android::base::ParseInt(android::base::Trim(oom_score_adj), &oom_score_adj_value)) { return false; } // An OOM score greater than 900 indicates a cached process. return oom_score_adj_value >= 900; } libs/dumputils/include/dumputils/dump_utils.h +2 −0 Original line number Diff line number Diff line Loading @@ -25,4 +25,6 @@ std::set<int> get_interesting_pids(); bool IsZygote(int pid); bool IsCached(int pid); #endif // DUMPUTILS_H_ Loading
cmds/dumpstate/dumpstate.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -2206,6 +2206,16 @@ Dumpstate::RunStatus Dumpstate::DumpTraces(const char** path) { continue; } // Skip cached processes. if (IsCached(pid)) { // For consistency, the header and footer to this message match those // dumped by debuggerd in the success case. dprintf(fd, "\n---- pid %d at [unknown] ----\n", pid); dprintf(fd, "Dump skipped for cached process.\n"); dprintf(fd, "---- end %d ----", pid); continue; } const std::string link_name = android::base::StringPrintf("/proc/%d/exe", pid); std::string exe; if (!android::base::Readlink(link_name, &exe)) { Loading
include/input/RingBuffer.h +5 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,11 @@ public: iterator end() { return {*this, mSize}; } const_iterator end() const { return {*this, mSize}; } reference front() { return mBuffer[mBegin]; } const_reference front() const { return mBuffer[mBegin]; } reference back() { return mBuffer[bufferIndex(mSize - 1)]; } const_reference back() const { return mBuffer[bufferIndex(mSize - 1)]; } reference operator[](size_type i) { return mBuffer[bufferIndex(i)]; } const_reference operator[](size_type i) const { return mBuffer[bufferIndex(i)]; } Loading
libs/binder/RpcServer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -553,7 +553,7 @@ status_t RpcServer::setupSocketServer(const RpcSocketAddress& addr) { socket(addr.addr()->sa_family, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0))); if (!socket_fd.ok()) { int savedErrno = errno; ALOGE("Could not create socket: %s", strerror(savedErrno)); ALOGE("Could not create socket at %s: %s", addr.toString().c_str(), strerror(savedErrno)); return -savedErrno; } if (0 != TEMP_FAILURE_RETRY(bind(socket_fd.get(), addr.addr(), addr.addrSize()))) { Loading
libs/dumputils/dump_utils.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #include <set> #include <android-base/file.h> #include <android-base/parseint.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> Loading Loading @@ -210,3 +211,18 @@ bool IsZygote(int pid) { return cmdline == "zygote" || cmdline == "zygote64" || cmdline == "usap32" || cmdline == "usap64" || cmdline == "webview_zygote"; } bool IsCached(int pid) { std::string oom_score_adj; if (!android::base::ReadFileToString(android::base::StringPrintf("/proc/%d/oom_score_adj", pid), &oom_score_adj)) { return false; } int32_t oom_score_adj_value; if (!android::base::ParseInt(android::base::Trim(oom_score_adj), &oom_score_adj_value)) { return false; } // An OOM score greater than 900 indicates a cached process. return oom_score_adj_value >= 900; }
libs/dumputils/include/dumputils/dump_utils.h +2 −0 Original line number Diff line number Diff line Loading @@ -25,4 +25,6 @@ std::set<int> get_interesting_pids(); bool IsZygote(int pid); bool IsCached(int pid); #endif // DUMPUTILS_H_