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