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 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 // |trigger_event| is the cause of the perf data collection. | 125 // |trigger_event| is the cause of the perf data collection. |
126 // |result| is the return value of running perf/quipper. It is 0 if successful | 126 // |result| is the return value of running perf/quipper. It is 0 if successful |
127 // and nonzero if not successful. | 127 // and nonzero if not successful. |
128 void ParseOutputProtoIfValid( | 128 void ParseOutputProtoIfValid( |
129 scoped_ptr<WindowedIncognitoObserver> incognito_observer, | 129 scoped_ptr<WindowedIncognitoObserver> incognito_observer, |
130 scoped_ptr<SampledProfile> sampled_profile, | 130 scoped_ptr<SampledProfile> sampled_profile, |
131 int result, | 131 int result, |
132 const std::vector<uint8>& perf_data, | 132 const std::vector<uint8>& perf_data, |
133 const std::vector<uint8>& perf_stat); | 133 const std::vector<uint8>& perf_stat); |
134 | 134 |
135 const CollectionParams& collection_params() { return collection_params_; } | |
Alexei Svitkine (slow)
2015/10/16 15:37:50
Nit: Mark the method const as well. Same below.
dhsharp
2015/10/19 22:45:28
Done.
| |
136 const RandomSelector& command_selector() { return command_selector_; } | |
137 | |
135 private: | 138 private: |
136 static const CollectionParams kDefaultParameters; | 139 static const CollectionParams kDefaultParameters; |
137 | 140 |
138 // Class that listens for changes to the login state. When a normal user logs | 141 // Class that listens for changes to the login state. When a normal user logs |
139 // in, it updates PerfProvider to start collecting data. | 142 // in, it updates PerfProvider to start collecting data. |
140 class LoginObserver : public chromeos::LoginState::Observer { | 143 class LoginObserver : public chromeos::LoginState::Observer { |
141 public: | 144 public: |
142 explicit LoginObserver(PerfProvider* perf_provider); | 145 explicit LoginObserver(PerfProvider* perf_provider); |
143 | 146 |
144 // Called when either the login state or the logged in user type changes. | 147 // Called when either the login state or the logged in user type changes. |
145 // Activates |perf_provider_| to start collecting. | 148 // Activates |perf_provider_| to start collecting. |
146 void LoggedInStateChanged() override; | 149 void LoggedInStateChanged() override; |
147 | 150 |
148 private: | 151 private: |
149 // Points to a PerfProvider instance that can be turned on or off based on | 152 // Points to a PerfProvider instance that can be turned on or off based on |
150 // the login state. | 153 // the login state. |
151 PerfProvider* perf_provider_; | 154 PerfProvider* perf_provider_; |
152 }; | 155 }; |
153 | 156 |
157 // Change the values in |collection_params_| and the commands in | |
158 // |command_selector_| for any keys that are present in |params|. | |
159 void SetCollectionParamsFromVariationParams( | |
160 const std::map<std::string, std::string> ¶ms); | |
Alexei Svitkine (slow)
2015/10/16 15:37:50
Nit: indent 2 more - or maybe just run "git cl for
dhsharp
2015/10/19 22:45:28
Done.
| |
161 | |
154 // Called when a suspend finishes. This is either a successful suspend | 162 // Called when a suspend finishes. This is either a successful suspend |
155 // followed by a resume, or a suspend that was canceled. Inherited from | 163 // followed by a resume, or a suspend that was canceled. Inherited from |
156 // PowerManagerClient::Observer. | 164 // PowerManagerClient::Observer. |
157 void SuspendDone(const base::TimeDelta& sleep_duration) override; | 165 void SuspendDone(const base::TimeDelta& sleep_duration) override; |
158 | 166 |
159 // Turns on perf collection. Resets the timer that's used to schedule | 167 // Turns on perf collection. Resets the timer that's used to schedule |
160 // collections. | 168 // collections. |
161 void OnUserLoggedIn(); | 169 void OnUserLoggedIn(); |
162 | 170 |
163 // Called when a session restore has finished. | 171 // Called when a session restore has finished. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 }; | 240 }; |
233 | 241 |
234 // Exposed for unit testing. | 242 // Exposed for unit testing. |
235 namespace internal { | 243 namespace internal { |
236 | 244 |
237 // Return the default set of perf commands and their odds of selection given | 245 // Return the default set of perf commands and their odds of selection given |
238 // the identity of the CPU in |cpuid|. | 246 // the identity of the CPU in |cpuid|. |
239 std::vector<RandomSelector::WeightAndValue> GetDefaultCommandsForCpu( | 247 std::vector<RandomSelector::WeightAndValue> GetDefaultCommandsForCpu( |
240 const CPUIdentity& cpuid); | 248 const CPUIdentity& cpuid); |
241 | 249 |
250 // For the "PerfCommand::"-prefixed keys in |params|, return the cpu specifier | |
251 // that is the narrowest match for the CPU identified by |cpuid|. | |
252 // Valid CPU specifiers, in increasing order of specificity, are: | |
253 // "default", a system architecture (e.g. "x86_64"), a CPU microarchitecture | |
254 // (currently only Intel uarchs supported), or a CPU model name substring. | |
255 std::string FindBestCpuSpecifierFromParams( | |
256 const std::map<std::string, std::string>& params, | |
257 const CPUIdentity& cpuid); | |
258 | |
242 } // namespace internal | 259 } // namespace internal |
243 | 260 |
244 } // namespace metrics | 261 } // namespace metrics |
245 | 262 |
246 #endif // CHROME_BROWSER_METRICS_PERF_PERF_PROVIDER_CHROMEOS_H_ | 263 #endif // CHROME_BROWSER_METRICS_PERF_PERF_PROVIDER_CHROMEOS_H_ |
OLD | NEW |