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

Side by Side Diff: chrome/browser/metrics/perf_provider_chromeos.h

Issue 364913007: metrics: Add random delays to perf collection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pass delays as TimeDeltas; Renamed functions; Disable all timers if logged out; Do not collect when… Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_METRICS_PERF_PROVIDER_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_
6 #define CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ 6 #define CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 void ScheduleCollection(); 78 void ScheduleCollection();
79 79
80 // Collects perf data for a given |trigger_event|. Calls perf via the ChromeOS 80 // Collects perf data for a given |trigger_event|. Calls perf via the ChromeOS
81 // debug daemon's dbus interface. 81 // debug daemon's dbus interface.
82 void CollectIfNecessary(scoped_ptr<SampledProfile> sampled_profile); 82 void CollectIfNecessary(scoped_ptr<SampledProfile> sampled_profile);
83 83
84 // Collects perf data on a repeating basis by calling CollectIfNecessary() and 84 // Collects perf data on a repeating basis by calling CollectIfNecessary() and
85 // reschedules it to be collected again. 85 // reschedules it to be collected again.
86 void DoPeriodicCollection(); 86 void DoPeriodicCollection();
87 87
88 // Collects perf data after a resume. |sleep_duration| is the duration the
89 // system was suspended before resuming. |time_after_resume_ms| is how long
90 // ago the system resumed.
91 void CollectPerfDataAfterResume(const base::TimeDelta& sleep_duration,
92 const base::TimeDelta& time_after_resume);
93
94 // Collects perf data after a session restore. |time_after_restore| is how
95 // long ago the session restore started.
96 void CollectPerfDataAfterSessionRestore(
97 const base::TimeDelta& time_after_restore);
98
88 // Parses a perf data protobuf from the |data| passed in only if the 99 // Parses a perf data protobuf from the |data| passed in only if the
89 // |incognito_observer| indicates that no incognito window had been opened 100 // |incognito_observer| indicates that no incognito window had been opened
90 // during the profile collection period. 101 // during the profile collection period.
91 // |trigger_event| is the cause of the perf data collection. 102 // |trigger_event| is the cause of the perf data collection.
92 void ParseProtoIfValid( 103 void ParseProtoIfValid(
93 scoped_ptr<WindowedIncognitoObserver> incognito_observer, 104 scoped_ptr<WindowedIncognitoObserver> incognito_observer,
94 scoped_ptr<SampledProfile> sampled_profile, 105 scoped_ptr<SampledProfile> sampled_profile,
95 const std::vector<uint8>& data); 106 const std::vector<uint8>& data);
96 107
97 // Vector of SampledProfile protobufs containing perf profiles. 108 // Vector of SampledProfile protobufs containing perf profiles.
98 std::vector<SampledProfile> cached_perf_data_; 109 std::vector<SampledProfile> cached_perf_data_;
99 110
100 // For scheduling collection of perf data. 111 // Timers for scheduling collection of perf data.
101 base::OneShotTimer<PerfProvider> timer_; 112
113 // Timer for interval-based collection.
114 base::OneShotTimer<PerfProvider> interval_timer_;
115 // Timer for collection on resume from suspend.
116 base::OneShotTimer<PerfProvider> resume_timer_;
117 // Timer for collection on restore session.
118 base::OneShotTimer<PerfProvider> restore_session_timer_;
102 119
103 // For detecting when changes to the login state. 120 // For detecting when changes to the login state.
104 LoginObserver login_observer_; 121 LoginObserver login_observer_;
105 122
106 // Record of the last login time. 123 // Record of the last login time.
107 base::TimeTicks login_time_; 124 base::TimeTicks login_time_;
108 125
109 // Record of the start of the upcoming profiling interval. 126 // Record of the start of the upcoming profiling interval.
110 base::TimeTicks next_profiling_interval_start_; 127 base::TimeTicks next_profiling_interval_start_;
111 128
112 // Used to register objects of this class as observers to be notified of 129 // Used to register objects of this class as observers to be notified of
113 // session restore events. 130 // session restore events.
114 content::NotificationRegistrar session_restore_registrar_; 131 content::NotificationRegistrar session_restore_registrar_;
115 132
116 // Tracks the last time a session restore was collected. 133 // Tracks the last time a session restore was collected.
117 base::TimeTicks last_session_restore_collection_time_; 134 base::TimeTicks last_session_restore_collection_time_;
118 135
119 // To pass around the "this" pointer across threads safely. 136 // To pass around the "this" pointer across threads safely.
120 base::WeakPtrFactory<PerfProvider> weak_factory_; 137 base::WeakPtrFactory<PerfProvider> weak_factory_;
121 138
122 DISALLOW_COPY_AND_ASSIGN(PerfProvider); 139 DISALLOW_COPY_AND_ASSIGN(PerfProvider);
123 }; 140 };
124 141
125 } // namespace metrics 142 } // namespace metrics
126 143
127 #endif // CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ 144 #endif // CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/perf_provider_chromeos.cc » ('j') | chrome/browser/metrics/perf_provider_chromeos.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698