Bug 1024639 - Added telemetry tracking for used, total, and unused telemetry connections. r=hurley

This commit is contained in:
Jeremy Poulin 2014-06-17 13:35:25 -07:00
parent 1250af0c6a
commit 7df04cd9fc
2 changed files with 38 additions and 1 deletions

View File

@ -33,6 +33,8 @@
#include "mozilla/ChaosMode.h"
#include "mozilla/unused.h"
#include "mozilla/Telemetry.h"
// defined by the socket transport service while active
extern PRThread *gSocketThread;
@ -1373,6 +1375,8 @@ nsHttpConnectionMgr::MakeNewConnection(nsConnectionEntry *ent,
"Found a speculative half open connection\n",
ent->mConnInfo->HashKey().get()));
ent->mHalfOpens[i]->SetSpeculative(false);
Telemetry::AutoCounter<Telemetry::HTTPCONNMGR_USED_SPECULATIVE_CONN> usedSpeculativeConn;
++usedSpeculativeConn;
// return OK because we have essentially opened a new connection
// by converting a speculative half-open to general use
@ -2028,8 +2032,12 @@ nsHttpConnectionMgr::CreateTransport(nsConnectionEntry *ent,
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
nsRefPtr<nsHalfOpenSocket> sock = new nsHalfOpenSocket(ent, trans, caps);
if (speculative)
if (speculative) {
sock->SetSpeculative(true);
Telemetry::AutoCounter<Telemetry::HTTPCONNMGR_TOTAL_SPECULATIVE_CONN> totalSpeculativeConn;
++totalSpeculativeConn;
}
nsresult rv = sock->SetupPrimaryStreams();
NS_ENSURE_SUCCESS(rv, rv);
@ -3003,6 +3011,11 @@ nsHttpConnectionMgr::nsHalfOpenSocket::CancelBackupTimer()
void
nsHttpConnectionMgr::nsHalfOpenSocket::Abandon()
{
if (IsSpeculative()) {
Telemetry::AutoCounter<Telemetry::HTTPCONNMGR_UNUSED_SPECULATIVE_CONN> unusedSpeculativeConn;
++unusedSpeculativeConn;
}
LOG(("nsHalfOpenSocket::Abandon [this=%p ent=%s]",
this, mEnt->mConnInfo->Host()));

View File

@ -2294,6 +2294,30 @@
"n_buckets": 50,
"description": "Number of times startup count overflowed"
},
"HTTPCONNMGR_TOTAL_SPECULATIVE_CONN": {
"expires_in_version": "never",
"kind": "exponential",
"high": "1000 * 1000",
"n_buckets": 50,
"extended_statistics_ok": true,
"description": "How many speculative http connections are created"
},
"HTTPCONNMGR_USED_SPECULATIVE_CONN": {
"expires_in_version": "never",
"kind": "exponential",
"high": "1000 * 1000",
"n_buckets": 50,
"extended_statistics_ok": true,
"description": "How many speculative http connections are actually used"
},
"HTTPCONNMGR_UNUSED_SPECULATIVE_CONN": {
"expires_in_version": "never",
"kind": "exponential",
"high": "1000 * 1000",
"n_buckets": 50,
"extended_statistics_ok": true,
"description": "How many speculative connections are made needlessly"
},
"FIND_PLUGINS": {
"expires_in_version": "never",
"kind": "exponential",