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

Unified Diff: base/process/process_metrics.h

Issue 22824008: Add DiskInfo struct and functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moveswapdata
Patch Set: fixed namespace for diskinfo readfiletostring 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 | « base/base.gyp ('k') | base/process/process_metrics_linux.cc » ('j') | no next file with comments »
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 273c8e0b314422a36cb31bd7cbfe7c7472c87377..1bc6c12456f0292708238ffd02e324a11a174964 100644
--- a/base/process/process_metrics.h
+++ b/base/process/process_metrics.h
@@ -12,6 +12,7 @@
#include "base/base_export.h"
#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
#include "base/process/process_handle.h"
#include "base/time/time.h"
@@ -261,6 +262,32 @@ struct BASE_EXPORT SystemMemoryInfoKB {
// Fills in the provided |meminfo| structure. Returns true on success.
// Exposed for memory debugging widget.
BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo);
+
+// Data from /proc/diskstats about system-wide disk I/O.
+struct BASE_EXPORT SystemDiskInfo {
+ SystemDiskInfo();
+
+ uint64 reads;
+ uint64 reads_merged;
+ uint64 sectors_read;
+ uint64 read_time;
+ uint64 writes;
+ uint64 writes_merged;
+ uint64 sectors_written;
+ uint64 write_time;
+ uint64 io;
+ uint64 io_time;
+ uint64 weighted_io_time;
+};
+
+// Checks whether the candidate string is a valid disk name, [sh]d[a-z]+
+// for a generic disk or mmcblk[0-9]+ for the MMC case.
+// Names of disk partitions (e.g. sda1) are not valid.
+BASE_EXPORT bool IsValidDiskName(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)
@@ -296,6 +323,8 @@ class SystemMetrics {
static SystemMetrics Sample();
private:
+ FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics);
+
size_t committed_memory_;
#if defined(OS_LINUX) || defined(OS_ANDROID)
SystemMemoryInfoKB memory_info_;
« no previous file with comments | « base/base.gyp ('k') | base/process/process_metrics_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698