From ab961aeb54335fd07c66de2e3b8c3b6af6f89ea2 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 3 Sep 2018 10:11:38 +0200 Subject: 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. --- netwerk/base/BackgroundFileSaver.cpp | 2 - netwerk/base/Predictor.cpp | 26 +---- netwerk/base/nsLoadGroup.cpp | 159 +---------------------------- netwerk/base/nsNetUtil.cpp | 8 -- netwerk/base/nsSocketTransport2.cpp | 46 +-------- netwerk/base/nsSocketTransportService2.cpp | 43 -------- netwerk/base/nsUDPSocket.cpp | 27 ----- 7 files changed, 3 insertions(+), 308 deletions(-) (limited to 'netwerk/base') diff --git a/netwerk/base/BackgroundFileSaver.cpp b/netwerk/base/BackgroundFileSaver.cpp index e4bc05826..cfe94e35b 100644 --- a/netwerk/base/BackgroundFileSaver.cpp +++ b/netwerk/base/BackgroundFileSaver.cpp @@ -798,8 +798,6 @@ BackgroundFileSaver::NotifySaveComplete() // during the session in a telemetry histogram, and we reset the maximum // thread counter for the next download session if (sThreadCount == 0) { - Telemetry::Accumulate(Telemetry::BACKGROUNDFILESAVER_THREAD_COUNT, - sTelemetryMaxThreadCount); sTelemetryMaxThreadCount = 0; } diff --git a/netwerk/base/Predictor.cpp b/netwerk/base/Predictor.cpp index e97b11d16..12e4eb415 100644 --- a/netwerk/base/Predictor.cpp +++ b/netwerk/base/Predictor.cpp @@ -294,26 +294,9 @@ Predictor::Action::OnCacheEntryAvailable(nsICacheEntry *entry, bool isNew, "Aborting.", this, result)); return NS_OK; } - Telemetry::AccumulateTimeDelta(Telemetry::PREDICTOR_WAIT_TIME, - mStartTime); - if (mPredict) { - bool predicted = mPredictor->PredictInternal(mPredictReason, entry, isNew, - mFullUri, mTargetURI, - mVerifier, mStackCount); - Telemetry::AccumulateTimeDelta( - Telemetry::PREDICTOR_PREDICT_WORK_TIME, mStartTime); - if (predicted) { - Telemetry::AccumulateTimeDelta( - Telemetry::PREDICTOR_PREDICT_TIME_TO_ACTION, mStartTime); - } else { - Telemetry::AccumulateTimeDelta( - Telemetry::PREDICTOR_PREDICT_TIME_TO_INACTION, mStartTime); - } - } else { + if (!mPredict) { mPredictor->LearnInternal(mLearnReason, entry, isNew, mFullUri, mTargetURI, mSourceURI); - Telemetry::AccumulateTimeDelta( - Telemetry::PREDICTOR_LEARN_WORK_TIME, mStartTime); } return NS_OK; @@ -1073,8 +1056,6 @@ Predictor::CalculateGlobalDegradation(uint32_t lastLoad) globalDegradation = mPageDegradationMax; } - Telemetry::Accumulate(Telemetry::PREDICTOR_GLOBAL_DEGRADATION, - globalDegradation); return globalDegradation; } @@ -1139,10 +1120,6 @@ Predictor::CalculateConfidence(uint32_t hitCount, uint32_t hitsPossible, confidence = std::max(confidence, 0); confidence = std::min(confidence, maxConfidence); - Telemetry::Accumulate(Telemetry::PREDICTOR_BASE_CONFIDENCE, baseConfidence); - Telemetry::Accumulate(Telemetry::PREDICTOR_SUBRESOURCE_DEGRADATION, - confidenceDegradation); - Telemetry::Accumulate(Telemetry::PREDICTOR_CONFIDENCE, confidence); return confidence; } @@ -2335,7 +2312,6 @@ Predictor::PrefetchListener::OnStopRequest(nsIRequest *aRequest, if (NS_FAILED(aStatusCode)) { return aStatusCode; } - Telemetry::AccumulateTimeDelta(Telemetry::PREDICTOR_PREFETCH_TIME, mStartTime); nsCOMPtr httpChannel = do_QueryInterface(aRequest); if (!httpChannel) { diff --git a/netwerk/base/nsLoadGroup.cpp b/netwerk/base/nsLoadGroup.cpp index 51d5a9ca7..9981bd698 100644 --- a/netwerk/base/nsLoadGroup.cpp +++ b/netwerk/base/nsLoadGroup.cpp @@ -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 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 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, diff --git a/netwerk/base/nsNetUtil.cpp b/netwerk/base/nsNetUtil.cpp index d60c909c5..653a9003e 100644 --- a/netwerk/base/nsNetUtil.cpp +++ b/netwerk/base/nsNetUtil.cpp @@ -2262,7 +2262,6 @@ NS_ShouldSecureUpgrade(nsIURI* aURI, nsIScriptError::warningFlag, "CSP", innerWindowId); - Telemetry::Accumulate(Telemetry::HTTP_SCHEME_UPGRADE, 4); aShouldUpgrade = true; return NS_OK; } @@ -2285,17 +2284,10 @@ NS_ShouldSecureUpgrade(nsIURI* aURI, if (isStsHost) { LOG(("nsHttpChannel::Connect() STS permissions found\n")); if (aAllowSTS) { - Telemetry::Accumulate(Telemetry::HTTP_SCHEME_UPGRADE, 3); aShouldUpgrade = true; return NS_OK; - } else { - Telemetry::Accumulate(Telemetry::HTTP_SCHEME_UPGRADE, 2); } - } else { - Telemetry::Accumulate(Telemetry::HTTP_SCHEME_UPGRADE, 1); } - } else { - Telemetry::Accumulate(Telemetry::HTTP_SCHEME_UPGRADE, 0); } aShouldUpgrade = false; return NS_OK; diff --git a/netwerk/base/nsSocketTransport2.cpp b/netwerk/base/nsSocketTransport2.cpp index 184757d33..f9b55ead4 100644 --- a/netwerk/base/nsSocketTransport2.cpp +++ b/netwerk/base/nsSocketTransport2.cpp @@ -1596,17 +1596,6 @@ nsSocketTransport::RecoverFromError() bool tryAgain = false; - if ((mState == STATE_CONNECTING) && mDNSRecord && - mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) { - if (mNetAddr.raw.family == AF_INET) { - Telemetry::Accumulate(Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY, - UNSUCCESSFUL_CONNECTING_TO_IPV4_ADDRESS); - } else if (mNetAddr.raw.family == AF_INET6) { - Telemetry::Accumulate(Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY, - UNSUCCESSFUL_CONNECTING_TO_IPV6_ADDRESS); - } - } - if (mConnectionFlags & (DISABLE_IPV6 | DISABLE_IPV4) && mCondition == NS_ERROR_UNKNOWN_HOST && mState == STATE_RESOLVING && @@ -1996,18 +1985,6 @@ nsSocketTransport::OnSocketReady(PRFileDesc *fd, int16_t outFlags) // we are connected! // OnSocketConnected(); - - if (mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) { - if (mNetAddr.raw.family == AF_INET) { - Telemetry::Accumulate( - Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY, - SUCCESSFUL_CONNECTING_TO_IPV4_ADDRESS); - } else if (mNetAddr.raw.family == AF_INET6) { - Telemetry::Accumulate( - Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY, - SUCCESSFUL_CONNECTING_TO_IPV6_ADDRESS); - } - } } else { PRErrorCode code = PR_GetError(); @@ -3201,28 +3178,7 @@ nsSocketTransport::SendPRBlockingTelemetry(PRIntervalTime aStart, Telemetry::ID aIDLinkChange, Telemetry::ID aIDOffline) { - PRIntervalTime now = PR_IntervalNow(); - if (gIOService->IsNetTearingDown()) { - Telemetry::Accumulate(aIDShutdown, - PR_IntervalToMilliseconds(now - aStart)); - - } else if (PR_IntervalToSeconds(now - gIOService->LastConnectivityChange()) - < 60) { - Telemetry::Accumulate(aIDConnectivityChange, - PR_IntervalToMilliseconds(now - aStart)); - } else if (PR_IntervalToSeconds(now - gIOService->LastNetworkLinkChange()) - < 60) { - Telemetry::Accumulate(aIDLinkChange, - PR_IntervalToMilliseconds(now - aStart)); - - } else if (PR_IntervalToSeconds(now - gIOService->LastOfflineStateChange()) - < 60) { - Telemetry::Accumulate(aIDOffline, - PR_IntervalToMilliseconds(now - aStart)); - } else { - Telemetry::Accumulate(aIDNormal, - PR_IntervalToMilliseconds(now - aStart)); - } + /* STUB */ } } // namespace net diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index 068bf0eca..72afdc9e1 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -219,7 +219,6 @@ nsSocketTransportService::CanAttachSocket() if (mTelemetryEnabledPref && (((total >= 900) || !rv) && !reported900FDLimit)) { reported900FDLimit = true; - Telemetry::Accumulate(Telemetry::NETWORK_SESSION_AT_900FD, true); } return rv; @@ -898,16 +897,6 @@ nsSocketTransportService::Run() DoPollIteration(&singlePollDuration); - if (mTelemetryEnabledPref && !pollCycleStart.IsNull()) { - Telemetry::Accumulate(Telemetry::STS_POLL_BLOCK_TIME, - singlePollDuration.ToMilliseconds()); - Telemetry::AccumulateTimeDelta( - Telemetry::STS_POLL_CYCLE, - pollCycleStart + singlePollDuration, - TimeStamp::NowLoRes()); - pollDuration += singlePollDuration; - } - mRawThread->HasPendingEvents(&pendingEvents); if (pendingEvents) { if (!mServingPendingQueue) { @@ -940,22 +929,6 @@ nsSocketTransportService::Run() ((TimeStamp::NowLoRes() - eventQueueStart).ToMilliseconds() < mMaxTimePerPollIter)); - - if (mTelemetryEnabledPref && !mServingPendingQueue && - !startOfIteration.IsNull()) { - Telemetry::AccumulateTimeDelta( - Telemetry::STS_POLL_AND_EVENTS_CYCLE, - startOfIteration + pollDuration, - TimeStamp::NowLoRes()); - - Telemetry::Accumulate( - Telemetry::STS_NUMBER_OF_PENDING_EVENTS, - numberOfPendingEvents); - - numberOfPendingEventsLastCycle += numberOfPendingEvents; - numberOfPendingEvents = 0; - pollDuration = 0; - } } } while (pendingEvents); @@ -964,16 +937,6 @@ nsSocketTransportService::Run() { MutexAutoLock lock(mLock); if (mShuttingDown) { - if (mTelemetryEnabledPref && - !startOfCycleForLastCycleCalc.IsNull()) { - Telemetry::Accumulate( - Telemetry::STS_NUMBER_OF_PENDING_EVENTS_IN_THE_LAST_CYCLE, - numberOfPendingEventsLastCycle); - Telemetry::AccumulateTimeDelta( - Telemetry::STS_POLL_AND_EVENT_THE_LAST_CYCLE, - startOfCycleForLastCycleCalc, - TimeStamp::NowLoRes()); - } break; } if (mGoingOffline) { @@ -1142,11 +1105,6 @@ nsSocketTransportService::DoPollIteration(TimeDuration *pollDuration) } } } - if (mTelemetryEnabledPref) { - Telemetry::Accumulate( - Telemetry::STS_NUMBER_OF_ONSOCKETREADY_CALLS, - numberOfOnSocketReadyCalls); - } // // check for "dead" sockets and remove them (need to do this in @@ -1465,7 +1423,6 @@ nsSocketTransportService::ProbeMaxCount() if (pfd[index].fd) PR_Close(pfd[index].fd); - Telemetry::Accumulate(Telemetry::NETWORK_PROBE_MAXCOUNT, gMaxCount); SOCKET_LOG(("Socket Limit Test max was confirmed at %d\n", gMaxCount)); } #endif // windows diff --git a/netwerk/base/nsUDPSocket.cpp b/netwerk/base/nsUDPSocket.cpp index 5973a205d..24f3954cb 100644 --- a/netwerk/base/nsUDPSocket.cpp +++ b/netwerk/base/nsUDPSocket.cpp @@ -777,33 +777,6 @@ nsUDPSocket::CloseSocket() } PR_Close(mFD); - - if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) { - PRIntervalTime now = PR_IntervalNow(); - if (gIOService->IsNetTearingDown()) { - Telemetry::Accumulate(Telemetry::PRCLOSE_UDP_BLOCKING_TIME_SHUTDOWN, - PR_IntervalToMilliseconds(now - closeStarted)); - - } else if (PR_IntervalToSeconds(now - gIOService->LastConnectivityChange()) - < 60) { - Telemetry::Accumulate(Telemetry::PRCLOSE_UDP_BLOCKING_TIME_CONNECTIVITY_CHANGE, - PR_IntervalToMilliseconds(now - closeStarted)); - - } else if (PR_IntervalToSeconds(now - gIOService->LastNetworkLinkChange()) - < 60) { - Telemetry::Accumulate(Telemetry::PRCLOSE_UDP_BLOCKING_TIME_LINK_CHANGE, - PR_IntervalToMilliseconds(now - closeStarted)); - - } else if (PR_IntervalToSeconds(now - gIOService->LastOfflineStateChange()) - < 60) { - Telemetry::Accumulate(Telemetry::PRCLOSE_UDP_BLOCKING_TIME_OFFLINE, - PR_IntervalToMilliseconds(now - closeStarted)); - - } else { - Telemetry::Accumulate(Telemetry::PRCLOSE_UDP_BLOCKING_TIME_NORMAL, - PR_IntervalToMilliseconds(now - closeStarted)); - } - } } mFD = nullptr; } -- cgit v1.2.3