Chromium Code Reviews| 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_PERF_PROVIDER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_METRICS_PERF_PERF_PROVIDER_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_METRICS_PERF_PERF_PROVIDER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_METRICS_PERF_PERF_PROVIDER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <type_traits> | 9 #include <type_traits> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 16 #include "chrome/browser/metrics/perf/cpu_identity.h" | |
| 17 #include "chrome/browser/metrics/perf/random_selector.h" | |
| 16 #include "chrome/browser/sessions/session_restore.h" | 18 #include "chrome/browser/sessions/session_restore.h" |
| 17 #include "chromeos/dbus/power_manager_client.h" | 19 #include "chromeos/dbus/power_manager_client.h" |
| 18 #include "chromeos/login/login_state.h" | 20 #include "chromeos/login/login_state.h" |
| 19 #include "components/metrics/proto/sampled_profile.pb.h" | 21 #include "components/metrics/proto/sampled_profile.pb.h" |
| 20 | 22 |
| 21 namespace metrics { | 23 namespace metrics { |
| 22 | 24 |
| 23 class WindowedIncognitoObserver; | 25 class WindowedIncognitoObserver; |
| 24 | 26 |
| 25 // Provides access to ChromeOS perf data. perf aka "perf events" is a | 27 // Provides access to ChromeOS perf data. perf aka "perf events" is a |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 // Collects perf data after a session restore. |time_after_restore| is how | 190 // Collects perf data after a session restore. |time_after_restore| is how |
| 189 // long ago the session restore started. |num_tabs_restored| is the total | 191 // long ago the session restore started. |num_tabs_restored| is the total |
| 190 // number of tabs being restored. | 192 // number of tabs being restored. |
| 191 void CollectPerfDataAfterSessionRestore( | 193 void CollectPerfDataAfterSessionRestore( |
| 192 const base::TimeDelta& time_after_restore, | 194 const base::TimeDelta& time_after_restore, |
| 193 int num_tabs_restored); | 195 int num_tabs_restored); |
| 194 | 196 |
| 195 // Parameters controlling how profiles are collected. | 197 // Parameters controlling how profiles are collected. |
| 196 CollectionParams collection_params_; | 198 CollectionParams collection_params_; |
| 197 | 199 |
| 200 // Set of commands to choose from. | |
| 201 RandomSelector command_selector_; | |
| 202 | |
| 198 // Vector of SampledProfile protobufs containing perf profiles. | 203 // Vector of SampledProfile protobufs containing perf profiles. |
| 199 std::vector<SampledProfile> cached_perf_data_; | 204 std::vector<SampledProfile> cached_perf_data_; |
| 200 | 205 |
| 201 // For scheduling collection of perf data. | 206 // For scheduling collection of perf data. |
| 202 base::OneShotTimer timer_; | 207 base::OneShotTimer timer_; |
| 203 | 208 |
| 204 // For detecting when changes to the login state. | 209 // For detecting when changes to the login state. |
| 205 LoginObserver login_observer_; | 210 LoginObserver login_observer_; |
| 206 | 211 |
| 207 // Record of the last login time. | 212 // Record of the last login time. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 220 // obsolete callbacks. | 225 // obsolete callbacks. |
| 221 SessionRestore::CallbackSubscription | 226 SessionRestore::CallbackSubscription |
| 222 on_session_restored_callback_subscription_; | 227 on_session_restored_callback_subscription_; |
| 223 | 228 |
| 224 // To pass around the "this" pointer across threads safely. | 229 // To pass around the "this" pointer across threads safely. |
| 225 base::WeakPtrFactory<PerfProvider> weak_factory_; | 230 base::WeakPtrFactory<PerfProvider> weak_factory_; |
| 226 | 231 |
| 227 DISALLOW_COPY_AND_ASSIGN(PerfProvider); | 232 DISALLOW_COPY_AND_ASSIGN(PerfProvider); |
| 228 }; | 233 }; |
| 229 | 234 |
| 235 namespace internal { | |
| 236 | |
| 237 // Exposed for unit testing. | |
| 238 | |
| 239 const std::vector<RandomSelector::WeightAndValue> GetDefaultCommandsForCpu( | |
|
Alexei Svitkine (slow)
2015/10/13 17:31:19
Nit: No need for const on the return value
dhsharp
2015/10/13 23:36:22
Done.
| |
| 240 const CPUIdentity& cpuid); | |
| 241 | |
| 242 } // namespace internal | |
| 243 | |
| 230 } // namespace metrics | 244 } // namespace metrics |
| 231 | 245 |
| 232 #endif // CHROME_BROWSER_METRICS_PERF_PERF_PROVIDER_CHROMEOS_H_ | 246 #endif // CHROME_BROWSER_METRICS_PERF_PERF_PROVIDER_CHROMEOS_H_ |
| OLD | NEW |