Bug 1696945 - Part 2: Add Http Channel completon PerfStats r=necko-reviewers,dragana

Record from asyncOpen to channel completion in HttpChannelChild, for both network and cache sources.
This will allow us to capture cross-platform networking timings in pageload and other scenarios.

Differential Revision: https://phabricator.services.mozilla.com/D107507
This commit is contained in:
Andrew Creskey 2021-03-09 15:59:43 +00:00
Родитель 3227459668
Коммит a684bcf2c1
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -11,6 +11,7 @@
#include "nsHttp.h"
#include "nsICacheEntry.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/PerfStats.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/DocGroup.h"
@ -910,6 +911,15 @@ void HttpChannelChild::OnStopRequest(
}
#endif
if (mIsFromCache) {
PerfStats::RecordMeasurement(PerfStats::Metric::HttpChannelCompletion_Cache,
TimeStamp::Now() - mAsyncOpenTime);
} else {
PerfStats::RecordMeasurement(
PerfStats::Metric::HttpChannelCompletion_Network,
TimeStamp::Now() - mAsyncOpenTime);
}
mResponseTrailers = MakeUnique<nsHttpHeaderArray>(aResponseTrailers);
DoPreOnStopRequest(aChannelStatus);