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

Unified Diff: base/process/process_metrics.h

Issue 23155002: Implement ToValue() for SystemMetrics, SystemMemoryInfoKB, DiskInfo, and SwapInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@meminfo
Patch Set: cleanup Created 7 years, 4 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 | « no previous file | base/process/process_metrics.cc » ('j') | base/process/process_metrics_linux.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_metrics.h
diff --git a/base/process/process_metrics.h b/base/process/process_metrics.h
index a33f0c0688b66338df9c742cf05775f90a579b2a..c9defdfa95fddf1e981c97eff815eca0f8fcbbfd 100644
--- a/base/process/process_metrics.h
+++ b/base/process/process_metrics.h
@@ -238,12 +238,17 @@ BASE_EXPORT int GetNumberOfThreads(ProcessHandle process);
// /proc/self/exe refers to the current executable.
BASE_EXPORT extern const char kProcSelfExe[];
+#endif // defined(OS_LINUX) || defined(OS_ANDROID)
// Data from /proc/meminfo about system-wide memory consumption.
// Values are in KB.
struct BASE_EXPORT SystemMemoryInfoKB {
SystemMemoryInfoKB();
+ // Serializes the platform specific fields to value.
+ Value* AsValue() const;
+
+#if defined(OS_LINUX) || defined(OS_ANDROID)
int total;
int free;
int buffers;
@@ -263,7 +268,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
int bytes_swpin_per_sec;
int bytes_swpout_per_sec;
int pgmajfault_per_sec;
-
+#endif
#ifdef OS_CHROMEOS
int shmem;
int slab;
@@ -283,6 +288,10 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo);
struct BASE_EXPORT SystemDiskInfo {
SystemDiskInfo();
+ // Serializes the platform specific fields to value.
+ Value* AsValue() const;
+
+#if defined(OS_LINUX)
uint64 reads;
uint64 reads_merged;
uint64 sectors_read;
@@ -296,6 +305,7 @@ struct BASE_EXPORT SystemDiskInfo {
uint64 weighted_io_time;
uint64 bytes_read_per_sec;
uint64 bytes_written_per_sec;
+#endif
};
// Checks whether the candidate string is a valid disk name, [sh]d[a-z]+
@@ -306,7 +316,6 @@ BASE_EXPORT bool ValidDiskName(const std::string& candidate);
// Retrieves data from /proc/diskstats about system-wide disk I/O.
// Fills in the provided |diskinfo| structure. Returns true on success.
BASE_EXPORT bool GetSystemDiskInfo(SystemDiskInfo* diskinfo);
-#endif // defined(OS_LINUX) || defined(OS_ANDROID)
#if defined(OS_CHROMEOS)
// Data from files in directory /sys/block/zram0 about ZRAM usage.
@@ -319,6 +328,9 @@ struct BASE_EXPORT SwapInfo {
mem_used_total(0) {
}
+ // Serializes the platform specific fields to value.
+ Value* AsValue() const;
+
uint64 num_reads;
uint64 num_writes;
uint64 compr_data_size;
@@ -340,12 +352,17 @@ class SystemMetrics {
static SystemMetrics GetCurrent();
+ // Serializes the system metrics to value.
+ Value* AsValue() const;
+
private:
FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics);
size_t committed_memory_;
-#if defined(OS_LINUX) || defined(OS_ANDROID)
SystemMemoryInfoKB memory_info_;
+ SystemDiskInfo disk_info_;
+#ifdef OS_CHROMEOS
+ SwapInfo swap_info_;
#endif
};
« no previous file with comments | « no previous file | base/process/process_metrics.cc » ('j') | base/process/process_metrics_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698