| Index: chrome/browser/performance_monitor/performance_monitor.h
|
| diff --git a/chrome/browser/performance_monitor/performance_monitor.h b/chrome/browser/performance_monitor/performance_monitor.h
|
| index e4fa0a5d4354959e0d1d0bec5bf2c4ffbb07faf5..8f544bdd4dc60cba15a0e6a5e0781ccffe692086 100644
|
| --- a/chrome/browser/performance_monitor/performance_monitor.h
|
| +++ b/chrome/browser/performance_monitor/performance_monitor.h
|
| @@ -5,10 +5,16 @@
|
| #ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_H_
|
| #define CHROME_BROWSER_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_H_
|
|
|
| +#include <map>
|
| +#include <string>
|
| +
|
| #include "base/callback.h"
|
| #include "base/file_path.h"
|
| +#include "base/memory/linked_ptr.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/memory/singleton.h"
|
| +#include "base/process.h"
|
| +#include "base/process_util.h"
|
| #include "chrome/browser/performance_monitor/database.h"
|
| #include "chrome/browser/performance_monitor/event.h"
|
| #include "content/public/browser/notification_details.h"
|
| @@ -23,6 +29,9 @@ class PerformanceMonitor : public content::NotificationObserver {
|
| public:
|
| typedef base::Callback<void(const std::string&)> StateValueCallback;
|
|
|
| + typedef std::map<base::ProcessHandle,
|
| + linked_ptr<base::ProcessMetrics> > MetricsMap;
|
| +
|
| // Set the path which the PerformanceMonitor should use for the database files
|
| // constructed. This must be done prior to the initialization of the
|
| // PerformanceMonitor. Returns true on success, false on failure (failure
|
| @@ -38,6 +47,13 @@ class PerformanceMonitor : public content::NotificationObserver {
|
| // start collecting data.
|
| void Start();
|
|
|
| + // Check the previous Chrome version from the Database and determine if
|
| + // it has been updated. If it has, insert an event in the database.
|
| + void CheckForVersionUpdate();
|
| +
|
| + // Gathers CPU usage and memory usage of all Chrome processes.
|
| + void GatherStatisticsOnBackgroundThread();
|
| +
|
| // content::NotificationObserver
|
| // Wait for various notifications; insert events into the database upon
|
| // occurance.
|
| @@ -73,6 +89,19 @@ class PerformanceMonitor : public content::NotificationObserver {
|
|
|
| void AddEventOnBackgroundThread(scoped_ptr<Event> event);
|
|
|
| + // Gathers the CPU usage of every process that has been running since the
|
| + // last call to GatherStatistics().
|
| + void GatherCPUUsage();
|
| +
|
| + // Gathers the memory usage of every process in the current list of processes.
|
| + void GatherMemoryUsage();
|
| +
|
| + // Updates the ProcessMetrics map with the current list of processes.
|
| + void UpdateMetricsMap();
|
| +
|
| + // A map of currently running ProcessHandles to ProcessMetrics.
|
| + MetricsMap metrics_map_;
|
| +
|
| // Gets the corresponding value of |key| from the database, and then runs
|
| // |callback| on the UI thread with that value as a parameter.
|
| void GetStateValueOnBackgroundThread(
|
|
|