| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_RESOURCE_REPORTER_RESOURCE_REPORTER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_RESOURCE_REPORTER_RESOURCE_REPORTER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_RESOURCE_REPORTER_RESOURCE_REPORTER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_RESOURCE_REPORTER_RESOURCE_REPORTER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/memory_coordinator_client.h" | 16 #include "base/memory/memory_coordinator_client.h" |
| 17 #include "base/memory/memory_pressure_listener.h" | 17 #include "base/memory/memory_pressure_listener.h" |
| 18 #include "base/memory/singleton.h" | 18 #include "base/memory/singleton.h" |
| 19 #include "chrome/browser/task_manager/task_manager_observer.h" | 19 #include "chrome/browser/task_manager/task_manager_observer.h" |
| 20 #include "components/metrics/metrics_service.h" | 20 #include "components/metrics/metrics_service.h" |
| 21 #include "components/prefs/pref_registry_simple.h" | 21 #include "components/prefs/pref_registry_simple.h" |
| 22 #include "components/rappor/sample.h" | 22 #include "components/rappor/public/sample.h" |
| 23 | 23 |
| 24 namespace chromeos { | 24 namespace chromeos { |
| 25 | 25 |
| 26 // A system that tracks the top |kTopConsumersCount| CPU and memory consumer | 26 // A system that tracks the top |kTopConsumersCount| CPU and memory consumer |
| 27 // Chrome tasks and reports a weighted random sample of them via Rappor whenever | 27 // Chrome tasks and reports a weighted random sample of them via Rappor whenever |
| 28 // memory pressure is critical. The reporting is limited to once per | 28 // memory pressure is critical. The reporting is limited to once per |
| 29 // |kMinimumTimeBetweenReportsInMS|. | 29 // |kMinimumTimeBetweenReportsInMS|. |
| 30 class ResourceReporter : public task_manager::TaskManagerObserver, | 30 class ResourceReporter : public task_manager::TaskManagerObserver, |
| 31 public base::MemoryCoordinatorClient { | 31 public base::MemoryCoordinatorClient { |
| 32 public: | 32 public: |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 // Tracks whether monitoring started or not. | 194 // Tracks whether monitoring started or not. |
| 195 bool is_monitoring_; | 195 bool is_monitoring_; |
| 196 | 196 |
| 197 DISALLOW_COPY_AND_ASSIGN(ResourceReporter); | 197 DISALLOW_COPY_AND_ASSIGN(ResourceReporter); |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 } // namespace chromeos | 200 } // namespace chromeos |
| 201 | 201 |
| 202 #endif // CHROME_BROWSER_CHROMEOS_RESOURCE_REPORTER_RESOURCE_REPORTER_H_ | 202 #endif // CHROME_BROWSER_CHROMEOS_RESOURCE_REPORTER_RESOURCE_REPORTER_H_ |
| OLD | NEW |