Bug 1794598 - Optimize string allocation in ClassOfService::ToString() r=necko-reviewers,valentin
We want to save heap allocations in this important codepath. Differential Revision: https://phabricator.services.mozilla.com/D159626
This commit is contained in:
@@ -1231,14 +1231,16 @@ HttpChannelParent::OnStartRequest(nsIRequest* aRequest) {
|
||||
|
||||
if (!args.timing().domainLookupEnd().IsNull() &&
|
||||
!args.timing().connectStart().IsNull()) {
|
||||
nsCString protocolVersion;
|
||||
nsAutoCString protocolVersion;
|
||||
mChannel->GetProtocolVersion(protocolVersion);
|
||||
uint32_t classOfServiceFlags = 0;
|
||||
mChannel->GetClassFlags(&classOfServiceFlags);
|
||||
nsAutoCString cosString;
|
||||
ClassOfService::ToString(classOfServiceFlags, cosString);
|
||||
nsAutoCString key(
|
||||
nsPrintfCString("%s_%s", protocolVersion.get(), cosString.get()));
|
||||
Telemetry::AccumulateTimeDelta(
|
||||
Telemetry::NETWORK_DNS_END_TO_CONNECT_START_EXP_MS,
|
||||
protocolVersion + "_"_ns +
|
||||
ClassOfService::ToString(classOfServiceFlags),
|
||||
Telemetry::NETWORK_DNS_END_TO_CONNECT_START_EXP_MS, key,
|
||||
args.timing().domainLookupEnd(), args.timing().connectStart());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user