Remove all C++ Telemetry Accumulation calls.

This creates a number of stubs and leaves some surrounding code that may be irrelevant (eg. recorded time stamps, status variables).
Stub resolution/removal should be a follow-up to this.
This commit is contained in:
wolfbeast 2018-09-03 10:11:38 +02:00 committed by Roy Tam
commit 8c8145e620
186 changed files with 48 additions and 2957 deletions

View file

@ -14,7 +14,6 @@
#include "mozilla/Logging.h"
#include "nsString.h"
#include "nsTArray.h"
#include "mozilla/Telemetry.h"
#include "nsITimedChannel.h"
#include "nsIInterfaceRequestor.h"
#include "nsIRequestObserver.h"
@ -574,40 +573,6 @@ nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt,
mRequests.RemoveEntry(entry);
// Collect telemetry stats only when default request is a timed channel.
// Don't include failed requests in the timing statistics.
if (mDefaultLoadIsTimed && NS_SUCCEEDED(aStatus)) {
nsCOMPtr<nsITimedChannel> timedChannel = do_QueryInterface(request);
if (timedChannel) {
// Figure out if this request was served from the cache
++mTimedRequests;
TimeStamp timeStamp;
rv = timedChannel->GetCacheReadStart(&timeStamp);
if (NS_SUCCEEDED(rv) && !timeStamp.IsNull()) {
++mCachedRequests;
}
else {
mTimedNonCachedRequestsUntilOnEndPageLoad++;
}
rv = timedChannel->GetAsyncOpen(&timeStamp);
if (NS_SUCCEEDED(rv) && !timeStamp.IsNull()) {
Telemetry::AccumulateTimeDelta(
Telemetry::HTTP_SUBITEM_OPEN_LATENCY_TIME,
mDefaultRequestCreationTime, timeStamp);
}
rv = timedChannel->GetResponseStart(&timeStamp);
if (NS_SUCCEEDED(rv) && !timeStamp.IsNull()) {
Telemetry::AccumulateTimeDelta(
Telemetry::HTTP_SUBITEM_FIRST_BYTE_LATENCY_TIME,
mDefaultRequestCreationTime, timeStamp);
}
TelemetryReportChannel(timedChannel, false);
}
}
if (mRequests.EntryCount() == 0) {
TelemetryReport();
}
@ -815,19 +780,7 @@ nsLoadGroup::SetDefaultLoadFlags(uint32_t aFlags)
void
nsLoadGroup::TelemetryReport()
{
if (mDefaultLoadIsTimed) {
Telemetry::Accumulate(Telemetry::HTTP_REQUEST_PER_PAGE, mTimedRequests);
if (mTimedRequests) {
Telemetry::Accumulate(Telemetry::HTTP_REQUEST_PER_PAGE_FROM_CACHE,
mCachedRequests * 100 / mTimedRequests);
}
nsCOMPtr<nsITimedChannel> timedChannel =
do_QueryInterface(mDefaultLoadRequest);
if (timedChannel)
TelemetryReportChannel(timedChannel, true);
}
/* STUB */
mTimedRequests = 0;
mCachedRequests = 0;
mDefaultLoadIsTimed = false;
@ -898,116 +851,6 @@ nsLoadGroup::TelemetryReportChannel(nsITimedChannel *aTimedChannel,
rv = aTimedChannel->GetResponseEnd(&responseEnd);
if (NS_FAILED(rv))
return;
#define HTTP_REQUEST_HISTOGRAMS(prefix) \
if (!domainLookupStart.IsNull()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_DNS_ISSUE_TIME, \
asyncOpen, domainLookupStart); \
} \
\
if (!domainLookupStart.IsNull() && !domainLookupEnd.IsNull()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_DNS_LOOKUP_TIME, \
domainLookupStart, domainLookupEnd); \
} \
\
if (!secureConnectionStart.IsNull() && !connectEnd.IsNull()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_TLS_HANDSHAKE, \
secureConnectionStart, connectEnd); \
} \
\
if (!connectStart.IsNull() && !connectEnd.IsNull()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_TCP_CONNECTION_2, \
connectStart, connectEnd); \
} \
\
\
if (!requestStart.IsNull() && !responseEnd.IsNull()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_OPEN_TO_FIRST_SENT, \
asyncOpen, requestStart); \
\
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_FIRST_SENT_TO_LAST_RECEIVED, \
requestStart, responseEnd); \
\
if (cacheReadStart.IsNull() && !responseStart.IsNull()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_OPEN_TO_FIRST_RECEIVED, \
asyncOpen, responseStart); \
} \
} \
\
if (!cacheReadStart.IsNull() && !cacheReadEnd.IsNull()) { \
if (!CacheObserver::UseNewCache()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_OPEN_TO_FIRST_FROM_CACHE, \
asyncOpen, cacheReadStart); \
} else { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_OPEN_TO_FIRST_FROM_CACHE_V2, \
asyncOpen, cacheReadStart); \
} \
\
if (!CacheObserver::UseNewCache()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_CACHE_READ_TIME, \
cacheReadStart, cacheReadEnd); \
} else { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_CACHE_READ_TIME_V2, \
cacheReadStart, cacheReadEnd); \
} \
\
if (!requestStart.IsNull() && !responseEnd.IsNull()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_REVALIDATION, \
requestStart, responseEnd); \
} \
} \
\
if (!cacheReadEnd.IsNull()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD, \
asyncOpen, cacheReadEnd); \
\
if (!CacheObserver::UseNewCache()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_CACHED, \
asyncOpen, cacheReadEnd); \
} else { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_CACHED_V2, \
asyncOpen, cacheReadEnd); \
} \
} \
else if (!responseEnd.IsNull()) { \
if (!CacheObserver::UseNewCache()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD, \
asyncOpen, responseEnd); \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_NET, \
asyncOpen, responseEnd); \
} else { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_V2, \
asyncOpen, responseEnd); \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_NET_V2, \
asyncOpen, responseEnd); \
} \
}
if (aDefaultRequest) {
HTTP_REQUEST_HISTOGRAMS(PAGE)
} else {
HTTP_REQUEST_HISTOGRAMS(SUB)
}
#undef HTTP_REQUEST_HISTOGRAMS
}
nsresult nsLoadGroup::MergeLoadFlags(nsIRequest *aRequest,