| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/base/metrics/cast_metrics_helper.h" | 5 #include "chromecast/base/metrics/cast_metrics_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 MAKE_SURE_THREAD(LogMediaPause); | 142 MAKE_SURE_THREAD(LogMediaPause); |
| 143 RecordSimpleAction(EncodeAppInfoIntoMetricsName( | 143 RecordSimpleAction(EncodeAppInfoIntoMetricsName( |
| 144 "MediaPause", | 144 "MediaPause", |
| 145 app_id_, | 145 app_id_, |
| 146 session_id_, | 146 session_id_, |
| 147 sdk_version_)); | 147 sdk_version_)); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void CastMetricsHelper::LogTimeToFirstPaint() { | 150 void CastMetricsHelper::LogTimeToFirstPaint() { |
| 151 MAKE_SURE_THREAD(LogTimeToFirstPaint); | 151 MAKE_SURE_THREAD(LogTimeToFirstPaint); |
| 152 if (app_id_.empty()) |
| 153 return; |
| 152 base::TimeDelta launch_time = base::TimeTicks::Now() - app_start_time_; | 154 base::TimeDelta launch_time = base::TimeTicks::Now() - app_start_time_; |
| 153 const std::string uma_name(GetMetricsNameWithAppName("Startup", | 155 const std::string uma_name(GetMetricsNameWithAppName("Startup", |
| 154 "TimeToFirstPaint")); | 156 "TimeToFirstPaint")); |
| 155 LogMediumTimeHistogramEvent(uma_name, launch_time); | 157 LogMediumTimeHistogramEvent(uma_name, launch_time); |
| 156 LOG(INFO) << uma_name << " is " << launch_time.InSecondsF() << " seconds."; | 158 LOG(INFO) << uma_name << " is " << launch_time.InSecondsF() << " seconds."; |
| 157 } | 159 } |
| 158 | 160 |
| 159 void CastMetricsHelper::LogTimeToDisplayVideo() { | 161 void CastMetricsHelper::LogTimeToDisplayVideo() { |
| 160 if (!new_startup_time_) { // For faster check. | 162 if (!new_startup_time_) { // For faster check. |
| 161 return; | 163 return; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 const base::TimeDelta& value) { | 317 const base::TimeDelta& value) { |
| 316 // Follow UMA_HISTOGRAM_MEDIUM_TIMES definition. | 318 // Follow UMA_HISTOGRAM_MEDIUM_TIMES definition. |
| 317 LogTimeHistogramEvent(name, value, | 319 LogTimeHistogramEvent(name, value, |
| 318 base::TimeDelta::FromMilliseconds(10), | 320 base::TimeDelta::FromMilliseconds(10), |
| 319 base::TimeDelta::FromMinutes(3), | 321 base::TimeDelta::FromMinutes(3), |
| 320 50); | 322 50); |
| 321 } | 323 } |
| 322 | 324 |
| 323 } // namespace metrics | 325 } // namespace metrics |
| 324 } // namespace chromecast | 326 } // namespace chromecast |
| OLD | NEW |