summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 23:19:16 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 23:19:16 +0000
commit1302488d6467c0744e0e2dae3a40c68d62a58374 (patch)
treeb3d1136d692fa6c73badab2bafa0405d75f89d6d
parent61b0cc2d099df700ff3e4c46b74a95a09b63c8a7 (diff)
downloadchromium_src-1302488d6467c0744e0e2dae3a40c68d62a58374.zip
chromium_src-1302488d6467c0744e0e2dae3a40c68d62a58374.tar.gz
chromium_src-1302488d6467c0744e0e2dae3a40c68d62a58374.tar.bz2
Added logging of the attempt number whenever we start
Host resolution (DoLookup) and whenever host resolution is completed (OnLookupComplete). BUG=82592 TEST=about:net-internals and click on Events. In HOST_RESOLVER_IMPL_JOB, there would be log entries for attempts (HOST_RESOLVER_IMPL_ATTEMPT_STARTED and HOST_RESOLVER_IMPL_ATTEMPT_FINISHED). R=eroman,mmenke Review URL: http://codereview.chromium.org/7021021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85834 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/base/host_resolver_impl.cc30
-rw-r--r--net/base/net_log_event_type_list.h25
2 files changed, 51 insertions, 4 deletions
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index 371692a..59d1b32 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -134,13 +134,19 @@ static int ResolveAddrInfo(HostResolverProc* resolver_proc,
// Extra parameters to attach to the NetLog when the resolve failed.
class HostResolveFailedParams : public NetLog::EventParameters {
public:
- HostResolveFailedParams(int net_error, int os_error)
- : net_error_(net_error),
+ HostResolveFailedParams(uint32 attempt_number,
+ int net_error,
+ int os_error)
+ : attempt_number_(attempt_number),
+ net_error_(net_error),
os_error_(os_error) {
}
virtual Value* ToValue() const {
DictionaryValue* dict = new DictionaryValue();
+ if (attempt_number_)
+ dict->SetInteger("attempt_number", attempt_number_);
+
dict->SetInteger("net_error", net_error_);
if (os_error_) {
@@ -167,6 +173,7 @@ class HostResolveFailedParams : public NetLog::EventParameters {
}
private:
+ const uint32 attempt_number_;
const int net_error_;
const int os_error_;
};
@@ -433,6 +440,12 @@ class HostResolverImpl::Job
start_time, attempt_number_, ERR_UNEXPECTED, 0));
return;
}
+
+ net_log_.AddEvent(
+ NetLog::TYPE_HOST_RESOLVER_IMPL_ATTEMPT_STARTED,
+ make_scoped_refptr(new NetLogIntegerParameter(
+ "attempt_number", attempt_number_)));
+
// Post a task to check if we get the results within a given time.
// OnCheckForComplete has the potential for starting a new attempt on a
// different worker thread if none of our outstanding attempts have
@@ -565,6 +578,15 @@ class HostResolverImpl::Job
bool was_retry_attempt = attempt_number > 1;
if (!was_cancelled()) {
+ scoped_refptr<NetLog::EventParameters> params;
+ if (error != OK) {
+ params = new HostResolveFailedParams(attempt_number, error, os_error);
+ } else {
+ params = new NetLogIntegerParameter("attempt_number", attempt_number_);
+ }
+ net_log_.AddEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_ATTEMPT_FINISHED,
+ params);
+
// If host is already resolved, then record data and return.
if (was_completed()) {
// If this is the first attempt that is finishing later, then record
@@ -601,7 +623,7 @@ class HostResolverImpl::Job
scoped_refptr<NetLog::EventParameters> params;
if (error != OK) {
- params = new HostResolveFailedParams(error, os_error);
+ params = new HostResolveFailedParams(0, error, os_error);
} else {
params = new AddressListNetLogParam(results_);
}
@@ -1407,7 +1429,7 @@ void HostResolverImpl::OnFinishRequest(const BoundNetLog& source_net_log,
// Log some extra parameters on failure for synchronous requests.
scoped_refptr<NetLog::EventParameters> params;
if (!was_resolved) {
- params = new HostResolveFailedParams(net_error, os_error);
+ params = new HostResolveFailedParams(0, net_error, os_error);
}
request_net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_REQUEST, params);
diff --git a/net/base/net_log_event_type_list.h b/net/base/net_log_event_type_list.h
index 6a8e6b4..7d8817c 100644
--- a/net/base/net_log_event_type_list.h
+++ b/net/base/net_log_event_type_list.h
@@ -70,6 +70,31 @@ EVENT_TYPE(HOST_RESOLVER_IMPL_JOB_POOL_QUEUE_EVICTED)
// for a request.
EVENT_TYPE(HOST_RESOLVER_IMPL_CREATE_JOB)
+// This event is created when HostResolverImpl::Job is about to start a new
+// attempt to resolve the host.
+//
+// The ATTEMPT_STARTED event has the parameters:
+//
+// {
+// "attempt_number": <the number of the attempt that is resolving the host>,
+// }
+EVENT_TYPE(HOST_RESOLVER_IMPL_ATTEMPT_STARTED)
+
+// This event is created when HostResolverImpl::Job has finished resolving the
+// host.
+//
+// The ATTEMPT_FINISHED event has the parameters:
+//
+// {
+// "attempt_number": <the number of the attempt that has resolved the host>,
+// }
+// If an error occurred, the END phase will contain these additional parameters:
+// {
+// "net_error": <The net error code integer for the failure>,
+// "os_error": <The exact error code integer that getaddrinfo() returned>,
+// }
+EVENT_TYPE(HOST_RESOLVER_IMPL_ATTEMPT_FINISHED)
+
// This is logged for a request when it's attached to a
// HostResolverImpl::Job. When this occurs without a preceding
// HOST_RESOLVER_IMPL_CREATE_JOB entry, it means the request was attached to an