| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const content::NotificationSource& source, | 68 const content::NotificationSource& source, |
| 69 const content::NotificationDetails& details) OVERRIDE; | 69 const content::NotificationDetails& details) OVERRIDE; |
| 70 | 70 |
| 71 // Turns off perf collection. Does not delete any data that was already | 71 // Turns off perf collection. Does not delete any data that was already |
| 72 // collected and stored in |cached_perf_data_|. | 72 // collected and stored in |cached_perf_data_|. |
| 73 void Deactivate(); | 73 void Deactivate(); |
| 74 | 74 |
| 75 // Selects a random time in the upcoming profiling interval that begins at | 75 // Selects a random time in the upcoming profiling interval that begins at |
| 76 // |next_profiling_interval_start_|. Schedules |timer_| to invoke | 76 // |next_profiling_interval_start_|. Schedules |timer_| to invoke |
| 77 // DoPeriodicCollection() when that time comes. | 77 // DoPeriodicCollection() when that time comes. |
| 78 void ScheduleCollection(); | 78 void ScheduleIntervalCollection(); |
| 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. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 118 | 129 |
| 119 // To pass around the "this" pointer across threads safely. | 130 // To pass around the "this" pointer across threads safely. |
| 120 base::WeakPtrFactory<PerfProvider> weak_factory_; | 131 base::WeakPtrFactory<PerfProvider> weak_factory_; |
| 121 | 132 |
| 122 DISALLOW_COPY_AND_ASSIGN(PerfProvider); | 133 DISALLOW_COPY_AND_ASSIGN(PerfProvider); |
| 123 }; | 134 }; |
| 124 | 135 |
| 125 } // namespace metrics | 136 } // namespace metrics |
| 126 | 137 |
| 127 #endif // CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ | 138 #endif // CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ |
| OLD | NEW |