Bug 791088 - Add telemetry for Connection Manager transaction time. r=mcmanus

This commit is contained in:
Valentin Gosu 2012-09-19 20:24:58 -04:00
parent 8e217373e9
commit 128a63b096
3 changed files with 58 additions and 2 deletions

View File

@ -1338,6 +1338,18 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent,
if ((ent->PipelineState() == PS_YELLOW) && (trans->PipelinePosition() > 1))
ent->SetYellowConnection(bestConn);
if (!trans->GetPendingTime().IsNull()) {
if (trans->UsesPipelining())
AccumulateTimeDelta(
Telemetry::TRANSACTION_WAIT_TIME_HTTP_PIPELINES,
trans->GetPendingTime(), mozilla::TimeStamp::Now());
else
AccumulateTimeDelta(
Telemetry::TRANSACTION_WAIT_TIME_HTTP,
trans->GetPendingTime(), mozilla::TimeStamp::Now());
trans->SetPendingTime(false);
}
return true;
}
@ -1524,6 +1536,7 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent,
{
uint8_t caps = trans->Caps();
int32_t priority = trans->Priority();
nsresult rv;
LOG(("nsHttpConnectionMgr::DispatchTransaction "
"[ci=%s trans=%x caps=%x conn=%x priority=%d]\n",
@ -1534,8 +1547,13 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent,
"Connection host = %s\n",
trans->ConnectionInfo()->Host(),
conn->ConnectionInfo()->Host()));
nsresult rv = conn->Activate(trans, caps, priority);
rv = conn->Activate(trans, caps, priority);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "SPDY Cannot Fail Dispatch");
if (NS_SUCCEEDED(rv) && !trans->GetPendingTime().IsNull()) {
AccumulateTimeDelta(Telemetry::TRANSACTION_WAIT_TIME_SPDY,
trans->GetPendingTime(), mozilla::TimeStamp::Now());
trans->SetPendingTime(false);
}
return rv;
}
@ -1547,7 +1565,17 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent,
else
conn->Classify(trans->Classification());
return DispatchAbstractTransaction(ent, trans, caps, conn, priority);
rv = DispatchAbstractTransaction(ent, trans, caps, conn, priority);
if (NS_SUCCEEDED(rv) && !trans->GetPendingTime().IsNull()) {
if (trans->UsesPipelining())
AccumulateTimeDelta(Telemetry::TRANSACTION_WAIT_TIME_HTTP_PIPELINES,
trans->GetPendingTime(), mozilla::TimeStamp::Now());
else
AccumulateTimeDelta(Telemetry::TRANSACTION_WAIT_TIME_HTTP,
trans->GetPendingTime(), mozilla::TimeStamp::Now());
trans->SetPendingTime(false);
}
return rv;
}
@ -1652,6 +1680,8 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans)
return NS_OK;
}
trans->SetPendingTime();
nsresult rv = NS_OK;
nsHttpConnectionInfo *ci = trans->ConnectionInfo();
NS_ASSERTION(ci, "no connection info");

View File

@ -105,6 +105,11 @@ public:
void PrintDiagnostics(nsCString &log);
// Sets mPendingTime to the current time stamp or to a null time stamp (if now is false)
void SetPendingTime(bool now = true) { mPendingTime = now ? mozilla::TimeStamp::Now() : mozilla::TimeStamp(); }
const mozilla::TimeStamp GetPendingTime() { return mPendingTime; }
bool UsesPipelining() const { return mCaps & NS_HTTP_ALLOW_PIPELINING; }
private:
nsresult Restart();
nsresult RestartInProgress();
@ -209,6 +214,9 @@ private:
nsHttpResponseHead *mForTakeResponseHead;
bool mResponseHeadTaken;
// The time when the transaction was submitted to the Connection Manager
mozilla::TimeStamp mPendingTime;
class RestartVerifier
{

View File

@ -891,6 +891,24 @@
"n_buckets": 50,
"description": "Time to search offline cache (ms)"
},
"TRANSACTION_WAIT_TIME_HTTP": {
"kind": "exponential",
"high": "5000",
"n_buckets": 100,
"description": "Time from submission to dispatch of HTTP transaction (ms)"
},
"TRANSACTION_WAIT_TIME_HTTP_PIPELINES": {
"kind": "exponential",
"high": "5000",
"n_buckets": 100,
"description": "Time from submission to dispatch of HTTP with pipelines transaction (ms)"
},
"TRANSACTION_WAIT_TIME_SPDY": {
"kind": "exponential",
"high": "5000",
"n_buckets": 100,
"description": "Time from submission to dispatch of SPDY transaction (ms)"
},
"HTTP_DISK_CACHE_OVERHEAD": {
"kind": "exponential",
"high": "32000000",