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

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

Issue 11783076: [net/dns] Add per-address-family histograms AsyncDNS.ResolveSuccess_FAMILY_* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add TransactionSuccess_* histograms Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/host_resolver_impl.h" 5 #include "net/base/host_resolver_impl.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <Winsock2.h> 8 #include <Winsock2.h>
9 #elif defined(OS_POSIX) 9 #elif defined(OS_POSIX)
10 #include <netdb.h> 10 #include <netdb.h>
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 return transaction_->Start(); 1009 return transaction_->Start();
1010 } 1010 }
1011 1011
1012 private: 1012 private:
1013 void OnTransactionComplete(bool first_query, 1013 void OnTransactionComplete(bool first_query,
1014 const base::TimeTicks& start_time, 1014 const base::TimeTicks& start_time,
1015 DnsTransaction* transaction, 1015 DnsTransaction* transaction,
1016 int net_error, 1016 int net_error,
1017 const DnsResponse* response) { 1017 const DnsResponse* response) {
1018 DCHECK(transaction); 1018 DCHECK(transaction);
1019 base::TimeDelta duration = base::TimeTicks::Now() - start_time;
1019 // Run |callback_| last since the owning Job will then delete this DnsTask. 1020 // Run |callback_| last since the owning Job will then delete this DnsTask.
1020 if (net_error != OK) { 1021 if (net_error != OK) {
1021 DNS_HISTOGRAM("AsyncDNS.TransactionFailure", 1022 DNS_HISTOGRAM("AsyncDNS.TransactionFailure", duration);
1022 base::TimeTicks::Now() - start_time);
1023 OnFailure(net_error, DnsResponse::DNS_PARSE_OK); 1023 OnFailure(net_error, DnsResponse::DNS_PARSE_OK);
1024 return; 1024 return;
1025 } 1025 }
1026 1026
1027 CHECK(response); 1027 CHECK(response);
1028 DNS_HISTOGRAM("AsyncDNS.TransactionSuccess", 1028 DNS_HISTOGRAM("AsyncDNS.TransactionSuccess", duration);
1029 base::TimeTicks::Now() - start_time); 1029 switch (transaction->GetType()) {
1030 case dns_protocol::kTypeA:
1031 DNS_HISTOGRAM("AsyncDNS.TransactionSuccess_A", duration);
1032 break;
1033 case dns_protocol::kTypeAAAA:
1034 DNS_HISTOGRAM("AsyncDNS.TransactionSuccess_AAAA", duration);
1035 break;
1036 }
1030 AddressList addr_list; 1037 AddressList addr_list;
1031 base::TimeDelta ttl; 1038 base::TimeDelta ttl;
1032 DnsResponse::Result result = response->ParseToAddressList(&addr_list, &ttl); 1039 DnsResponse::Result result = response->ParseToAddressList(&addr_list, &ttl);
1033 UMA_HISTOGRAM_ENUMERATION("AsyncDNS.ParseToAddressList", 1040 UMA_HISTOGRAM_ENUMERATION("AsyncDNS.ParseToAddressList",
1034 result, 1041 result,
1035 DnsResponse::DNS_PARSE_RESULT_MAX); 1042 DnsResponse::DNS_PARSE_RESULT_MAX);
1036 if (result != DnsResponse::DNS_PARSE_OK) { 1043 if (result != DnsResponse::DNS_PARSE_OK) {
1037 // Fail even if the other query succeeds. 1044 // Fail even if the other query succeeds.
1038 OnFailure(ERR_DNS_MALFORMED_RESPONSE, result); 1045 OnFailure(ERR_DNS_MALFORMED_RESPONSE, result);
1039 return; 1046 return;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 1470
1464 // TODO(szym): Run ServeFromHosts now if nsswitch.conf says so. 1471 // TODO(szym): Run ServeFromHosts now if nsswitch.conf says so.
1465 // http://crbug.com/117655 1472 // http://crbug.com/117655
1466 1473
1467 // TODO(szym): Some net errors indicate lack of connectivity. Starting 1474 // TODO(szym): Some net errors indicate lack of connectivity. Starting
1468 // ProcTask in that case is a waste of time. 1475 // ProcTask in that case is a waste of time.
1469 StartProcTask(); 1476 StartProcTask();
1470 return; 1477 return;
1471 } 1478 }
1472 DNS_HISTOGRAM("AsyncDNS.ResolveSuccess", duration); 1479 DNS_HISTOGRAM("AsyncDNS.ResolveSuccess", duration);
1480 // Log DNS lookups based on |address_family|.
1481 switch(key_.address_family) {
1482 case ADDRESS_FAMILY_IPV4:
1483 DNS_HISTOGRAM("AsyncDNS.ResolveSuccess_FAMILY_IPV4", duration);
1484 break;
1485 case ADDRESS_FAMILY_IPV6:
1486 DNS_HISTOGRAM("AsyncDNS.ResolveSuccess_FAMILY_IPV6", duration);
1487 break;
1488 case ADDRESS_FAMILY_UNSPECIFIED:
1489 DNS_HISTOGRAM("AsyncDNS.ResolveSuccess_FAMILY_UNSPEC", duration);
1490 break;
1491 }
1473 1492
1474 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_DNS_SUCCESS); 1493 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_DNS_SUCCESS);
1475 RecordTTL(ttl); 1494 RecordTTL(ttl);
1476 1495
1477 resolver_->OnDnsTaskResolve(OK); 1496 resolver_->OnDnsTaskResolve(OK);
1478 1497
1479 base::TimeDelta bounded_ttl = 1498 base::TimeDelta bounded_ttl =
1480 std::max(ttl, base::TimeDelta::FromSeconds(kMinimumTTLSeconds)); 1499 std::max(ttl, base::TimeDelta::FromSeconds(kMinimumTTLSeconds));
1481 1500
1482 CompleteRequests( 1501 CompleteRequests(
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 } 2148 }
2130 DnsConfig dns_config; 2149 DnsConfig dns_config;
2131 NetworkChangeNotifier::GetDnsConfig(&dns_config); 2150 NetworkChangeNotifier::GetDnsConfig(&dns_config);
2132 dns_client_->SetConfig(dns_config); 2151 dns_client_->SetConfig(dns_config);
2133 num_dns_failures_ = 0; 2152 num_dns_failures_ = 0;
2134 if (dns_config.IsValid()) 2153 if (dns_config.IsValid())
2135 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); 2154 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true);
2136 } 2155 }
2137 2156
2138 } // namespace net 2157 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698