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

Unified Diff: chrome/browser/chromeos/policy/device_status_collector.h

Issue 884063003: Updated device reporting code to report multiple samples of free RAM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: chrome/browser/chromeos/policy/device_status_collector.h
diff --git a/chrome/browser/chromeos/policy/device_status_collector.h b/chrome/browser/chromeos/policy/device_status_collector.h
index 0780cff0cc9e6dfa7deae361aceaf7c8ac4b56ff..e41ceb5e6fe0aa14b0c12e729cb39eccfe92b550 100644
--- a/chrome/browser/chromeos/policy/device_status_collector.h
+++ b/chrome/browser/chromeos/policy/device_status_collector.h
@@ -78,8 +78,8 @@ class DeviceStatusCollector : public CloudPolicyClient::StatusProvider {
// How often, in seconds, to poll to see if the user is idle.
static const unsigned int kIdlePollIntervalSeconds = 30;
- // The total number of CPU samples cached internally.
- static const unsigned int kMaxCPUSamples = 10;
+ // The total number of hardware resource usage samples cached internally.
+ static const unsigned int kMaxResourceUsageSamples = 10;
protected:
// Check whether the user has been idle for a certain period of time.
@@ -91,8 +91,8 @@ class DeviceStatusCollector : public CloudPolicyClient::StatusProvider {
// Callback which receives the results of the idle state check.
void IdleStateCallback(ui::IdleState state);
- // Samples the current CPU usage and updates our cache of samples.
- void SampleCPUUsage();
+ // Samples the current CPU and RAM usage and updates our cache of samples.
+ void SampleResourceUsage();
// Returns the percentage of total CPU that each process uses. Virtual so it
// can be mocked.
@@ -187,9 +187,18 @@ class DeviceStatusCollector : public CloudPolicyClient::StatusProvider {
// Cached disk volume information.
std::vector<enterprise_management::VolumeInfo> volume_info_;
- // Cached percentage-of-CPU-used data (contains multiple samples taken
+ struct ResourceUsage {
+ // Sample of percentage-of-CPU-used across all processes (0-100)
+ int cpu_usage_percent;
+
+ // Amount of free RAM (measures raw memory used by processes, not internal
+ // memory waiting to be reclaimed by GC).
+ int64 bytes_of_ram_free;
+ };
+
+ // Samples of resource usage (contains multiple samples taken
// periodically every kHardwareStatusSampleIntervalSeconds).
- std::deque<int> cpu_usage_percent_;
+ std::deque<ResourceUsage> resource_usage_;
// Callback invoked to fetch information about the mounted disk volumes.
VolumeInfoFetcher volume_info_fetcher_;

Powered by Google App Engine
This is Rietveld 408576698