summaryrefslogtreecommitdiffstats
path: root/net/socket/client_socket_handle.cc
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-20 20:37:00 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-20 20:37:00 +0000
commitb89f7e4d3f98fffe88bd07a57c735e28c37e692c (patch)
treefb0e304d16190673073e62a44a4ef0103ca48876 /net/socket/client_socket_handle.cc
parentb846407ff810e7cfb21642803bd00ed4d4883dc3 (diff)
downloadchromium_src-b89f7e4d3f98fffe88bd07a57c735e28c37e692c.zip
chromium_src-b89f7e4d3f98fffe88bd07a57c735e28c37e692c.tar.gz
chromium_src-b89f7e4d3f98fffe88bd07a57c735e28c37e692c.tar.bz2
Make ClientSocketPool histograms static so that they work properly.
Also change their names so that they appear all together on the histograms page. BUG=43375 TEST=none Review URL: http://codereview.chromium.org/2029004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47843 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/client_socket_handle.cc')
-rw-r--r--net/socket/client_socket_handle.cc38
1 files changed, 10 insertions, 28 deletions
diff --git a/net/socket/client_socket_handle.cc b/net/socket/client_socket_handle.cc
index 87212b1..5964239 100644
--- a/net/socket/client_socket_handle.cc
+++ b/net/socket/client_socket_handle.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "net/base/net_errors.h"
#include "net/socket/client_socket_pool.h"
+#include "net/socket/client_socket_pool_histograms.h"
namespace net {
@@ -75,40 +76,21 @@ void ClientSocketHandle::HandleInitCompletion(int result) {
}
setup_time_ = base::TimeTicks::Now() - init_time_;
- // TODO(vandebo): bug 43375: The strings passed to HISTOGRAM macros should NOT
- // vary, as the macro snapshots the name into a static. I've temporarilly
- // made this code use statics so that the HISTOGRAM macro will not DCHECK (and
- // this also makes the current semantics a tiny bit more clear).
- static std::string metric = "Net." + pool_->name() + "SocketType";
- UMA_HISTOGRAM_ENUMERATION(metric, reuse_type(), NUM_TYPES);
+ scoped_refptr<ClientSocketPoolHistograms> histograms = pool_->histograms();
+ histograms->AddSocketType(reuse_type());
switch (reuse_type()) {
- case ClientSocketHandle::UNUSED: {
- static std::string metric = "Net." + pool_->name() + "SocketRequestTime";
- UMA_HISTOGRAM_CLIPPED_TIMES(metric, setup_time(),
- base::TimeDelta::FromMilliseconds(1),
- base::TimeDelta::FromMinutes(10), 100);
+ case ClientSocketHandle::UNUSED:
+ histograms->AddRequestTime(setup_time());
break;
- }
- case ClientSocketHandle::UNUSED_IDLE: {
- static std::string metric = "Net." + pool_->name() +
- "SocketIdleTimeBeforeNextUse_UnusedSocket";
- UMA_HISTOGRAM_CUSTOM_TIMES(metric, idle_time(),
- base::TimeDelta::FromMilliseconds(1),
- base::TimeDelta::FromMinutes(6), 100);
+ case ClientSocketHandle::UNUSED_IDLE:
+ histograms->AddUnusedIdleTime(idle_time());
break;
- }
- case ClientSocketHandle::REUSED_IDLE: {
- static std::string metric = "Net." + pool_->name() +
- "SocketIdleTimeBeforeNextUse_ReusedSocket";
- UMA_HISTOGRAM_CUSTOM_TIMES(metric, idle_time(),
- base::TimeDelta::FromMilliseconds(1),
- base::TimeDelta::FromMinutes(6), 100);
+ case ClientSocketHandle::REUSED_IDLE:
+ histograms->AddReusedIdleTime(idle_time());
break;
- }
- default: {
+ default:
NOTREACHED();
break;
- }
}
}