зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1877525 - Consider adding profiler markers at nsHttpConnectionMgr::ProcessNewTransaction and ::DispatchTransaction r=necko-reviewers,valentin
This would allow us to identify requests delayed due to longer transaction pending times. Differential Revision: https://phabricator.services.mozilla.com/D200055
This commit is contained in:
Родитель
bc8d81d39d
Коммит
a991dd1b1e
|
@ -62,16 +62,23 @@ struct UrlMarker {
|
|||
}
|
||||
static void StreamJSONMarkerData(
|
||||
mozilla::baseprofiler::SpliceableJSONWriter& aWriter,
|
||||
const mozilla::ProfilerString8View& aURL) {
|
||||
const mozilla::ProfilerString8View& aURL, const TimeDuration& aDuration,
|
||||
uint64_t aChannelId) {
|
||||
if (aURL.Length() != 0) {
|
||||
aWriter.StringProperty("url", aURL);
|
||||
}
|
||||
if (!aDuration.IsZero()) {
|
||||
aWriter.DoubleProperty("duration", aDuration.ToMilliseconds());
|
||||
}
|
||||
aWriter.IntProperty("channelId", static_cast<int64_t>(aChannelId));
|
||||
}
|
||||
static MarkerSchema MarkerTypeDisplay() {
|
||||
using MS = MarkerSchema;
|
||||
MS schema(MS::Location::MarkerChart, MS::Location::MarkerTable);
|
||||
schema.SetTableLabel("{marker.name} - {marker.data.url}");
|
||||
schema.AddKeyFormat("url", MS::Format::Url);
|
||||
schema.AddKeyFormatSearchable("url", MS::Format::Url,
|
||||
MS::Searchable::Searchable);
|
||||
schema.AddKeyLabelFormat("duration", "Duration", MS::Format::Duration);
|
||||
return schema;
|
||||
}
|
||||
};
|
||||
|
@ -505,9 +512,10 @@ nsresult nsHttpConnectionMgr::SpeculativeConnect(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCString url = ci->EndToEndSSL() ? "https://"_ns : "http://"_ns;
|
||||
nsAutoCString url(ci->EndToEndSSL() ? "https://"_ns : "http://"_ns);
|
||||
url += ci->GetOrigin();
|
||||
PROFILER_MARKER("SpeculativeConnect", NETWORK, {}, UrlMarker, url);
|
||||
PROFILER_MARKER("SpeculativeConnect", NETWORK, {}, UrlMarker, url,
|
||||
TimeDuration::Zero(), 0);
|
||||
|
||||
RefPtr<SpeculativeConnectArgs> args = new SpeculativeConnectArgs();
|
||||
|
||||
|
@ -1649,9 +1657,9 @@ nsresult nsHttpConnectionMgr::DispatchTransaction(ConnectionEntry* ent,
|
|||
trans->CancelPacing(NS_OK);
|
||||
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
TimeDuration elapsed = now - trans->GetPendingTime();
|
||||
auto recordPendingTimeForHTTPSRR = [&](nsCString& aKey) {
|
||||
uint32_t stage = trans->HTTPSSVCReceivedStage();
|
||||
TimeDuration elapsed = now - trans->GetPendingTime();
|
||||
if (HTTPS_RR_IS_USED(stage)) {
|
||||
glean::networking::transaction_wait_time_https_rr.AccumulateRawDuration(
|
||||
elapsed);
|
||||
|
@ -1659,10 +1667,16 @@ nsresult nsHttpConnectionMgr::DispatchTransaction(ConnectionEntry* ent,
|
|||
} else {
|
||||
glean::networking::transaction_wait_time.AccumulateRawDuration(elapsed);
|
||||
}
|
||||
PerfStats::RecordMeasurement(PerfStats::Metric::HttpTransactionWaitTime,
|
||||
elapsed);
|
||||
};
|
||||
|
||||
PerfStats::RecordMeasurement(PerfStats::Metric::HttpTransactionWaitTime,
|
||||
elapsed);
|
||||
|
||||
PROFILER_MARKER(
|
||||
"DispatchTransaction", NETWORK,
|
||||
MarkerOptions(MarkerTiming::Interval(trans->GetPendingTime(), now)),
|
||||
UrlMarker, trans->GetUrl(), elapsed, trans->ChannelId());
|
||||
|
||||
nsAutoCString httpVersionkey("h1"_ns);
|
||||
if (conn->UsingSpdy() || conn->UsingHttp3()) {
|
||||
LOG(
|
||||
|
@ -1770,6 +1784,9 @@ nsresult nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction* trans) {
|
|||
|
||||
trans->SetPendingTime();
|
||||
|
||||
PROFILER_MARKER("ProcessNewTransaction", NETWORK, {}, UrlMarker,
|
||||
trans->GetUrl(), TimeDuration::Zero(), trans->ChannelId());
|
||||
|
||||
RefPtr<Http2PushedStreamWrapper> pushedStreamWrapper =
|
||||
trans->GetPushedStream();
|
||||
if (pushedStreamWrapper) {
|
||||
|
|
|
@ -398,11 +398,16 @@ nsresult nsHttpTransaction::Init(
|
|||
}
|
||||
|
||||
RefPtr<nsHttpChannel> httpChannel = do_QueryObject(eventsink);
|
||||
RefPtr<WebTransportSessionEventListener> listener =
|
||||
httpChannel ? httpChannel->GetWebTransportSessionEventListener()
|
||||
: nullptr;
|
||||
if (listener) {
|
||||
mWebTransportSessionEventListener = std::move(listener);
|
||||
if (httpChannel) {
|
||||
RefPtr<WebTransportSessionEventListener> listener =
|
||||
httpChannel->GetWebTransportSessionEventListener();
|
||||
if (listener) {
|
||||
mWebTransportSessionEventListener = std::move(listener);
|
||||
}
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (NS_SUCCEEDED(httpChannel->GetURI(getter_AddRefs(uri)))) {
|
||||
mUrl = uri->GetSpecOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -196,6 +196,10 @@ class nsHttpTransaction final : public nsAHttpTransaction,
|
|||
|
||||
bool IsForWebTransport() { return mIsForWebTransport; }
|
||||
|
||||
nsAutoCString GetUrl() { return mUrl; }
|
||||
|
||||
uint64_t ChannelId() { return mChannelId; }
|
||||
|
||||
private:
|
||||
friend class DeleteHttpTransaction;
|
||||
virtual ~nsHttpTransaction();
|
||||
|
@ -593,6 +597,8 @@ class nsHttpTransaction final : public nsAHttpTransaction,
|
|||
nsCString mHashKeyOfConnectionEntry;
|
||||
|
||||
nsCOMPtr<WebTransportSessionEventListener> mWebTransportSessionEventListener;
|
||||
|
||||
nsAutoCString mUrl;
|
||||
};
|
||||
|
||||
} // namespace mozilla::net
|
||||
|
|
Загрузка…
Ссылка в новой задаче