Home
last modified time | relevance | path

Searched refs:pid (Results 1 – 25 of 506) sorted by relevance

12345678910>>...21

/system/unwinding/libunwindstack/tests/
DMemoryRemoteTest.cpp44 pid_t pid; in TEST() local
45 if ((pid = fork()) == 0) { in TEST()
49 ASSERT_LT(0, pid); in TEST()
50 TestScopedPidReaper reap(pid); in TEST()
52 ASSERT_TRUE(TestAttach(pid)); in TEST()
54 MemoryRemote remote(pid); in TEST()
62 ASSERT_TRUE(TestDetach(pid)); in TEST()
72 pid_t pid; in TEST() local
73 if ((pid = fork()) == 0) { in TEST()
78 ASSERT_LT(0, pid); in TEST()
[all …]
DTestUtils.h30 TestScopedPidReaper(pid_t pid) : pid_(pid) {} in TestScopedPidReaper() argument
40 inline bool TestQuiescePid(pid_t pid) { in TestQuiescePid() argument
45 if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) { in TestQuiescePid()
54 inline bool TestAttach(pid_t pid) { in TestAttach() argument
55 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == -1) { in TestAttach()
59 return TestQuiescePid(pid); in TestAttach()
62 inline bool TestDetach(pid_t pid) { in TestDetach() argument
63 return ptrace(PTRACE_DETACH, pid, 0, 0) == 0; in TestDetach()
DUnwindTest.cpp136 static void VerifyUnwind(pid_t pid, Maps* maps, Regs* regs, in VerifyUnwind() argument
138 auto process_memory(Memory::CreateProcessMemory(pid)); in VerifyUnwind()
229 void WaitForRemote(pid_t pid, uint64_t addr, bool leave_attached, bool* completed) { in WaitForRemote() argument
235 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == 0) { in WaitForRemote()
236 ASSERT_TRUE(TestQuiescePid(pid)) in WaitForRemote()
239 MemoryRemote memory(pid); in WaitForRemote()
246 ASSERT_EQ(0, ptrace(PTRACE_DETACH, pid, 0, 0)); in WaitForRemote()
259 pid_t pid; in TEST_F() local
260 if ((pid = fork()) == 0) { in TEST_F()
264 ASSERT_NE(-1, pid); in TEST_F()
[all …]
DMemoryMteTest.cpp62 pid_t pid; in TEST() local
63 if ((pid = fork()) == 0) { in TEST()
68 ASSERT_LT(0, pid); in TEST()
69 TestScopedPidReaper reap(pid); in TEST()
71 ASSERT_TRUE(TestAttach(pid)); in TEST()
73 MemoryRemote remote(pid); in TEST()
78 ASSERT_TRUE(TestDetach(pid)); in TEST()
/system/extras/ioshark/
Dcompile-only.sh39 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 …]
Dcollect-straces-ftraces.sh41 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/unwinding/libbacktrace/
Dbacktrace_read_benchmarks.cpp39 static void Attach(pid_t pid) { in Attach() argument
40 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == -1) { in Attach()
48 if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) { in Attach()
59 ScopedPidReaper(pid_t pid) : pid_(pid) {} in ScopedPidReaper() argument
69 static size_t ProcessVmRead(pid_t pid, uint64_t remote_src, void* dst, size_t len) { in ProcessVmRead() argument
78 ssize_t rc = process_vm_readv(pid, &dst_iov, 1, &src_iov, 1, 0); in ProcessVmRead()
82 static bool PtraceReadLong(pid_t pid, uint64_t addr, long* value) { in PtraceReadLong() argument
86 *value = ptrace(PTRACE_PEEKTEXT, pid, reinterpret_cast<void*>(addr), nullptr); in PtraceReadLong()
93 static size_t PtraceRead(pid_t pid, uint64_t addr, void* dst, size_t bytes) { in PtraceRead() argument
97 if (!PtraceReadLong(pid, addr, &data)) { in PtraceRead()
[all …]
Dbacktrace_test.cpp135 static void WaitForStop(pid_t pid) { in WaitForStop() argument
139 while (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) < 0 && (errno == EINTR || errno == ESRCH)) { in WaitForStop()
148 static void CreateRemoteProcess(pid_t* pid) { in CreateRemoteProcess() argument
149 if ((*pid = fork()) == 0) { in CreateRemoteProcess()
154 ASSERT_NE(-1, *pid); in CreateRemoteProcess()
156 ASSERT_TRUE(ptrace(PTRACE_ATTACH, *pid, 0, 0) == 0); in CreateRemoteProcess()
159 WaitForStop(*pid); in CreateRemoteProcess()
162 static void FinishRemoteProcess(pid_t pid) { in FinishRemoteProcess() argument
163 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in FinishRemoteProcess()
165 kill(pid, SIGKILL); in FinishRemoteProcess()
[all …]
/system/unwinding/libunwindstack/benchmarks/
Dremote_unwind_benchmarks.cpp35 static bool WaitForRemote(pid_t pid, volatile bool* ready_ptr) { in WaitForRemote() argument
38 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == 0) { in WaitForRemote()
39 unwindstack::TestQuiescePid(pid); in WaitForRemote()
41 unwindstack::MemoryRemote memory(pid); in WaitForRemote()
54 printf("Pid %d did not quiesce in a timely fashion.\n", pid); in WaitForRemote()
87 pid_t pid; in StartRemoteRun() local
88 if ((pid = fork()) == 0) { in StartRemoteRun()
92 if (pid == -1) { in StartRemoteRun()
96 if (!WaitForRemote(pid, &ready)) { in StartRemoteRun()
97 kill(pid, SIGKILL); in StartRemoteRun()
[all …]
/system/unwinding/libunwindstack/tools/
Dunwind.cpp37 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()
92 unwindstack::UnwinderFromPid unwinder(1024, pid); in DoUnwind()
108 pid_t pid = atoi(argv[1]); in main() local
[all …]
/system/core/init/
Dlmkd_service.cpp37 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 …]
Dsigchld_handler.cpp54 auto pid = siginfo.si_pid; in ReapOneProcess() local
55 if (pid == 0) return 0; in ReapOneProcess()
61 auto reaper = make_scope_guard([pid] { TEMP_FAILURE_RETRY(waitpid(pid, nullptr, WNOHANG)); }); in ReapOneProcess()
67 if (SubcontextChildReap(pid)) { in ReapOneProcess()
70 service = ServiceList::GetInstance().FindService(pid, &Service::pid); in ReapOneProcess()
73 name = StringPrintf("Service '%s' (pid %d)", service->name().c_str(), pid); in ReapOneProcess()
88 name = StringPrintf("Untracked pid %d", pid); in ReapOneProcess()
98 if (!service) return pid; in ReapOneProcess()
106 return pid; in ReapOneProcess()
118 pid_t pid; in WaitToBeReaped() local
[all …]
Dsnapuserd_transition.cpp76 pid_t pid = fork(); in LaunchFirstStageSnapuserd() local
77 if (pid < 0) { in LaunchFirstStageSnapuserd()
80 if (pid == 0) { in LaunchFirstStageSnapuserd()
90 setenv(kSnapuserdFirstStagePidVar, std::to_string(pid).c_str(), 1); in LaunchFirstStageSnapuserd()
92 LOG(INFO) << "Relaunched snapuserd with pid: " << pid; in LaunchFirstStageSnapuserd()
101 int pid = 0; in GetSnapuserdFirstStagePid() local
102 if (!android::base::ParseInt(pid_str, &pid)) { in GetSnapuserdFirstStagePid()
106 return {pid}; in GetSnapuserdFirstStagePid()
239 pid_t pid = fork(); in RelaunchFirstStageSnapuserd() local
240 if (pid < 0) { in RelaunchFirstStageSnapuserd()
[all …]
/system/memory/libmeminfo/libdmabufinfo/tools/
Ddmabuf_dump.cpp52 static std::string GetProcessComm(const pid_t pid) { in GetProcessComm() argument
53 std::string pid_path = android::base::StringPrintf("/proc/%d/comm", pid); in GetProcessComm()
76 for (auto pid : pid_set) { in PrintDmaBufTable() local
77 printf("%16s:%-5d |", GetProcessComm(pid).c_str(), pid); in PrintDmaBufTable()
92 for (pid_t pid : pid_set) { in PrintDmaBufTable() local
94 if (buf.fdrefs().count(pid) == 1) { in PrintDmaBufTable()
97 pid_fdrefs += buf.fdrefs().at(pid); in PrintDmaBufTable()
99 if (buf.maprefs().count(pid) == 1) { in PrintDmaBufTable()
100 pid_maprefs += buf.maprefs().at(pid); in PrintDmaBufTable()
110 per_pid_size[pid] += buf.size() / 1024; in PrintDmaBufTable()
[all …]
/system/memory/libmemtrack/
Dmemtrack_test.cpp32 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/vold/
DProcess.cpp99 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/include/dmabufinfo/
Ddmabufinfo.h41 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()
65 uint64_t Pss(pid_t pid) const { return maprefs_.count(pid) > 0 ? size_ / maprefs_.size() : 0; } in Pss()
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()
101 bool ReadDmaBufInfo(pid_t pid, std::vector<DmaBuffer>* dmabufs, bool read_fdrefs = true,
112 bool ReadDmaBufFdRefs(int pid, std::vector<DmaBuffer>* dmabufs,
[all …]
/system/core/debuggerd/
Ddebuggerd.cpp77 pid_t pid; in main() local
78 if (!android::base::ParseInt(argv[argc - 1], &pid, 1, std::numeric_limits<pid_t>::max())) { in main()
88 if (!android::procinfo::GetProcessInfo(pid, &proc_info)) { in main()
89 err(1, "failed to fetch info for process %d", pid); in main()
93 errx(1, "process %d is a zombie", pid); in main()
96 if (kill(pid, 0) != 0) { in main()
97 err(1, "cannot send signal to process %d", pid); in main()
106 if (!debuggerd_trigger_dump(pid, dump_type, 0, std::move(pipewrite))) { in main()
108 errx(1, "failed to dump process %d", pid); in main()
/system/memory/lmkd/
Dstatslog.cpp46 int pid; member
55 static struct proc* pid_lookup(int pid) { in pid_lookup() argument
60 for (procp = pidhash[pid_hashfn(pid)]; procp && procp->pid != pid; procp = procp->pidhash_next) in pid_lookup()
88 static int memory_stat_from_cgroup(struct memory_stat* mem_st, int pid, uid_t uid) { in memory_stat_from_cgroup() argument
92 snprintf(buf, sizeof(buf), MEMCG_PROCESS_MEMORY_STAT_PATH, uid, pid); in memory_stat_from_cgroup()
108 static int memory_stat_from_procfs(struct memory_stat* mem_st, int pid) { in memory_stat_from_procfs() argument
113 snprintf(path, sizeof(path), PROC_STAT_FILE_PATH, pid); in memory_stat_from_procfs()
143 struct memory_stat *stats_read_memory_stat(bool per_app_memcg, int pid, uid_t uid, in stats_read_memory_stat() argument
151 if (memory_stat_from_cgroup(&mem_st, pid, uid) == 0) { in stats_read_memory_stat()
155 if (memory_stat_from_procfs(&mem_st, pid) == 0) { in stats_read_memory_stat()
[all …]
Dstatslog.h119 struct memory_stat *stats_read_memory_stat(bool per_app_memcg, int pid, uid_t uid,
125 void stats_store_taskname(int pid, const char* taskname);
135 void stats_remove_taskname(int pid);
137 const char* stats_get_task_name(int pid);
154 int pid __unused, uid_t uid __unused, in stats_read_memory_stat()
159 static inline void stats_store_taskname(int pid __unused, const char* taskname __unused) {} in stats_store_taskname()
163 static inline void stats_remove_taskname(int pid __unused) {} in stats_remove_taskname()
165 static inline const char* stats_get_task_name(int pid __unused) { return NULL; } in stats_get_task_name()
/system/extras/simpleperf/
DMapRecordReader.cpp51 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 …]
/system/memory/libmeminfo/libdmabufinfo/
Ddmabufinfo_test.cpp69 pid_t pid() const { return child_pid; } in pid() function in fd_sharer
298 pid_path = procfs_path / android::base::StringPrintf("%d", pid); in SetUp()
352 int pid = 10; member in DmaBufProcessStatsTest
369 ASSERT_TRUE(ReadDmaBufInfo(pid, &dmabufs, true, procfs_path, dmabuf_sysfs_path)); in TEST_F()
399 ASSERT_TRUE(ReadDmaBufFdRefs(pid, &dmabufs, procfs_path)); in TEST_F()
414 const auto& pid_fdrefs1 = fdrefs1.find(pid); in TEST_F()
429 const auto& pid_fdrefs2 = fdrefs2.find(pid); in TEST_F()
446 ASSERT_TRUE(ReadDmaBufMapRefs(pid, &dmabufs, procfs_path, dmabuf_sysfs_path)); in TEST_F()
461 const auto& pid_maprefs1 = maprefs1.find(pid); in TEST_F()
476 const auto& pid_maprefs2 = maprefs2.find(pid); in TEST_F()
[all …]
/system/extras/memory_replay/
DFile.cpp59 static void WaitPid(pid_t pid) { in WaitPid() argument
61 pid_t wait_pid = TEMP_FAILURE_RETRY(waitpid(pid, &wstatus, 0)); in WaitPid()
62 if (wait_pid != pid) { in WaitPid()
66 errx(1, "Unexpected pid from waitpid(): expected %d, returned %d", pid, wait_pid); in WaitPid()
87 pid_t pid; in GetUnwindInfo() local
88 if ((pid = fork()) == 0) { in GetUnwindInfo()
118 } else if (pid == -1) { in GetUnwindInfo()
121 WaitPid(pid); in GetUnwindInfo()
132 if ((pid = fork()) == 0) { in GetUnwindInfo()
163 } else if (pid == -1) { in GetUnwindInfo()
[all …]
/system/logging/liblog/
Dlogger_read.cpp41 log_time start, pid_t pid) { in android_logger_list_alloc_internal() argument
50 logger_list->pid = pid; in android_logger_list_alloc_internal()
55 struct logger_list* android_logger_list_alloc(int mode, unsigned int tail, pid_t pid) { in android_logger_list_alloc() argument
56 return android_logger_list_alloc_internal(mode, tail, log_time(0, 0), pid); in android_logger_list_alloc()
59 struct logger_list* android_logger_list_alloc_time(int mode, log_time start, pid_t pid) { in android_logger_list_alloc_time() argument
60 return android_logger_list_alloc_internal(mode, 0, start, pid); in android_logger_list_alloc_time()
78 pid_t pid) { in android_logger_list_open() argument
79 struct logger_list* logger_list = android_logger_list_alloc(mode, tail, pid); in android_logger_list_open()
/system/extras/simpleperf/scripts/purgatorio/
Dpurgatorio.py141 def __init__(self, pid, tid, name): argument
144 self.pid = pid
147 return self.pid < other.pid or (self.pid == other.pid and self.tid < other.tid)
150 return self.pid > other.pid or (self.pid == other.pid and self.tid > other.tid)
153 return self.pid == other.pid and self.tid == other.tid and self.name == other.name
156 return str(self.pid) + ':' + str(self.tid) + ' ' + self.name
211 thread_desc = ThreadDescriptor(sample.pid, sample.tid, sample.thread_comm)
245 if thread_desc.pid != last_pid:
246 last_pid = thread_desc.pid
250 color_map[str(thread_desc.pid)] = palette[palette_index]
[all …]

12345678910>>...21