Index: base/process/internal_linux.cc |
diff --git a/base/process/internal_linux.cc b/base/process/internal_linux.cc |
index e9ed641dc02909c4b4edea18be5508c630c5527f..c7820040ceccd4b8839f11ef808b23358fe2a8a9 100644 |
--- a/base/process/internal_linux.cc |
+++ b/base/process/internal_linux.cc |
@@ -133,9 +133,10 @@ size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats, |
return StringToSizeT(proc_stats[field_num], &value) ? value : 0; |
} |
-int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num) { |
+int64_t ReadStatFileAndGetFieldAsInt64(const FilePath& stat_file, |
+ ProcStatsFields field_num) { |
std::string stats_data; |
- if (!ReadProcStats(pid, &stats_data)) |
+ if (!ReadProcFile(stat_file, &stats_data)) |
return 0; |
std::vector<std::string> proc_stats; |
if (!ParseProcStats(stats_data, &proc_stats)) |
@@ -143,6 +144,16 @@ int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num) { |
return GetProcStatsFieldAsInt64(proc_stats, field_num); |
} |
+int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num) { |
+ FilePath stat_file = internal::GetProcPidDir(pid).Append(kStatFile); |
+ return ReadStatFileAndGetFieldAsInt64(stat_file, field_num); |
+} |
+ |
+int64_t ReadProcSelfStatsAndGetFieldAsInt64(ProcStatsFields field_num) { |
+ FilePath stat_file = FilePath(kProcDir).Append("self").Append(kStatFile); |
+ return ReadStatFileAndGetFieldAsInt64(stat_file, field_num); |
+} |
+ |
size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, |
ProcStatsFields field_num) { |
std::string stats_data; |