OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/chrome_browser_metrics_log_observer.h" | |
6 | |
7 #if defined(OS_ANDROID) | |
8 #include "base/metrics/sparse_histogram.h" | |
9 #include "base/strings/string_number_conversions.h" | |
10 #include "net/android/network_library.h" | |
11 #endif | |
12 | |
13 ChromeBrowserMetricsLogObserver::ChromeBrowserMetricsLogObserver() { | |
14 MetricsServiceHelper::AddMetricsLogObserver(this); | |
15 } | |
16 | |
17 ChromeBrowserMetricsLogObserver::~ChromeBrowserMetricsLogObserver() { | |
18 MetricsServiceHelper::RemoveMetricsLogObserver(this); | |
19 } | |
20 | |
21 void ChromeBrowserMetricsLogObserver::OnNewMetricsLog() { | |
22 #if defined(OS_ANDROID) | |
23 net::NetworkChangeNotifier::ConnectionType type = | |
24 net::NetworkChangeNotifier::GetConnectionType(); | |
25 unsigned mcc_mnc = 0; | |
26 if (type == net::NetworkChangeNotifier::CONNECTION_2G || | |
27 type == net::NetworkChangeNotifier::CONNECTION_3G || | |
28 type == net::NetworkChangeNotifier::CONNECTION_4G) { | |
29 // Log zero if not perfectly converted. | |
30 if (!base::StringToUint( | |
31 net::android::GetTelephonyNetworkOperator(), &mcc_mnc)) { | |
32 mcc_mnc = 0; | |
33 } | |
34 } | |
35 UMA_HISTOGRAM_SPARSE_SLOWLY( | |
36 "NCN.NetworkOperatorMCCMNC_NewMetricsLog", mcc_mnc); | |
Ilya Sherman
2014/05/07 01:03:16
Hmm, I was expecting that you'd emit to a single h
bolian
2014/05/07 02:20:26
It is more about the accurate of the name, this on
Ilya Sherman
2014/05/07 23:57:40
Why does it matter which one is first? If there a
bolian
2014/05/08 00:54:51
Mainly, I want to differentiate below two cases:
Ilya Sherman
2014/05/08 01:10:11
If you emit to a single histogram, you're in case
bolian
2014/05/08 01:29:58
hmm, I can do that (and remove the metric to be _C
Ilya Sherman
2014/05/08 03:09:40
The benefit is indeed having fewer histograms to m
bolian
2014/05/08 03:47:18
fair enough. I combined them and rename it by remo
| |
37 #endif | |
38 } | |
OLD | NEW |