Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(900)

Unified Diff: net/base/network_change_notifier.cc

Issue 253203002: Log operator code histogram on new metric log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@api_move
Patch Set: . Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/network_change_notifier.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_change_notifier.cc
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc
index 11f9d363bac678a8329d41c5166b6914a14a619b..aef83563ffc08fb44f03a696efb9232cab9e59bb 100644
--- a/net/base/network_change_notifier.cc
+++ b/net/base/network_change_notifier.cc
@@ -235,22 +235,7 @@ class HistogramWatcher
UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineChange", state_duration);
}
-#if defined(OS_ANDROID)
- // On a connection type change to 2/3/4G, log the network operator MCC/MNC.
- // Log zero in other cases.
- unsigned mcc_mnc = 0;
- if (type == NetworkChangeNotifier::CONNECTION_2G ||
- type == NetworkChangeNotifier::CONNECTION_3G ||
- type == NetworkChangeNotifier::CONNECTION_4G) {
- // Log zero if not perfectly converted.
- if (!base::StringToUint(
- net::android::GetTelephonyNetworkOperator(), &mcc_mnc)) {
- mcc_mnc = 0;
- }
- }
- UMA_HISTOGRAM_SPARSE_SLOWLY(
- "NCN.NetworkOperatorMCCMNC_ConnectionChange", mcc_mnc);
-#endif
+ NetworkChangeNotifier::LogOperatorCodeHistogram(type);
UMA_HISTOGRAM_MEDIUM_TIMES(
"NCN.IPAddressChangeToConnectionTypeChange",
@@ -594,6 +579,25 @@ void NetworkChangeNotifier::ShutdownHistogramWatcher() {
g_network_change_notifier->histogram_watcher_.reset();
}
+// static
+void NetworkChangeNotifier::LogOperatorCodeHistogram(ConnectionType type) {
+#if defined(OS_ANDROID)
+ // On a connection type change to 2/3/4G, log the network operator MCC/MNC.
+ // Log zero in other cases.
+ unsigned mcc_mnc = 0;
+ if (type == NetworkChangeNotifier::CONNECTION_2G ||
+ type == NetworkChangeNotifier::CONNECTION_3G ||
+ type == NetworkChangeNotifier::CONNECTION_4G) {
+ // Log zero if not perfectly converted.
+ if (!base::StringToUint(
+ net::android::GetTelephonyNetworkOperator(), &mcc_mnc)) {
+ mcc_mnc = 0;
+ }
+ }
+ UMA_HISTOGRAM_SPARSE_SLOWLY("NCN.NetworkOperatorMCCMNC", mcc_mnc);
+#endif
+}
+
#if defined(OS_LINUX)
// static
const internal::AddressTrackerLinux*
« no previous file with comments | « net/base/network_change_notifier.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698