summaryrefslogtreecommitdiffstats
path: root/net/http/http_auth_handler.cc
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 10:23:38 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 10:23:38 +0000
commitcb2825c8499998dfbb015eeead451c1a13886efc (patch)
treedda2a4f643a639af9f53956a1977e287339741cc /net/http/http_auth_handler.cc
parent8c59a5d3bb7d8b49e6487558dc0d4cfeac7d8a98 (diff)
downloadchromium_src-cb2825c8499998dfbb015eeead451c1a13886efc.zip
chromium_src-cb2825c8499998dfbb015eeead451c1a13886efc.tar.gz
chromium_src-cb2825c8499998dfbb015eeead451c1a13886efc.tar.bz2
Add histograms for HTTP authentication token generation times.
BUG=None TEST=None Review URL: http://codereview.chromium.org/2838018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51357 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth_handler.cc')
-rw-r--r--net/http/http_auth_handler.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/net/http/http_auth_handler.cc b/net/http/http_auth_handler.cc
index a1e6c39..207232b 100644
--- a/net/http/http_auth_handler.cc
+++ b/net/http/http_auth_handler.cc
@@ -4,7 +4,9 @@
#include "net/http/http_auth_handler.h"
+#include "base/histogram.h"
#include "base/logging.h"
+#include "base/string_util.h"
#include "net/base/net_errors.h"
namespace net {
@@ -19,6 +21,15 @@ HttpAuthHandler::HttpAuthHandler()
this, &HttpAuthHandler::OnGenerateAuthTokenComplete)) {
}
+HttpAuthHandler::~HttpAuthHandler() {
+}
+
+//static
+std::string HttpAuthHandler::GenerateHistogramNameFromScheme(
+ const std::string& scheme) {
+ return StringPrintf("Net.AuthGenerateToken_%s", scheme.c_str());
+}
+
bool HttpAuthHandler::InitFromChallenge(
HttpAuth::ChallengeTokenizer* challenge,
HttpAuth::Target target,
@@ -39,6 +50,13 @@ bool HttpAuthHandler::InitFromChallenge(
DCHECK(!ok || score_ != -1);
DCHECK(!ok || properties_ != -1);
+ if (ok)
+ histogram_ = Histogram::FactoryTimeGet(
+ GenerateHistogramNameFromScheme(scheme()),
+ base::TimeDelta::FromMilliseconds(1),
+ base::TimeDelta::FromSeconds(10), 50,
+ Histogram::kUmaTargetedHistogramFlag);
+
return ok;
}
@@ -69,8 +87,10 @@ int HttpAuthHandler::GenerateAuthToken(const std::wstring* username,
DCHECK(username != NULL || AllowsDefaultCredentials());
DCHECK(auth_token != NULL);
DCHECK(original_callback_ == NULL);
+ DCHECK(histogram_.get());
original_callback_ = callback;
net_log_.BeginEvent(EventTypeFromAuthTarget(target_), NULL);
+ generate_auth_token_start_ = base::TimeTicks::Now();
int rv = GenerateAuthTokenImpl(username, password, request,
&wrapper_callback_, auth_token);
if (rv != ERR_IO_PENDING)
@@ -86,6 +106,11 @@ void HttpAuthHandler::OnGenerateAuthTokenComplete(int rv) {
}
void HttpAuthHandler::FinishGenerateAuthToken() {
+ // TOOD(cbentzel): Should this be done in OK case only?
+ DCHECK(histogram_.get());
+ base::TimeDelta generate_auth_token_duration =
+ base::TimeTicks::Now() - generate_auth_token_start_;
+ histogram_->AddTime(generate_auth_token_duration);
net_log_.EndEvent(EventTypeFromAuthTarget(target_), NULL);
original_callback_ = NULL;
}