OLD | NEW |
---|---|
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 // Called when a suspend finishes. This is either a successful suspend | 54 // Called when a suspend finishes. This is either a successful suspend |
55 // followed by a resume, or a suspend that was canceled. Inherited from | 55 // followed by a resume, or a suspend that was canceled. Inherited from |
56 // PowerManagerClient::Observer. | 56 // PowerManagerClient::Observer. |
57 void SuspendDone(const base::TimeDelta& sleep_duration) override; | 57 void SuspendDone(const base::TimeDelta& sleep_duration) override; |
58 | 58 |
59 // Turns on perf collection. Resets the timer that's used to schedule | 59 // Turns on perf collection. Resets the timer that's used to schedule |
60 // collections. | 60 // collections. |
61 void OnUserLoggedIn(); | 61 void OnUserLoggedIn(); |
62 | 62 |
63 // Called when a session restore has finished. | 63 // Called when a session restore has finished. |
64 void OnSessionRestoreDone(); | 64 void OnSessionRestoreDone(int num_tabs_restored); |
Ilya Sherman
2015/02/04 22:50:53
nit: size_t?
Simon Que
2015/02/05 00:16:01
It's an int32 in the protobuf, so we should just u
| |
65 | 65 |
66 // Turns off perf collection. Does not delete any data that was already | 66 // Turns off perf collection. Does not delete any data that was already |
67 // collected and stored in |cached_perf_data_|. | 67 // collected and stored in |cached_perf_data_|. |
68 void Deactivate(); | 68 void Deactivate(); |
69 | 69 |
70 // Selects a random time in the upcoming profiling interval that begins at | 70 // Selects a random time in the upcoming profiling interval that begins at |
71 // |next_profiling_interval_start_|. Schedules |timer_| to invoke | 71 // |next_profiling_interval_start_|. Schedules |timer_| to invoke |
72 // DoPeriodicCollection() when that time comes. | 72 // DoPeriodicCollection() when that time comes. |
73 void ScheduleIntervalCollection(); | 73 void ScheduleIntervalCollection(); |
74 | 74 |
75 // Collects perf data for a given |trigger_event|. Calls perf via the ChromeOS | 75 // Collects perf data for a given |trigger_event|. Calls perf via the ChromeOS |
76 // debug daemon's dbus interface. | 76 // debug daemon's dbus interface. |
77 void CollectIfNecessary(scoped_ptr<SampledProfile> sampled_profile); | 77 void CollectIfNecessary(scoped_ptr<SampledProfile> sampled_profile); |
78 | 78 |
79 // Collects perf data on a repeating basis by calling CollectIfNecessary() and | 79 // Collects perf data on a repeating basis by calling CollectIfNecessary() and |
80 // reschedules it to be collected again. | 80 // reschedules it to be collected again. |
81 void DoPeriodicCollection(); | 81 void DoPeriodicCollection(); |
82 | 82 |
83 // Collects perf data after a resume. |sleep_duration| is the duration the | 83 // Collects perf data after a resume. |sleep_duration| is the duration the |
84 // system was suspended before resuming. |time_after_resume_ms| is how long | 84 // system was suspended before resuming. |time_after_resume_ms| is how long |
85 // ago the system resumed. | 85 // ago the system resumed. |
86 void CollectPerfDataAfterResume(const base::TimeDelta& sleep_duration, | 86 void CollectPerfDataAfterResume(const base::TimeDelta& sleep_duration, |
87 const base::TimeDelta& time_after_resume); | 87 const base::TimeDelta& time_after_resume); |
88 | 88 |
89 // Collects perf data after a session restore. |time_after_restore| is how | 89 // Collects perf data after a session restore. |time_after_restore| is how |
90 // long ago the session restore started. | 90 // long ago the session restore started. |num_tabs_restored| is the total |
91 // number of tabs being restored. | |
91 void CollectPerfDataAfterSessionRestore( | 92 void CollectPerfDataAfterSessionRestore( |
92 const base::TimeDelta& time_after_restore); | 93 const base::TimeDelta& time_after_restore, |
94 int num_tabs_restored); | |
93 | 95 |
94 // Parses a perf data protobuf from the |data| passed in only if the | 96 // Parses a perf data protobuf from the |data| passed in only if the |
95 // |incognito_observer| indicates that no incognito window had been opened | 97 // |incognito_observer| indicates that no incognito window had been opened |
96 // during the profile collection period. | 98 // during the profile collection period. |
97 // |trigger_event| is the cause of the perf data collection. | 99 // |trigger_event| is the cause of the perf data collection. |
98 void ParseProtoIfValid( | 100 void ParseProtoIfValid( |
99 scoped_ptr<WindowedIncognitoObserver> incognito_observer, | 101 scoped_ptr<WindowedIncognitoObserver> incognito_observer, |
100 scoped_ptr<SampledProfile> sampled_profile, | 102 scoped_ptr<SampledProfile> sampled_profile, |
101 const std::vector<uint8>& data); | 103 const std::vector<uint8>& data); |
102 | 104 |
(...skipping 25 matching lines...) Expand all Loading... | |
128 | 130 |
129 // To pass around the "this" pointer across threads safely. | 131 // To pass around the "this" pointer across threads safely. |
130 base::WeakPtrFactory<PerfProvider> weak_factory_; | 132 base::WeakPtrFactory<PerfProvider> weak_factory_; |
131 | 133 |
132 DISALLOW_COPY_AND_ASSIGN(PerfProvider); | 134 DISALLOW_COPY_AND_ASSIGN(PerfProvider); |
133 }; | 135 }; |
134 | 136 |
135 } // namespace metrics | 137 } // namespace metrics |
136 | 138 |
137 #endif // CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ | 139 #endif // CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ |
OLD | NEW |