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

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: 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_ms| is the duration the
Ilya Sherman 2014/07/03 00:12:48 nit: Perhaps name the variable "suspend_duration",
Simon Que 2014/07/07 19:45:26 Done.
89 // system was suspended before resuming. |time_after_resume_ms| is how long
90 // ago the system resumed.
91 void DoResumeCollection(uint64 sleep_duration_ms,
Ilya Sherman 2014/07/03 00:12:48 nit: Perhaps something more like "CollectPerfDataA
Simon Que 2014/07/07 19:45:26 Done.
92 uint64 time_after_resume_ms);
Ilya Sherman 2014/07/03 00:12:48 Please pass these as TimeDeltas.
Simon Que 2014/07/07 19:45:26 Done.
93
94 // Collects perf data after a session restore. |time_after_restore_ms| is how
95 // long ago the session restore started.
96 void DoRestoreSessionCollection(uint64 time_after_restore_ms);
97
88 // Parses a perf data protobuf from the |data| passed in only if the 98 // Parses a perf data protobuf from the |data| passed in only if the
89 // |incognito_observer| indicates that no incognito window had been opened 99 // |incognito_observer| indicates that no incognito window had been opened
90 // during the profile collection period. 100 // during the profile collection period.
91 // |trigger_event| is the cause of the perf data collection. 101 // |trigger_event| is the cause of the perf data collection.
92 void ParseProtoIfValid( 102 void ParseProtoIfValid(
93 scoped_ptr<WindowedIncognitoObserver> incognito_observer, 103 scoped_ptr<WindowedIncognitoObserver> incognito_observer,
94 scoped_ptr<SampledProfile> sampled_profile, 104 scoped_ptr<SampledProfile> sampled_profile,
95 const std::vector<uint8>& data); 105 const std::vector<uint8>& data);
96 106
97 // Vector of SampledProfile protobufs containing perf profiles. 107 // Vector of SampledProfile protobufs containing perf profiles.
98 std::vector<SampledProfile> cached_perf_data_; 108 std::vector<SampledProfile> cached_perf_data_;
99 109
100 // For scheduling collection of perf data. 110 // Timers for scheduling collection of perf data.
101 base::OneShotTimer<PerfProvider> timer_; 111
112 // Timer for interval-based collection.
113 base::OneShotTimer<PerfProvider> interval_timer_;
114 // Timer for collection on resume from suspend.
115 base::OneShotTimer<PerfProvider> resume_timer_;
116 // Timer for collection on restore session.
117 base::OneShotTimer<PerfProvider> restore_session_timer_;
102 118
103 // For detecting when changes to the login state. 119 // For detecting when changes to the login state.
104 LoginObserver login_observer_; 120 LoginObserver login_observer_;
105 121
106 // Record of the last login time. 122 // Record of the last login time.
107 base::TimeTicks login_time_; 123 base::TimeTicks login_time_;
108 124
109 // Record of the start of the upcoming profiling interval. 125 // Record of the start of the upcoming profiling interval.
110 base::TimeTicks next_profiling_interval_start_; 126 base::TimeTicks next_profiling_interval_start_;
111 127
112 // Used to register objects of this class as observers to be notified of 128 // Used to register objects of this class as observers to be notified of
113 // session restore events. 129 // session restore events.
114 content::NotificationRegistrar session_restore_registrar_; 130 content::NotificationRegistrar session_restore_registrar_;
115 131
116 // Tracks the last time a session restore was collected. 132 // Tracks the last time a session restore was collected.
117 base::TimeTicks last_session_restore_collection_time_; 133 base::TimeTicks last_session_restore_collection_time_;
118 134
119 // To pass around the "this" pointer across threads safely. 135 // To pass around the "this" pointer across threads safely.
120 base::WeakPtrFactory<PerfProvider> weak_factory_; 136 base::WeakPtrFactory<PerfProvider> weak_factory_;
121 137
122 DISALLOW_COPY_AND_ASSIGN(PerfProvider); 138 DISALLOW_COPY_AND_ASSIGN(PerfProvider);
123 }; 139 };
124 140
125 } // namespace metrics 141 } // namespace metrics
126 142
127 #endif // CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ 143 #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