summaryrefslogtreecommitdiffstats
path: root/net/dns
diff options
context:
space:
mode:
authorszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-23 18:01:37 +0000
committerszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-23 18:01:37 +0000
commite3bd4827cd54ff3d9c54ba14256e031c785c7ca8 (patch)
tree5b05d415e16b50ee25b0ccb85e9f6bc1bbc1d697 /net/dns
parentb80d045effbe609c2bfde6b2c66a2d5ac78cd0b6 (diff)
downloadchromium_src-e3bd4827cd54ff3d9c54ba14256e031c785c7ca8.zip
chromium_src-e3bd4827cd54ff3d9c54ba14256e031c785c7ca8.tar.gz
chromium_src-e3bd4827cd54ff3d9c54ba14256e031c785c7ca8.tar.bz2
[net/dns] Add histograms for duration of DnsTask, fallback to ProcTask and DnsUDPAttempt.
The current histograms of AsyncDNS.TransactionSuccess and DNS.ResolveSuccess are not directly comparable. AsyncDNS.FallbackSuccess can be used to discount the results in DNS.ResolveSuccess used for fallback after failing DnsTask. BUG= Review URL: https://chromiumcodereview.appspot.com/11017037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163599 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/dns')
-rw-r--r--net/dns/dns_transaction.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc
index 622680d..091cab6 100644
--- a/net/dns/dns_transaction.cc
+++ b/net/dns/dns_transaction.cc
@@ -14,6 +14,7 @@
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
+#include "base/metrics/histogram.h"
#include "base/rand_util.h"
#include "base/stl_util.h"
#include "base/string_piece.h"
@@ -37,6 +38,11 @@ namespace net {
namespace {
+// Provide a common macro to simplify code and readability. We must use a
+// macro as the underlying HISTOGRAM macro creates static variables.
+#define DNS_HISTOGRAM(name, time) UMA_HISTOGRAM_CUSTOM_TIMES(name, time, \
+ base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromHours(1), 100)
+
// Count labels in the fully-qualified name in DNS format.
int CountLabels(const std::string& name) {
size_t count = 0;
@@ -86,6 +92,7 @@ class DnsUDPAttempt {
DCHECK_NE(ERR_IO_PENDING, rv);
if (rv < 0)
return rv;
+ start_time_ = base::TimeTicks::Now();
next_state_ = STATE_SEND_QUERY;
return DoLoop(OK);
}
@@ -155,6 +162,13 @@ class DnsUDPAttempt {
// indicate to the transaction that the server might be misbehaving.
if (rv == ERR_IO_PENDING && received_malformed_response_)
return ERR_DNS_MALFORMED_RESPONSE;
+ if (rv == OK) {
+ DNS_HISTOGRAM("AsyncDNS.UDPAttemptSuccess",
+ base::TimeTicks::Now() - start_time_);
+ } else if (rv != ERR_IO_PENDING) {
+ DNS_HISTOGRAM("AsyncDNS.UDPAttemptFail",
+ base::TimeTicks::Now() - start_time_);
+ }
return rv;
}
@@ -224,6 +238,7 @@ class DnsUDPAttempt {
State next_state_;
bool received_malformed_response_;
+ base::TimeTicks start_time_;
scoped_ptr<DatagramClientSocket> socket_;
IPEndPoint server_;