OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/data_usage/external_data_use_observer.h" | 5 #include "chrome/browser/android/data_usage/external_data_use_observer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 DCHECK(thread_checker_.CalledOnValidThread()); | 198 DCHECK(thread_checker_.CalledOnValidThread()); |
199 DCHECK(!last_data_report_submitted_ticks_.is_null()); | 199 DCHECK(!last_data_report_submitted_ticks_.is_null()); |
200 | 200 |
201 if (success) { | 201 if (success) { |
202 RecordDataUsageReportSubmission(DATAUSAGE_REPORT_SUBMISSION_SUCCESSFUL, | 202 RecordDataUsageReportSubmission(DATAUSAGE_REPORT_SUBMISSION_SUCCESSFUL, |
203 pending_report_bytes_); | 203 pending_report_bytes_); |
204 } else { | 204 } else { |
205 RecordDataUsageReportSubmission(DATAUSAGE_REPORT_SUBMISSION_FAILED, | 205 RecordDataUsageReportSubmission(DATAUSAGE_REPORT_SUBMISSION_FAILED, |
206 pending_report_bytes_); | 206 pending_report_bytes_); |
207 } | 207 } |
208 UMA_HISTOGRAM_TIMES( | |
Raj
2016/01/13 23:33:51
Here again, the duration includes 2 thread hops.
S
tbansal1
2016/01/14 06:59:55
Delay due to thread hop can sometimes be large. I
| |
209 "DataUsage.Perf.ReportSubmissionDuration", | |
210 base::TimeTicks::Now() - last_data_report_submitted_ticks_); | |
208 | 211 |
209 last_data_report_submitted_ticks_ = base::TimeTicks(); | 212 last_data_report_submitted_ticks_ = base::TimeTicks(); |
210 pending_report_bytes_ = 0; | 213 pending_report_bytes_ = 0; |
211 | 214 |
212 SubmitBufferedDataUseReport(false); | 215 SubmitBufferedDataUseReport(false); |
213 } | 216 } |
214 | 217 |
218 void ExternalDataUseObserver::OnFetchMatchingRulesDone() const { | |
219 DCHECK(thread_checker_.CalledOnValidThread()); | |
220 DCHECK(!last_matching_rules_fetch_time_.is_null()); | |
221 UMA_HISTOGRAM_TIMES("DataUsage.Perf.MatchingRuleFetchDuration", | |
222 base::TimeTicks::Now() - last_matching_rules_fetch_time_); | |
223 } | |
224 | |
215 #if defined(OS_ANDROID) | 225 #if defined(OS_ANDROID) |
216 void ExternalDataUseObserver::OnApplicationStateChange( | 226 void ExternalDataUseObserver::OnApplicationStateChange( |
217 base::android::ApplicationState new_state) { | 227 base::android::ApplicationState new_state) { |
218 DCHECK(thread_checker_.CalledOnValidThread()); | 228 DCHECK(thread_checker_.CalledOnValidThread()); |
219 if (new_state == base::android::APPLICATION_STATE_HAS_PAUSED_ACTIVITIES) | 229 if (new_state == base::android::APPLICATION_STATE_HAS_PAUSED_ACTIVITIES) |
220 SubmitBufferedDataUseReport(true); | 230 SubmitBufferedDataUseReport(true); |
221 } | 231 } |
222 #endif | 232 #endif |
223 | 233 |
224 void ExternalDataUseObserver::OnDataUse(const data_usage::DataUse& data_use) { | 234 void ExternalDataUseObserver::OnDataUse(const data_usage::DataUse& data_use) { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
438 size_t hash = 1; | 448 size_t hash = 1; |
439 hash = hash * 23 + hash_function(k.label); | 449 hash = hash * 23 + hash_function(k.label); |
440 hash = hash * 43 + k.connection_type; | 450 hash = hash * 43 + k.connection_type; |
441 hash = hash * 83 + hash_function(k.mcc_mnc); | 451 hash = hash * 83 + hash_function(k.mcc_mnc); |
442 return hash; | 452 return hash; |
443 } | 453 } |
444 | 454 |
445 } // namespace android | 455 } // namespace android |
446 | 456 |
447 } // namespace chrome | 457 } // namespace chrome |
OLD | NEW |