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

Unified Diff: base/process/process_metrics_linux.cc

Issue 2807463004: GN: aix port along with linux_s390x, linux_ppc64 and linux_ppc64le support. (Closed)
Patch Set: rebased, cleaned up the code, addressed comments Created 3 years, 8 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
Index: base/process/process_metrics_linux.cc
diff --git a/base/process/process_metrics_linux.cc b/base/process/process_metrics_linux.cc
index ba0dfa76b96f921e32df3ac97e1f54b44f25046f..5ecbcb976e2b7f0e55cc871ef34e1b4690df6423 100644
--- a/base/process/process_metrics_linux.cc
+++ b/base/process/process_metrics_linux.cc
@@ -92,7 +92,7 @@ size_t ReadProcStatusAndGetFieldAsSizeT(pid_t pid, const std::string& field) {
return 0;
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_AIX)
// Read /proc/<pid>/sched and look for |field|. On succes, return true and
// write the value for |field| into |result|.
// Only works for fields in the form of "field : uint_value"
@@ -124,7 +124,7 @@ bool ReadProcSchedAndGetFieldAsUint64(pid_t pid,
}
return false;
}
-#endif // defined(OS_LINUX)
+#endif // defined(OS_LINUX) || defined(OS_AIX)
// Get the total CPU of a single process. Return value is number of jiffies
// on success or -1 on error.
@@ -293,7 +293,7 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
return true;
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_AIX)
int ProcessMetrics::GetOpenFdCount() const {
// Use /proc/<pid>/fd to count the number of entries there.
FilePath fd_path = internal::GetProcPidDir(process_).Append("fd");
@@ -337,12 +337,12 @@ int ProcessMetrics::GetOpenFdSoftLimit() const {
return -1;
}
-#endif // defined(OS_LINUX)
+#endif // defined(OS_LINUX) || defined(OS_AIX)
ProcessMetrics::ProcessMetrics(ProcessHandle process)
: process_(process),
last_system_time_(0),
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_AIX)
last_absolute_idle_wakeups_(0),
#endif
last_cpu_(0) {
@@ -957,13 +957,13 @@ void GetSwapInfo(SwapInfo* swap_info) {
}
#endif // defined(OS_CHROMEOS)
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_AIX)
int ProcessMetrics::GetIdleWakeupsPerSecond() {
uint64_t wake_ups;
const char kWakeupStat[] = "se.statistics.nr_wakeups";
return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ?
CalculateIdleWakeupsPerSecond(wake_ups) : 0;
}
-#endif // defined(OS_LINUX)
+#endif // defined(OS_LINUX) || defined(OS_AIX)
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698