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

Unified Diff: chrome/browser/performance_monitor/performance_monitor.h

Issue 10829342: Add BytesRead metric to CPM (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
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 b593ad943657423326db169f803258434d809cc5..d4bc4202ab7772c94a5a2ecd2ae1d894e460260e 100644
--- a/chrome/browser/performance_monitor/performance_monitor.h
+++ b/chrome/browser/performance_monitor/performance_monitor.h
@@ -51,6 +51,10 @@ class PerformanceMonitor : public content::NotificationObserver {
// start collecting data.
void Start();
+ // Inform PerformanceMonitor that bytes have been read; increment the count
+ // accordingly.
+ void BytesRead(int bytes);
+
// content::NotificationObserver
// Wait for various notifications; insert events into the database upon
// occurance.
@@ -60,6 +64,7 @@ class PerformanceMonitor : public content::NotificationObserver {
Database* database() { return database_.get(); }
FilePath database_path() { return database_path_; }
+ static bool enabled() { return enabled_; }
private:
friend struct DefaultSingletonTraits<PerformanceMonitor>;
@@ -68,6 +73,7 @@ class PerformanceMonitor : public content::NotificationObserver {
OneProfileUncleanExit);
FRIEND_TEST_ALL_PREFIXES(PerformanceMonitorUncleanExitBrowserTest,
TwoProfileUncleanExit);
+ FRIEND_TEST_ALL_PREFIXES(PerformanceMonitorBrowserTest, BytesRead);
PerformanceMonitor();
virtual ~PerformanceMonitor();
@@ -138,6 +144,11 @@ class PerformanceMonitor : public content::NotificationObserver {
void AddCrashEvent(
const content::RenderProcessHost::RendererClosedDetails& details);
+ // A count of how many bytes have been read. This corresponds to the total
+ // number of bytes that have been read since PerformanceMonitor first started
battre 2012/08/21 16:16:04 "have been read from where"? net/disk/...
Devlin 2012/08/21 19:46:46 Good point. I found this through TaskManager's cod
+ // recording, and persists across browser runs.
+ int64 bytes_read_;
+
// The location at which the database files are stored; if empty, the database
// will default to '<user_data_dir>/performance_monitor_dbs'.
FilePath database_path_;
@@ -152,6 +163,12 @@ class PerformanceMonitor : public content::NotificationObserver {
content::NotificationRegistrar registrar_;
+ // A flag indicating whether or not PerformanceMonitor is enabled. Any
+ // external sources accessing PerformanceMonitor should either wait for
+ // the PERFORMANCE_MONITOR_INITIALIZED notification or should check this
+ // flag.
+ static bool enabled_;
battre 2012/08/21 16:16:04 static attributes don't use the _ notation but use
eaugusti 2012/08/21 17:17:26 Isn't the g_ prefix only for global data? I think
Devlin 2012/08/21 19:46:46 Other examples: http://code.google.com/searchframe
+
DISALLOW_COPY_AND_ASSIGN(PerformanceMonitor);
};

Powered by Google App Engine
This is Rietveld 408576698