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

Side by Side Diff: net/base/network_change_notifier.cc

Issue 246553003: Record Mobile Operator ID in UMA report. This is Android only for now. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@operator_id
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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/base/network_change_notifier.h" 5 #include "net/base/network_change_notifier.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/metrics/sparse_histogram.h"
8 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
9 #include "base/threading/thread_checker.h" 10 #include "base/threading/thread_checker.h"
10 #include "build/build_config.h" 11 #include "build/build_config.h"
11 #include "net/base/net_util.h" 12 #include "net/base/net_util.h"
12 #include "net/base/network_change_notifier_factory.h" 13 #include "net/base/network_change_notifier_factory.h"
13 #include "net/dns/dns_config_service.h" 14 #include "net/dns/dns_config_service.h"
14 #include "net/url_request/url_request.h" 15 #include "net/url_request/url_request.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
18 #if defined(OS_ANDROID)
19 #include "net/android/network_library.h"
20 #endif
21
17 #if defined(OS_WIN) 22 #if defined(OS_WIN)
18 #include "net/base/network_change_notifier_win.h" 23 #include "net/base/network_change_notifier_win.h"
19 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) 24 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
20 #include "net/base/network_change_notifier_linux.h" 25 #include "net/base/network_change_notifier_linux.h"
21 #elif defined(OS_MACOSX) 26 #elif defined(OS_MACOSX)
22 #include "net/base/network_change_notifier_mac.h" 27 #include "net/base/network_change_notifier_mac.h"
23 #endif 28 #endif
24 29
25 namespace net { 30 namespace net {
26 31
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 base::TimeDelta::FromSeconds(5)) { 223 base::TimeDelta::FromSeconds(5)) {
219 // We can compare this sum with the sum of NCN.OfflineDataRecv. 224 // We can compare this sum with the sum of NCN.OfflineDataRecv.
220 UMA_HISTOGRAM_COUNTS_10000( 225 UMA_HISTOGRAM_COUNTS_10000(
221 "NCN.OfflineDataRecvAny5sBeforeOnline", 226 "NCN.OfflineDataRecvAny5sBeforeOnline",
222 offline_packets_received_); 227 offline_packets_received_);
223 } 228 }
224 229
225 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineDataRecvUntilOnline", 230 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineDataRecvUntilOnline",
226 now - last_offline_packet_received_); 231 now - last_offline_packet_received_);
227 } 232 }
233
234 #if defined(OS_ANDROID)
235 if (type == NetworkChangeNotifier::CONNECTION_2G ||
236 type == NetworkChangeNotifier::CONNECTION_3G ||
237 type == NetworkChangeNotifier::CONNECTION_4G) {
238 std::string mcc_mnc = android::GetTelephonyNetworkOperator();
239 if (!mcc_mnc.empty()) {
240 int value = atoi(mcc_mnc.c_str());
Alexei Svitkine (slow) 2014/04/29 16:35:44 Nit: Use StringToUint() from base/strings/string_n
bolian 2014/04/29 17:36:44 Done.
241 if (value > 0) {
242 UMA_HISTOGRAM_SPARSE_SLOWLY(
243 "NCN.NetworkOperatorMCCMNC_ConnectionChange", value);
244 }
245 }
246 }
247 #endif
248
228 } else { 249 } else {
229 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineChange", state_duration); 250 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineChange", state_duration);
230 } 251 }
231 UMA_HISTOGRAM_MEDIUM_TIMES( 252 UMA_HISTOGRAM_MEDIUM_TIMES(
232 "NCN.IPAddressChangeToConnectionTypeChange", 253 "NCN.IPAddressChangeToConnectionTypeChange",
233 now - last_ip_address_change_); 254 now - last_ip_address_change_);
234 255
235 offline_packets_received_ = 0; 256 offline_packets_received_ = 0;
236 bytes_read_since_last_connection_change_ = 0; 257 bytes_read_since_last_connection_change_ = 0;
237 peak_kbps_since_last_connection_change_ = 0; 258 peak_kbps_since_last_connection_change_ = 0;
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 DCHECK(g_network_change_notifier); 763 DCHECK(g_network_change_notifier);
743 g_network_change_notifier = NULL; 764 g_network_change_notifier = NULL;
744 } 765 }
745 766
746 NetworkChangeNotifier::DisableForTest::~DisableForTest() { 767 NetworkChangeNotifier::DisableForTest::~DisableForTest() {
747 DCHECK(!g_network_change_notifier); 768 DCHECK(!g_network_change_notifier);
748 g_network_change_notifier = network_change_notifier_; 769 g_network_change_notifier = network_change_notifier_;
749 } 770 }
750 771
751 } // namespace net 772 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698