Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Unified Diff: base/process/internal_linux.cc

Issue 129353002: Parse /proc/<pid>/stats fields as int64 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 046181fb Initial. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process/internal_linux.h ('k') | base/process/process_handle_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/internal_linux.cc
diff --git a/base/process/internal_linux.cc b/base/process/internal_linux.cc
index b1d1b6f174edb206e57bd3705ae071bad9da5af4..57a3ab4271a8700224ab99917cd31d07dcc5077e 100644
--- a/base/process/internal_linux.cc
+++ b/base/process/internal_linux.cc
@@ -115,13 +115,13 @@ void ParseProcStat(const std::string& contents, ProcStatMap* output) {
}
}
-int GetProcStatsFieldAsInt(const std::vector<std::string>& proc_stats,
- ProcStatsFields field_num) {
+int64 GetProcStatsFieldAsInt64(const std::vector<std::string>& proc_stats,
+ ProcStatsFields field_num) {
DCHECK_GE(field_num, VM_PPID);
CHECK_LT(static_cast<size_t>(field_num), proc_stats.size());
- int value;
- return StringToInt(proc_stats[field_num], &value) ? value : 0;
+ int64 value;
+ return StringToInt64(proc_stats[field_num], &value) ? value : 0;
}
size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats,
@@ -133,15 +133,14 @@ size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats,
return StringToSizeT(proc_stats[field_num], &value) ? value : 0;
}
-int ReadProcStatsAndGetFieldAsInt(pid_t pid,
- ProcStatsFields field_num) {
+int64 ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num) {
std::string stats_data;
if (!ReadProcStats(pid, &stats_data))
return 0;
std::vector<std::string> proc_stats;
if (!ParseProcStats(stats_data, &proc_stats))
return 0;
- return GetProcStatsFieldAsInt(proc_stats, field_num);
+ return GetProcStatsFieldAsInt64(proc_stats, field_num);
}
size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid,
« no previous file with comments | « base/process/internal_linux.h ('k') | base/process/process_handle_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698