/system/unwinding/libunwindstack/utils/ |
D | PidUtils.cpp | 30 static bool Exited(pid_t pid) { in Exited() argument 32 pid_t wait_pid = waitpid(pid, &status, WNOHANG); in Exited() 33 if (wait_pid != pid) { in Exited() 38 fprintf(stderr, "%d died: Process exited with code %d\n", pid, WEXITSTATUS(status)); in Exited() 40 fprintf(stderr, "%d died: Process exited due to signal %d\n", pid, WTERMSIG(status)); in Exited() 42 fprintf(stderr, "%d died: Process finished for unknown reason\n", pid); in Exited() 47 bool Quiesce(pid_t pid) { in Quiesce() argument 51 if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) { in Quiesce() 58 if (ptrace(PTRACE_LISTEN, pid, 0, 0) == -1) { in Quiesce() 70 fprintf(stderr, "%d: Did not quiesce in 10 seconds\n", pid); in Quiesce() [all …]
|
/system/unwinding/libunwindstack/benchmarks/ |
D | remote_unwind_benchmarks.cpp | 37 static bool WaitForRemote(pid_t pid, volatile bool* ready_ptr) { in WaitForRemote() argument 38 return unwindstack::WaitForPidState(pid, [pid, ready_ptr]() { in WaitForRemote() 39 unwindstack::MemoryRemote memory(pid); in WaitForRemote() 78 pid_t pid; in StartRemoteRun() local 79 if ((pid = fork()) == 0) { in StartRemoteRun() 83 if (pid == -1) { in StartRemoteRun() 87 if (!WaitForRemote(pid, &ready)) { in StartRemoteRun() 88 kill(pid, SIGKILL); in StartRemoteRun() 89 waitpid(pid, nullptr, 0); in StartRemoteRun() 93 return pid; in StartRemoteRun() [all …]
|
/system/extras/ioshark/ |
D | compile-only.sh | 39 awk -v pid=$i '{ if (pid == $7) print $0}' foo > fstrace.$i 61 pid=${stracefile##*.} 62 process_strace $stracefile foo.$pid 63 if ! [ -s foo.$pid ]; then 64 rm foo.$pid 72 if [ -f fstrace.$pid ]; then 73 fgrep mmap foo.$pid > bar 83 grep -w $j fstrace.$pid > foobar 85 sort foo.$pid foobar >> footemp 91 mv footemp parsed_input_trace.$pid [all …]
|
D | collect-straces-ftraces.sh | 41 awk -v pid=$i '{ if (pid == $7) print $0}' foo > fstrace.$i 63 pid=${stracefile##*.} 64 process_strace $stracefile foo.$pid 65 if ! [ -s foo.$pid ]; then 66 rm foo.$pid 74 if [ -f fstrace.$pid ]; then 75 fgrep mmap foo.$pid > bar 85 grep -w $j fstrace.$pid > foobar 87 sort foo.$pid foobar >> footemp 93 mv footemp parsed_input_trace.$pid [all …]
|
/system/core/debuggerd/ |
D | debuggerd.cpp | 61 pid_t pid; in main() local 62 if (!android::base::ParseInt(argv[argc - 1], &pid, 1, std::numeric_limits<pid_t>::max())) { in main() 72 if (!android::procinfo::GetProcessInfo(pid, &proc_info)) { in main() 73 err(1, "failed to fetch info for process %d", pid); in main() 77 errx(1, "process %d is a zombie", pid); in main() 86 if (kill(proc_info.pid, 0) != 0) { in main() 87 if (pid == proc_info.pid) { in main() 88 err(1, "cannot send signal to process %d", pid); in main() 90 err(1, "cannot send signal to main thread %d (requested thread %d)", proc_info.pid, pid); in main() 96 "/sys/fs/cgroup/uid_%d/pid_%d/cgroup.freeze", proc_info.uid, proc_info.pid); in main() [all …]
|
/system/memory/lmkd/tests/ |
D | lmkd_tests.cpp | 101 void SetupChild(pid_t pid, int oomadj) { in SetupChild() argument 104 params.pid = pid; in SetupChild() 110 GTEST_LOG_(INFO) << "Target process " << pid << " launched"; in SetupChild() 112 ASSERT_FALSE(create_memcg(uid, pid) != 0) in SetupChild() 113 << "Target process " << pid << " failed to create a cgroup"; in SetupChild() 172 static bool ParseReapTime(const std::string& line, pid_t pid, long& reap_time) { in ParseReapTime() argument 175 reap_pid == pid; in ParseReapTime() 178 static bool ParseReapNoProcess(const std::string& line, pid_t pid) { in ParseReapNoProcess() argument 181 reap_pid == pid; in ParseReapNoProcess() 198 pid_t pid = fork(); in TEST_F() local [all …]
|
/system/unwinding/libunwindstack/tools/ |
D | unwind.cpp | 37 static bool Attach(pid_t pid) { in Attach() argument 38 if (ptrace(PTRACE_SEIZE, pid, 0, 0) == -1) { in Attach() 42 if (ptrace(PTRACE_INTERRUPT, pid, 0, 0) == -1) { in Attach() 43 ptrace(PTRACE_DETACH, pid, 0, 0); in Attach() 50 if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) { in Attach() 55 printf("%d: Failed to stop.\n", pid); in Attach() 59 void DoUnwind(pid_t pid) { in DoUnwind() argument 60 unwindstack::Regs* regs = unwindstack::Regs::RemoteGet(pid); in DoUnwind() 89 unwindstack::UnwinderFromPid unwinder(1024, pid); in DoUnwind() 105 pid_t pid = atoi(argv[1]); in main() local [all …]
|
/system/core/init/ |
D | lmkd_service.cpp | 37 static LmkdRegistrationResult RegisterProcess(uid_t uid, pid_t pid, int oom_score_adjust) { in RegisterProcess() argument 48 params.pid = pid; in RegisterProcess() 62 static bool UnregisterProcess(pid_t pid) { in UnregisterProcess() argument 70 params.pid = pid; in UnregisterProcess() 86 if (svc->pid() == exclude_pid || svc->pid() == 0) { in RegisterServices() 89 if (RegisterProcess(svc->uid(), svc->pid(), svc->oom_score_adjust()) != in RegisterServices() 98 void LmkdRegister(const std::string& name, uid_t uid, pid_t pid, int oom_score_adjust) { in LmkdRegister() argument 102 result = RegisterProcess(uid, pid, oom_score_adjust); in LmkdRegister() 105 result = RegisterProcess(uid, pid, oom_score_adjust); in LmkdRegister() 112 RegisterServices(pid); in LmkdRegister() [all …]
|
D | sigchld_handler.cpp | 58 const pid_t pid = siginfo.si_pid; in ReapOneProcess() local 59 if (pid == 0) { in ReapOneProcess() 70 auto reaper = make_scope_guard([pid] { TEMP_FAILURE_RETRY(waitpid(pid, nullptr, WNOHANG)); }); in ReapOneProcess() 76 if (SubcontextChildReap(pid)) { in ReapOneProcess() 79 service = ServiceList::GetInstance().FindService(pid, &Service::pid); in ReapOneProcess() 82 name = StringPrintf("Service '%s' (pid %d)", service->name().c_str(), pid); in ReapOneProcess() 97 name = StringPrintf("Untracked pid %d", pid); in ReapOneProcess() 109 return pid; in ReapOneProcess() 118 return pid; in ReapOneProcess() 124 const pid_t pid = ReapOneProcess(); in ReapAnyOutstandingChildren() local [all …]
|
/system/memory/libmeminfo/libdmabufinfo/tools/ |
D | dmabuf_dump.cpp | 60 static std::string GetProcessComm(const pid_t pid) { in GetProcessComm() argument 61 std::string pid_path = android::base::StringPrintf("/proc/%d/comm", pid); in GetProcessComm() 85 for (auto pid : pid_set) { in PrintDmaBufTable() local 86 std::string process = GetProcessComm(pid); in PrintDmaBufTable() 87 outputHelper->BufTableProcessHeader(pid, process); in PrintDmaBufTable() 100 for (pid_t pid : pid_set) { in PrintDmaBufTable() local 102 if (buf.fdrefs().count(pid) == 1) { in PrintDmaBufTable() 105 pid_fdrefs += buf.fdrefs().at(pid); in PrintDmaBufTable() 107 if (buf.maprefs().count(pid) == 1) { in PrintDmaBufTable() 108 pid_maprefs += buf.maprefs().at(pid); in PrintDmaBufTable() [all …]
|
/system/logging/logcat/ |
D | process_names.cpp | 21 const std::string ProcessNames::ReadCmdline(uint64_t pid) { in ReadCmdline() argument 22 const std::string path = std::string("/proc/") + std::to_string(pid) + "/cmdline"; in ReadCmdline() 36 const std::string ProcessNames::ReadComm(uint64_t pid) { in ReadComm() argument 37 const std::string path = std::string("/proc/") + std::to_string(pid) + "/comm"; in ReadComm() 46 const std::string ProcessNames::Resolve(uint64_t pid) { in Resolve() argument 47 std::string name = ReadCmdline(pid); in Resolve() 59 name = ReadComm(pid); in Resolve() 67 std::string ProcessNames::Get(uint64_t pid) { in Get() argument 69 const std::string& cached = cache.get(pid); in Get() 75 std::string name = Resolve(pid); in Get() [all …]
|
/system/unwinding/libunwindstack/include/unwindstack/ |
D | AndroidUnwinder.h | 60 AndroidUnwinder(pid_t pid) : pid_(pid) {} in AndroidUnwinder() argument 61 AndroidUnwinder(pid_t pid, std::shared_ptr<Memory>& memory) in AndroidUnwinder() argument 62 : pid_(pid), process_memory_(memory) {} in AndroidUnwinder() 63 AndroidUnwinder(pid_t pid, ArchEnum arch) : pid_(pid), arch_(arch) {} in AndroidUnwinder() argument 64 AndroidUnwinder(pid_t pid, const std::vector<std::string> initial_map_names_to_skip) in AndroidUnwinder() argument 65 : pid_(pid), initial_map_names_to_skip_(std::move(initial_map_names_to_skip)) {} in AndroidUnwinder() 66 AndroidUnwinder(pid_t pid, const std::vector<std::string> initial_map_names_to_skip, in AndroidUnwinder() argument 68 : pid_(pid), in AndroidUnwinder() 90 static AndroidUnwinder* Create(pid_t pid); 145 AndroidRemoteUnwinder(pid_t pid) : AndroidUnwinder(pid) {} in AndroidRemoteUnwinder() argument [all …]
|
/system/vold/ |
D | Process.cpp | 99 pid_t pid; in KillProcessesWithTmpfsMounts() local 101 if (!android::base::ParseInt(proc_de->d_name, &pid)) continue; in KillProcessesWithTmpfsMounts() 104 std::string mounts_file(StringPrintf("/proc/%d/mounts", pid)); in KillProcessesWithTmpfsMounts() 117 pids.insert(pid); in KillProcessesWithTmpfsMounts() 123 for (const auto& pid : pids) { in KillProcessesWithTmpfsMounts() local 124 LOG(WARNING) << "Killing pid "<< pid << " with signal " << strsignal(signal) << in KillProcessesWithTmpfsMounts() 126 kill(pid, signal); in KillProcessesWithTmpfsMounts() 144 pid_t pid; in KillProcessesWithOpenFiles() local 146 if (!android::base::ParseInt(proc_de->d_name, &pid)) continue; in KillProcessesWithOpenFiles() 150 auto path = StringPrintf("/proc/%d", pid); in KillProcessesWithOpenFiles() [all …]
|
/system/memory/libmeminfo/libdmabufinfo/ |
D | dmabufinfo.cpp | 54 static FdInfoResult ReadDmaBufFdInfo(pid_t pid, int fd, std::string* name, std::string* exporter, in ReadDmaBufFdInfo() argument 58 ::android::base::StringPrintf("%s/%d/fdinfo/%d", procfs_path.c_str(), pid, fd); in ReadDmaBufFdInfo() 109 bool ReadDmaBufFdRefs(int pid, std::vector<DmaBuffer>* dmabufs, in ReadDmaBufFdRefs() argument 117 ::android::base::StringPrintf("%s/%d/fdinfo", procfs_path.c_str(), pid); in ReadDmaBufFdRefs() 146 auto fdinfo_result = ReadDmaBufFdInfo(pid, fd, &name, &exporter, &count, &size, &inode, in ReadDmaBufFdRefs() 155 LOG(ERROR) << "Failed to read fd info for pid: " << pid << ", fd: " << fd; in ReadDmaBufFdRefs() 168 ::android::base::StringPrintf("%s/%d/fd/%d", procfs_path.c_str(), pid, fd); in ReadDmaBufFdRefs() 190 buf->AddFdRef(pid); in ReadDmaBufFdRefs() 195 db.AddFdRef(pid); in ReadDmaBufFdRefs() 201 bool ReadDmaBufMapRefs(pid_t pid, std::vector<DmaBuffer>* dmabufs, in ReadDmaBufMapRefs() argument [all …]
|
D | dmabufinfo_test.cpp | 70 pid_t pid() const { return child_pid; } in pid() function in fd_sharer 260 pid_path = procfs_path / android::base::StringPrintf("%d", pid); in SetUp() 314 int pid = 10; member in DmaBufProcessStatsTest 331 ASSERT_TRUE(ReadDmaBufInfo(pid, &dmabufs, true, procfs_path, dmabuf_sysfs_path)); in TEST_F() 361 ASSERT_TRUE(ReadDmaBufFdRefs(pid, &dmabufs, procfs_path)); in TEST_F() 376 const auto& pid_fdrefs1 = fdrefs1.find(pid); in TEST_F() 391 const auto& pid_fdrefs2 = fdrefs2.find(pid); in TEST_F() 408 ASSERT_TRUE(ReadDmaBufMapRefs(pid, &dmabufs, procfs_path, dmabuf_sysfs_path)); in TEST_F() 423 const auto& pid_maprefs1 = maprefs1.find(pid); in TEST_F() 438 const auto& pid_maprefs2 = maprefs2.find(pid); in TEST_F() [all …]
|
/system/memory/lmkd/ |
D | reaper.cpp | 56 static void set_process_group_and_prio(uid_t uid, int pid, const std::vector<std::string>& profiles, in set_process_group_and_prio() argument 62 if (!SetProcessProfilesCached(uid, pid, profiles)) { in set_process_group_and_prio() 63 ALOGW("Failed to set task profiles for the process (%d) being killed", pid); in set_process_group_and_prio() 66 snprintf(proc_path, sizeof(proc_path), "/proc/%d/task", pid); in set_process_group_and_prio() 69 pid); in set_process_group_and_prio() 80 ALOGW("Failed to get t_pid for '%s' of pid(%d)", de->d_name, pid); in set_process_group_and_prio() 115 reaper->notify_kill_failure(target.pid); in reaper_main() 119 set_process_group_and_prio(target.uid, target.pid, in reaper_main() 124 ALOGE("process_mrelease %d failed: %s", target.pid, strerror(errno)); in reaper_main() 129 ALOGI("Process %d was reaped in %ldms", target.pid, in reaper_main() [all …]
|
D | statslog.cpp | 51 int pid; member 60 static struct proc* pid_lookup(int pid) { in pid_lookup() argument 65 for (procp = pidhash[pid_hashfn(pid)]; procp && procp->pid != pid; procp = procp->pidhash_next) in pid_lookup() 93 static int memory_stat_from_cgroup(struct memory_stat* mem_st, int pid, uid_t uid __unused) { in memory_stat_from_cgroup() argument 95 if (!CgroupGetAttributePathForTask("MemStats", pid, &path)) { in memory_stat_from_cgroup() 115 static int memory_stat_from_procfs(struct memory_stat* mem_st, int pid) { in memory_stat_from_procfs() argument 120 snprintf(path, sizeof(path), PROC_STAT_FILE_PATH, pid); in memory_stat_from_procfs() 150 struct memory_stat *stats_read_memory_stat(bool per_app_memcg, int pid, uid_t uid, in stats_read_memory_stat() argument 158 if (memory_stat_from_cgroup(&mem_st, pid, uid) == 0) { in stats_read_memory_stat() 162 if (memory_stat_from_procfs(&mem_st, pid) == 0) { in stats_read_memory_stat() [all …]
|
D | statslog.h | 105 struct memory_stat *stats_read_memory_stat(bool per_app_memcg, int pid, uid_t uid, 111 void stats_store_taskname(int pid, const char* taskname); 121 void stats_remove_taskname(int pid); 123 const char* stats_get_task_name(int pid); 135 int pid __unused, uid_t uid __unused, in stats_read_memory_stat() 140 static inline void stats_store_taskname(int pid __unused, const char* taskname __unused) {} in stats_store_taskname() 144 static inline void stats_remove_taskname(int pid __unused) {} in stats_remove_taskname() 146 static inline const char* stats_get_task_name(int pid __unused) { return NULL; } in stats_get_task_name()
|
/system/memory/libmemtrack/ |
D | memtrack_test.cpp | 32 static void getprocname(pid_t pid, std::string* name) { in getprocname() argument 33 std::string fname = ::android::base::StringPrintf("/proc/%d/cmdline", pid); in getprocname() 56 pid_t pid; in main() local 57 if (!::android::base::ParseInt(de.path().filename().string(), &pid)) { in main() 60 pids.emplace_back(pid); in main() 63 for (auto& pid : pids) { in main() local 72 getprocname(pid, &cmdline); in main() 74 ret = memtrack_proc_get(p, pid); in main() 76 fprintf(stderr, "failed to get memory info for pid %d: %s (%d)\n", pid, strerror(-ret), in main() 89 fprintf(stdout, "%5d %6zu %6zu %6zu %6zu %6zu %6zu %s\n", pid, v1, v2, v3, v4, v5, v6, in main()
|
/system/core/debuggerd/tombstoned/ |
D | intercept_manager.cpp | 51 LOG(WARNING) << "intercept for pid " << intercept->pid << " and type " << intercept->dump_type in intercept_close_cb() 57 LOG(INFO) << "intercept for pid " << intercept->pid << " and type " << intercept->dump_type in intercept_close_cb() 63 auto pid_entry = intercepts.find(intercept->pid); in Unregister() 65 LOG(FATAL) << "No intercepts found for pid " << intercept->pid; in Unregister() 70 LOG(FATAL) << "Unknown intercept " << intercept->pid << " " << intercept->dump_type; in Unregister() 73 LOG(FATAL) << "Mismatch pointer trying to unregister intercept " << intercept->pid << " " in Unregister() 136 intercept->pid = intercept_request.pid; in intercept_request_cb() 141 LOG(INFO) << "registered intercept for pid " << intercept_request.pid << " and type " in intercept_request_cb() 191 Intercept* InterceptManager::Get(const pid_t pid, const DebuggerdDumpType dump_type) { in Get() argument 192 auto pid_entry = intercepts.find(pid); in Get() [all …]
|
/system/extras/simpleperf/ |
D | MapRecordReader.cpp | 51 bool MapRecordReader::ReadProcessMaps(pid_t pid, uint64_t timestamp) { in ReadProcessMaps() argument 52 std::vector<pid_t> tids = GetThreadsInProcess(pid); in ReadProcessMaps() 53 return ReadProcessMaps(pid, std::unordered_set<pid_t>(tids.begin(), tids.end()), timestamp); in ReadProcessMaps() 56 bool MapRecordReader::ReadProcessMaps(pid_t pid, const std::unordered_set<pid_t>& tids, in ReadProcessMaps() argument 60 if (!GetThreadMmapsInProcess(pid, &thread_mmaps)) { in ReadProcessMaps() 68 Mmap2Record record(attr_, false, pid, pid, map.start_addr, map.len, map.pgoff, map.prot, in ReadProcessMaps() 75 std::string process_name = GetCompleteProcessName(pid); in ReadProcessMaps() 77 CommRecord record(attr_, pid, pid, process_name, event_id_, timestamp); in ReadProcessMaps() 85 if (tid != pid && GetThreadName(tid, &name)) { in ReadProcessMaps() 91 CommRecord comm_record(attr_, pid, tid, name, event_id_, timestamp); in ReadProcessMaps() [all …]
|
D | thread_tree.cpp | 38 std::string GetSymbolMapDsoName(int pid) { in GetSymbolMapDsoName() argument 39 return android::base::StringPrintf("perf-%d.map", pid); in GetSymbolMapDsoName() 44 void ThreadTree::SetThreadName(int pid, int tid, const std::string& comm) { in SetThreadName() argument 45 ThreadEntry* thread = FindThreadOrNew(pid, tid); in SetThreadName() 52 bool ThreadTree::ForkThread(int pid, int tid, int ppid, int ptid) { in ForkThread() argument 58 if (pid != tid && pid != ppid) { in ForkThread() 62 ThreadEntry* child = FindThreadOrNew(pid, tid); in ForkThread() 64 if (pid != ppid) { in ForkThread() 85 ThreadEntry* ThreadTree::FindThreadOrNew(int pid, int tid) { in FindThreadOrNew() argument 87 if (it != thread_tree_.end() && pid == it->second.get()->pid) { in FindThreadOrNew() [all …]
|
/system/extras/ioblame/ |
D | uidProcessMapper.py | 70 name, pid, uid = "", "", "" 75 pid, uid = "", "" 77 pid = self.match_re(self.pidReMatcher, line) 81 if name != "" and pid != "" and uid != "": 82 self.add_mapping(name, int(pid), int(uid)) 83 name, pid, uid = "", "", "" 108 def add_mapping(self, name, pid, uid): argument 110 self.uidByProcessDict[name][pid] = uid 112 self.uidByProcessDict[name] = {pid: uid} 114 def get_uid(self, name, pid): argument [all …]
|
/system/memory/libmeminfo/libdmabufinfo/include/dmabufinfo/ |
D | dmabufinfo.h | 41 void AddFdRef(pid_t pid) { in AddFdRef() 42 AddRefToPidMap(pid, &fdrefs_); in AddFdRef() 47 void AddMapRef(pid_t pid) { in AddMapRef() 48 AddRefToPidMap(pid, &maprefs_); in AddMapRef() 82 void AddRefToPidMap(pid_t pid, std::unordered_map<pid_t, int>* map) { in AddRefToPidMap() 85 auto [it, inserted] = map->insert(std::make_pair(pid, 1)); in AddRefToPidMap() 87 pids_.insert(pid); in AddRefToPidMap() 94 bool ReadDmaBufInfo(pid_t pid, std::vector<DmaBuffer>* dmabufs, bool read_fdrefs = true, 105 bool ReadDmaBufFdRefs(int pid, std::vector<DmaBuffer>* dmabufs, 112 bool ReadDmaBufMapRefs(pid_t pid, std::vector<DmaBuffer>* dmabufs, [all …]
|
/system/extras/memory_replay/ |
D | File.cpp | 60 static void WaitPid(pid_t pid) { in WaitPid() argument 62 pid_t wait_pid = TEMP_FAILURE_RETRY(waitpid(pid, &wstatus, 0)); in WaitPid() 63 if (wait_pid != pid) { in WaitPid() 67 errx(1, "Unexpected pid from waitpid(): expected %d, returned %d", pid, wait_pid); in WaitPid() 88 pid_t pid; in GetUnwindInfo() local 89 if ((pid = fork()) == 0) { in GetUnwindInfo() 119 } else if (pid == -1) { in GetUnwindInfo() 122 WaitPid(pid); in GetUnwindInfo() 133 if ((pid = fork()) == 0) { in GetUnwindInfo() 164 } else if (pid == -1) { in GetUnwindInfo() [all …]
|