1 // Copyright 2017 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef PROCFS_UTILS_H_ 6 #define PROCFS_UTILS_H_ 7 8 #include <map> 9 #include <memory> 10 #include <string> 11 12 #include "process_info.h" 13 14 namespace procfs_utils { 15 16 // ProcFS doesn't necessarly distinguish PID vs. TID, but all threads of a 17 // process have the same Thread Group ID which is equal to Process ID. 18 int ReadTgid(int pid); 19 20 std::unique_ptr<ProcessInfo> ReadProcessInfo(int pid); 21 void ReadProcessThreads(ProcessInfo* process); 22 23 bool ReadOomStats(ProcessSnapshot* snapshot); 24 bool ReadPageFaultsAndCpuTimeStats(ProcessSnapshot* snapshot); 25 26 bool ReadMemInfoStats(std::map<std::string, uint64_t>* mem_info); 27 28 } // namespace procfs_utils 29 30 #endif // PROCFS_UTILS_H_ 31