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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 void CastMetricsHelper::LogMediaPause() { | 145 void CastMetricsHelper::LogMediaPause() { |
146 MAKE_SURE_THREAD(LogMediaPause); | 146 MAKE_SURE_THREAD(LogMediaPause); |
147 RecordSimpleAction(EncodeAppInfoIntoMetricsName( | 147 RecordSimpleAction(EncodeAppInfoIntoMetricsName( |
148 "MediaPause", | 148 "MediaPause", |
149 app_id_.empty() ? app_name_ : app_id_, | 149 app_id_.empty() ? app_name_ : app_id_, |
150 session_id_, | 150 session_id_, |
151 sdk_version_)); | 151 sdk_version_)); |
152 } | 152 } |
153 | 153 |
| 154 void CastMetricsHelper::LogTimeToFirstPaint() { |
| 155 MAKE_SURE_THREAD(LogTimeToFirstPaint); |
| 156 base::TimeDelta launch_time = base::TimeTicks::Now() - app_start_time_; |
| 157 const std::string uma_name(GetMetricsNameWithAppName("Startup", |
| 158 "TimeToFirstPaint")); |
| 159 LogMediumTimeHistogramEvent(uma_name, launch_time); |
| 160 LOG(INFO) << uma_name << " is " << launch_time.InSecondsF() << " seconds."; |
| 161 } |
| 162 |
154 void CastMetricsHelper::LogTimeToDisplayVideo() { | 163 void CastMetricsHelper::LogTimeToDisplayVideo() { |
155 if (!new_startup_time_) { // For faster check. | 164 if (!new_startup_time_) { // For faster check. |
156 return; | 165 return; |
157 } | 166 } |
158 MAKE_SURE_THREAD(LogTimeToDisplayVideo); | 167 MAKE_SURE_THREAD(LogTimeToDisplayVideo); |
159 new_startup_time_ = false; | 168 new_startup_time_ = false; |
160 base::TimeDelta launch_time = base::TimeTicks::Now() - app_start_time_; | 169 base::TimeDelta launch_time = base::TimeTicks::Now() - app_start_time_; |
161 const std::string uma_name(GetMetricsNameWithAppName("Startup", | 170 const std::string uma_name(GetMetricsNameWithAppName("Startup", |
162 "TimeToDisplayVideo")); | 171 "TimeToDisplayVideo")); |
163 LogMediumTimeHistogramEvent(uma_name, launch_time); | 172 LogMediumTimeHistogramEvent(uma_name, launch_time); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 const base::TimeDelta& value) { | 319 const base::TimeDelta& value) { |
311 // Follow UMA_HISTOGRAM_MEDIUM_TIMES definition. | 320 // Follow UMA_HISTOGRAM_MEDIUM_TIMES definition. |
312 LogTimeHistogramEvent(name, value, | 321 LogTimeHistogramEvent(name, value, |
313 base::TimeDelta::FromMilliseconds(10), | 322 base::TimeDelta::FromMilliseconds(10), |
314 base::TimeDelta::FromMinutes(3), | 323 base::TimeDelta::FromMinutes(3), |
315 50); | 324 50); |
316 } | 325 } |
317 | 326 |
318 } // namespace metrics | 327 } // namespace metrics |
319 } // namespace chromecast | 328 } // namespace chromecast |
OLD | NEW |