OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/chromeos/boot_times_loader.h" | 5 #include "chrome/browser/chromeos/boot_times_loader.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 const std::string uma_prefix, | 252 const std::string uma_prefix, |
253 const std::vector<TimeMarker> login_times) { | 253 const std::vector<TimeMarker> login_times) { |
254 const int kMinTimeMillis = 1; | 254 const int kMinTimeMillis = 1; |
255 const int kMaxTimeMillis = 30000; | 255 const int kMaxTimeMillis = 30000; |
256 const int kNumBuckets = 100; | 256 const int kNumBuckets = 100; |
257 const FilePath log_path(kLogPath); | 257 const FilePath log_path(kLogPath); |
258 | 258 |
259 base::Time first = login_times.front().time(); | 259 base::Time first = login_times.front().time(); |
260 base::Time last = login_times.back().time(); | 260 base::Time last = login_times.back().time(); |
261 base::TimeDelta total = last - first; | 261 base::TimeDelta total = last - first; |
262 scoped_refptr<base::Histogram>total_hist = base::Histogram::FactoryTimeGet( | 262 base::Histogram* total_hist = base::Histogram::FactoryTimeGet( |
263 uma_name, | 263 uma_name, |
264 base::TimeDelta::FromMilliseconds(kMinTimeMillis), | 264 base::TimeDelta::FromMilliseconds(kMinTimeMillis), |
265 base::TimeDelta::FromMilliseconds(kMaxTimeMillis), | 265 base::TimeDelta::FromMilliseconds(kMaxTimeMillis), |
266 kNumBuckets, | 266 kNumBuckets, |
267 base::Histogram::kUmaTargetedHistogramFlag); | 267 base::Histogram::kUmaTargetedHistogramFlag); |
268 total_hist->AddTime(total); | 268 total_hist->AddTime(total); |
269 std::string output = | 269 std::string output = |
270 base::StringPrintf("%s: %.2f", uma_name.c_str(), total.InSecondsF()); | 270 base::StringPrintf("%s: %.2f", uma_name.c_str(), total.InSecondsF()); |
271 base::Time prev = first; | 271 base::Time prev = first; |
272 for (unsigned int i = 0; i < login_times.size(); ++i) { | 272 for (unsigned int i = 0; i < login_times.size(); ++i) { |
273 TimeMarker tm = login_times[i]; | 273 TimeMarker tm = login_times[i]; |
274 base::TimeDelta since_first = tm.time() - first; | 274 base::TimeDelta since_first = tm.time() - first; |
275 base::TimeDelta since_prev = tm.time() - prev; | 275 base::TimeDelta since_prev = tm.time() - prev; |
276 std::string name; | 276 std::string name; |
277 | 277 |
278 if (tm.send_to_uma()) { | 278 if (tm.send_to_uma()) { |
279 name = uma_prefix + tm.name(); | 279 name = uma_prefix + tm.name(); |
280 scoped_refptr<base::Histogram>prev_hist = base::Histogram::FactoryTimeGet( | 280 base::Histogram* prev_hist = base::Histogram::FactoryTimeGet( |
281 name, | 281 name, |
282 base::TimeDelta::FromMilliseconds(kMinTimeMillis), | 282 base::TimeDelta::FromMilliseconds(kMinTimeMillis), |
283 base::TimeDelta::FromMilliseconds(kMaxTimeMillis), | 283 base::TimeDelta::FromMilliseconds(kMaxTimeMillis), |
284 kNumBuckets, | 284 kNumBuckets, |
285 base::Histogram::kUmaTargetedHistogramFlag); | 285 base::Histogram::kUmaTargetedHistogramFlag); |
286 prev_hist->AddTime(since_prev); | 286 prev_hist->AddTime(since_prev); |
287 } else { | 287 } else { |
288 name = tm.name(); | 288 name = tm.name(); |
289 } | 289 } |
290 output += | 290 output += |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 login_time_markers_), | 395 login_time_markers_), |
396 kLoginTimeWriteDelayMs); | 396 kLoginTimeWriteDelayMs); |
397 have_registered_ = false; | 397 have_registered_ = false; |
398 } else { | 398 } else { |
399 AddLoginTimeMarker("LoginRenderNoNetwork", false); | 399 AddLoginTimeMarker("LoginRenderNoNetwork", false); |
400 } | 400 } |
401 } | 401 } |
402 } | 402 } |
403 | 403 |
404 } // namespace chromeos | 404 } // namespace chromeos |
OLD | NEW |