summaryrefslogtreecommitdiffstats
path: root/netwerk/base
diff options
context:
space:
mode:
authoradeshkp <adeshkp@users.noreply.github.com>2019-01-12 06:20:31 -0500
committeradeshkp <adeshkp@users.noreply.github.com>2019-01-12 06:20:31 -0500
commit5335681cd2ab05ad47e81be7722c9eee19d54065 (patch)
treeeced0f22032c4f01229ac0a18b9ffb6219cea309 /netwerk/base
parentf38edc94a31de3bae839cf63ed57c3851908ac46 (diff)
downloadUXP-5335681cd2ab05ad47e81be7722c9eee19d54065.tar
UXP-5335681cd2ab05ad47e81be7722c9eee19d54065.tar.gz
UXP-5335681cd2ab05ad47e81be7722c9eee19d54065.tar.lz
UXP-5335681cd2ab05ad47e81be7722c9eee19d54065.tar.xz
UXP-5335681cd2ab05ad47e81be7722c9eee19d54065.zip
Telemetry: Remove stubs and related code
Diffstat (limited to 'netwerk/base')
-rw-r--r--netwerk/base/BackgroundFileSaver.cpp13
-rw-r--r--netwerk/base/BackgroundFileSaver.h9
-rw-r--r--netwerk/base/nsIOService.cpp14
-rw-r--r--netwerk/base/nsIOService.h13
-rw-r--r--netwerk/base/nsLoadGroup.cpp94
-rw-r--r--netwerk/base/nsLoadGroup.h11
-rw-r--r--netwerk/base/nsSocketTransport2.cpp90
-rw-r--r--netwerk/base/nsSocketTransport2.h9
-rw-r--r--netwerk/base/nsSocketTransportService2.cpp68
-rw-r--r--netwerk/base/nsSocketTransportService2.h17
-rw-r--r--netwerk/base/nsUDPSocket.cpp11
-rw-r--r--netwerk/base/nsUDPSocket.h2
12 files changed, 14 insertions, 337 deletions
diff --git a/netwerk/base/BackgroundFileSaver.cpp b/netwerk/base/BackgroundFileSaver.cpp
index cfe94e35b..b338c2a08 100644
--- a/netwerk/base/BackgroundFileSaver.cpp
+++ b/netwerk/base/BackgroundFileSaver.cpp
@@ -9,7 +9,6 @@
#include "ScopedNSSTypes.h"
#include "mozilla/Casting.h"
#include "mozilla/Logging.h"
-#include "mozilla/Telemetry.h"
#include "nsCOMArray.h"
#include "nsIAsyncInputStream.h"
#include "nsIFile.h"
@@ -85,7 +84,6 @@ private:
//// BackgroundFileSaver
uint32_t BackgroundFileSaver::sThreadCount = 0;
-uint32_t BackgroundFileSaver::sTelemetryMaxThreadCount = 0;
BackgroundFileSaver::BackgroundFileSaver()
: mControlThread(nullptr)
@@ -156,9 +154,6 @@ BackgroundFileSaver::Init()
NS_ENSURE_SUCCESS(rv, rv);
sThreadCount++;
- if (sThreadCount > sTelemetryMaxThreadCount) {
- sTelemetryMaxThreadCount = sThreadCount;
- }
return NS_OK;
}
@@ -793,14 +788,6 @@ BackgroundFileSaver::NotifySaveComplete()
sThreadCount--;
- // When there are no more active downloads, we consider the download session
- // finished. We record the maximum number of concurrent downloads reached
- // during the session in a telemetry histogram, and we reset the maximum
- // thread counter for the next download session
- if (sThreadCount == 0) {
- sTelemetryMaxThreadCount = 0;
- }
-
return NS_OK;
}
diff --git a/netwerk/base/BackgroundFileSaver.h b/netwerk/base/BackgroundFileSaver.h
index 1fa9268f8..86d3a1ba7 100644
--- a/netwerk/base/BackgroundFileSaver.h
+++ b/netwerk/base/BackgroundFileSaver.h
@@ -61,15 +61,6 @@ public:
*/
static uint32_t sThreadCount;
- /**
- * Maximum number of worker threads reached during the current download session,
- * used for telemetry.
- *
- * When there are no more worker threads running, we consider the download
- * session finished, and this counter is reset.
- */
- static uint32_t sTelemetryMaxThreadCount;
-
protected:
virtual ~BackgroundFileSaver();
diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp
index 435294315..e0dc7d8e8 100644
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -48,7 +48,6 @@
#include "mozilla/LoadInfo.h"
#include "mozilla/net/NeckoCommon.h"
#include "mozilla/Services.h"
-#include "mozilla/Telemetry.h"
#include "mozilla/net/DNS.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/net/NeckoChild.h"
@@ -166,8 +165,6 @@ static const char kProfileDoChange[] = "profile-do-change";
uint32_t nsIOService::gDefaultSegmentSize = 4096;
uint32_t nsIOService::gDefaultSegmentCount = 24;
-bool nsIOService::sTelemetryEnabled = false;
-
bool nsIOService::sBlockToplevelDataUriNavigations = false;
////////////////////////////////////////////////////////////////////////////////
@@ -185,9 +182,6 @@ nsIOService::nsIOService()
, mNetworkLinkServiceInitialized(false)
, mChannelEventSinks(NS_CHANNEL_EVENT_SINK_CATEGORY)
, mNetworkNotifyChanged(true)
- , mLastOfflineStateChange(PR_IntervalNow())
- , mLastConnectivityChange(PR_IntervalNow())
- , mLastNetworkLinkChange(PR_IntervalNow())
, mNetTearingDownStarted(0)
{
}
@@ -247,7 +241,6 @@ nsIOService::Init()
else
NS_WARNING("failed to get observer service");
- Preferences::AddBoolVarCache(&sTelemetryEnabled, "toolkit.telemetry.enabled", false);
Preferences::AddBoolVarCache(&sBlockToplevelDataUriNavigations,
"security.data_uri.block_toplevel_data_uri_navigations", false);
Preferences::AddBoolVarCache(&mOfflineMirrorsConnectivity, OFFLINE_MIRRORS_CONNECTIVITY, true);
@@ -1068,7 +1061,6 @@ nsIOService::SetOffline(bool offline)
if (mSocketTransportService)
mSocketTransportService->SetOffline(true);
- mLastOfflineStateChange = PR_IntervalNow();
if (observerService)
observerService->NotifyObservers(subject,
NS_IOSERVICE_OFFLINE_STATUS_TOPIC,
@@ -1088,7 +1080,6 @@ nsIOService::SetOffline(bool offline)
if (mProxyService)
mProxyService->ReloadPAC();
- mLastOfflineStateChange = PR_IntervalNow();
// don't care if notification fails
// Only send the ONLINE notification if there is connectivity
if (observerService && mConnectivity) {
@@ -1147,10 +1138,6 @@ nsIOService::SetConnectivityInternal(bool aConnectivity)
}
mConnectivity = aConnectivity;
- // This is used for PR_Connect PR_Close telemetry so it is important that
- // we have statistic about network change event even if we are offline.
- mLastConnectivityChange = PR_IntervalNow();
-
if (mCaptivePortalService) {
if (aConnectivity && !xpc::AreNonLocalConnectionsDisabled()) {
// This will also trigger a captive portal check for the new network
@@ -1621,7 +1608,6 @@ nsIOService::OnNetworkLinkEvent(const char *data)
bool isUp = true;
if (!strcmp(data, NS_NETWORK_LINK_DATA_CHANGED)) {
- mLastNetworkLinkChange = PR_IntervalNow();
// CHANGED means UP/DOWN didn't change
// but the status of the captive portal may have changed.
RecheckCaptivePortal();
diff --git a/netwerk/base/nsIOService.h b/netwerk/base/nsIOService.h
index e592c4d1c..19eed743a 100644
--- a/netwerk/base/nsIOService.h
+++ b/netwerk/base/nsIOService.h
@@ -79,9 +79,6 @@ public:
nsAsyncRedirectVerifyHelper *helper);
bool IsOffline() { return mOffline; }
- PRIntervalTime LastOfflineStateChange() { return mLastOfflineStateChange; }
- PRIntervalTime LastConnectivityChange() { return mLastConnectivityChange; }
- PRIntervalTime LastNetworkLinkChange() { return mLastNetworkLinkChange; }
bool IsNetTearingDown() { return mShutdown || mOfflineForProfileChange ||
mHttpHandlerAlreadyShutingDown; }
PRIntervalTime NetTearingDownStarted() { return mNetTearingDownStarted; }
@@ -176,18 +173,8 @@ private:
bool mNetworkNotifyChanged;
- static bool sTelemetryEnabled;
-
static bool sBlockToplevelDataUriNavigations;
- // These timestamps are needed for collecting telemetry on PR_Connect,
- // PR_ConnectContinue and PR_Close blocking time. If we spend very long
- // time in any of these functions we want to know if and what network
- // change has happened shortly before.
- mozilla::Atomic<PRIntervalTime> mLastOfflineStateChange;
- mozilla::Atomic<PRIntervalTime> mLastConnectivityChange;
- mozilla::Atomic<PRIntervalTime> mLastNetworkLinkChange;
-
// Time a network tearing down started.
mozilla::Atomic<PRIntervalTime> mNetTearingDownStarted;
public:
diff --git a/netwerk/base/nsLoadGroup.cpp b/netwerk/base/nsLoadGroup.cpp
index 9981bd698..48d9a6621 100644
--- a/netwerk/base/nsLoadGroup.cpp
+++ b/netwerk/base/nsLoadGroup.cpp
@@ -108,9 +108,6 @@ nsLoadGroup::nsLoadGroup(nsISupports* outer)
, mStatus(NS_OK)
, mPriority(PRIORITY_NORMAL)
, mIsCanceling(false)
- , mDefaultLoadIsTimed(false)
- , mTimedRequests(0)
- , mCachedRequests(0)
, mTimedNonCachedRequestsUntilOnEndPageLoad(0)
{
NS_INIT_AGGREGATED(outer);
@@ -431,13 +428,6 @@ nsLoadGroup::SetDefaultLoadRequest(nsIRequest *aRequest)
// in particular, nsIChannel::LOAD_DOCUMENT_URI...
//
mLoadFlags &= nsIRequest::LOAD_REQUESTMASK;
-
- nsCOMPtr<nsITimedChannel> timedChannel = do_QueryInterface(aRequest);
- mDefaultLoadIsTimed = timedChannel != nullptr;
- if (mDefaultLoadIsTimed) {
- timedChannel->GetChannelCreation(&mDefaultRequestCreationTime);
- timedChannel->SetTimingEnabled(true);
- }
}
// Else, do not change the group's load flags (see bug 95981)
return NS_OK;
@@ -492,10 +482,6 @@ nsLoadGroup::AddRequest(nsIRequest *request, nsISupports* ctxt)
if (mPriority != 0)
RescheduleRequest(request, mPriority);
- nsCOMPtr<nsITimedChannel> timedChannel = do_QueryInterface(request);
- if (timedChannel)
- timedChannel->SetTimingEnabled(true);
-
if (!(flags & nsIRequest::LOAD_BACKGROUND)) {
// Update the count of foreground URIs..
mForegroundCount += 1;
@@ -573,10 +559,6 @@ nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt,
mRequests.RemoveEntry(entry);
- if (mRequests.EntryCount() == 0) {
- TelemetryReport();
- }
-
// Undo any group priority delta...
if (mPriority != 0)
RescheduleRequest(request, -mPriority);
@@ -777,82 +759,6 @@ nsLoadGroup::SetDefaultLoadFlags(uint32_t aFlags)
////////////////////////////////////////////////////////////////////////////////
-void
-nsLoadGroup::TelemetryReport()
-{
- /* STUB */
- mTimedRequests = 0;
- mCachedRequests = 0;
- mDefaultLoadIsTimed = false;
-}
-
-void
-nsLoadGroup::TelemetryReportChannel(nsITimedChannel *aTimedChannel,
- bool aDefaultRequest)
-{
- nsresult rv;
- bool timingEnabled;
- rv = aTimedChannel->GetTimingEnabled(&timingEnabled);
- if (NS_FAILED(rv) || !timingEnabled)
- return;
-
- TimeStamp asyncOpen;
- rv = aTimedChannel->GetAsyncOpen(&asyncOpen);
- // We do not check !asyncOpen.IsNull() bellow, prevent ASSERTIONs this way
- if (NS_FAILED(rv) || asyncOpen.IsNull())
- return;
-
- TimeStamp cacheReadStart;
- rv = aTimedChannel->GetCacheReadStart(&cacheReadStart);
- if (NS_FAILED(rv))
- return;
-
- TimeStamp cacheReadEnd;
- rv = aTimedChannel->GetCacheReadEnd(&cacheReadEnd);
- if (NS_FAILED(rv))
- return;
-
- TimeStamp domainLookupStart;
- rv = aTimedChannel->GetDomainLookupStart(&domainLookupStart);
- if (NS_FAILED(rv))
- return;
-
- TimeStamp domainLookupEnd;
- rv = aTimedChannel->GetDomainLookupEnd(&domainLookupEnd);
- if (NS_FAILED(rv))
- return;
-
- TimeStamp connectStart;
- rv = aTimedChannel->GetConnectStart(&connectStart);
- if (NS_FAILED(rv))
- return;
-
- TimeStamp secureConnectionStart;
- rv = aTimedChannel->GetSecureConnectionStart(&secureConnectionStart);
- if (NS_FAILED(rv))
- return;
-
- TimeStamp connectEnd;
- rv = aTimedChannel->GetConnectEnd(&connectEnd);
- if (NS_FAILED(rv))
- return;
-
- TimeStamp requestStart;
- rv = aTimedChannel->GetRequestStart(&requestStart);
- if (NS_FAILED(rv))
- return;
-
- TimeStamp responseStart;
- rv = aTimedChannel->GetResponseStart(&responseStart);
- if (NS_FAILED(rv))
- return;
-
- TimeStamp responseEnd;
- rv = aTimedChannel->GetResponseEnd(&responseEnd);
- if (NS_FAILED(rv))
- return;
-}
-
nsresult nsLoadGroup::MergeLoadFlags(nsIRequest *aRequest,
nsLoadFlags& outFlags)
{
diff --git a/netwerk/base/nsLoadGroup.h b/netwerk/base/nsLoadGroup.h
index 20dd94cf9..9b5e70868 100644
--- a/netwerk/base/nsLoadGroup.h
+++ b/netwerk/base/nsLoadGroup.h
@@ -62,11 +62,6 @@ protected:
nsresult MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& flags);
nsresult MergeDefaultLoadFlags(nsIRequest *aRequest, nsLoadFlags& flags);
-private:
- void TelemetryReport();
- void TelemetryReportChannel(nsITimedChannel *timedChannel,
- bool defaultRequest);
-
protected:
uint32_t mForegroundCount;
uint32_t mLoadFlags;
@@ -87,12 +82,6 @@ protected:
int32_t mPriority;
bool mIsCanceling;
- /* Telemetry */
- mozilla::TimeStamp mDefaultRequestCreationTime;
- bool mDefaultLoadIsTimed;
- uint32_t mTimedRequests;
- uint32_t mCachedRequests;
-
/* For nsPILoadGroupInternal */
uint32_t mTimedNonCachedRequestsUntilOnEndPageLoad;
};
diff --git a/netwerk/base/nsSocketTransport2.cpp b/netwerk/base/nsSocketTransport2.cpp
index f9b55ead4..0c8434813 100644
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -7,7 +7,6 @@
#include "nsSocketTransport2.h"
#include "mozilla/Attributes.h"
-#include "mozilla/Telemetry.h"
#include "nsIOService.h"
#include "nsStreamUtils.h"
#include "nsNetSegmentUtils.h"
@@ -1226,8 +1225,7 @@ nsSocketTransport::BuildSocket(PRFileDesc *&fd, bool &proxyTransparent, bool &us
if (NS_FAILED(rv)) {
SOCKET_LOG((" error pushing io layer [%u:%s rv=%x]\n", i, mTypes[i], rv));
if (fd) {
- CloseSocket(fd,
- mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase());
+ CloseSocket(fd);
}
}
}
@@ -1395,8 +1393,7 @@ nsSocketTransport::InitiateSocket()
// inform socket transport about this newly created socket...
rv = mSocketTransportService->AttachSocket(fd, this);
if (NS_FAILED(rv)) {
- CloseSocket(fd,
- mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase());
+ CloseSocket(fd);
return rv;
}
mAttached = true;
@@ -1453,26 +1450,8 @@ nsSocketTransport::InitiateSocket()
}
#endif
- // We use PRIntervalTime here because we need
- // nsIOService::LastOfflineStateChange time and
- // nsIOService::LastConectivityChange time to be atomic.
- PRIntervalTime connectStarted = 0;
- if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) {
- connectStarted = PR_IntervalNow();
- }
-
status = PR_Connect(fd, &prAddr, NS_SOCKET_CONNECT_TIMEOUT);
- if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase() &&
- connectStarted) {
- SendPRBlockingTelemetry(connectStarted,
- Telemetry::PRCONNECT_BLOCKING_TIME_NORMAL,
- Telemetry::PRCONNECT_BLOCKING_TIME_SHUTDOWN,
- Telemetry::PRCONNECT_BLOCKING_TIME_CONNECTIVITY_CHANGE,
- Telemetry::PRCONNECT_BLOCKING_TIME_LINK_CHANGE,
- Telemetry::PRCONNECT_BLOCKING_TIME_OFFLINE);
- }
-
if (status == PR_SUCCESS) {
//
// we are connected!
@@ -1531,16 +1510,6 @@ nsSocketTransport::InitiateSocket()
// The connection was refused...
//
else {
- if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase() &&
- connectStarted) {
- SendPRBlockingTelemetry(connectStarted,
- Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_NORMAL,
- Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_SHUTDOWN,
- Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_CONNECTIVITY_CHANGE,
- Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_LINK_CHANGE,
- Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_OFFLINE);
- }
-
rv = ErrorAccordingToNSPR(code);
if ((rv == NS_ERROR_CONNECTION_REFUSED) && !mProxyHost.IsEmpty())
rv = NS_ERROR_PROXY_CONNECTION_REFUSED;
@@ -1763,8 +1732,7 @@ public:
NS_IMETHOD Run() override
{
- nsSocketTransport::CloseSocket(mFD,
- gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase());
+ nsSocketTransport::CloseSocket(mFD);
return NS_OK;
}
private:
@@ -1801,8 +1769,7 @@ nsSocketTransport::ReleaseFD_Locked(PRFileDesc *fd)
SOCKET_LOG(("Intentional leak"));
} else if (PR_GetCurrentThread() == gSocketThread) {
SOCKET_LOG(("nsSocketTransport: calling PR_Close [this=%p]\n", this));
- CloseSocket(mFD,
- mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase());
+ CloseSocket(mFD);
} else {
// Can't PR_Close() a socket off STS thread. Thunk it to STS to die
STS_PRCloseOnSocketTransport(mFD);
@@ -1960,26 +1927,7 @@ nsSocketTransport::OnSocketReady(PRFileDesc *fd, int16_t outFlags)
// We do not need to do PR_ConnectContinue when we are already
// shutting down.
- // We use PRIntervalTime here because we need
- // nsIOService::LastOfflineStateChange time and
- // nsIOService::LastConectivityChange time to be atomic.
- PRIntervalTime connectStarted = 0;
- if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) {
- connectStarted = PR_IntervalNow();
- }
-
PRStatus status = PR_ConnectContinue(fd, outFlags);
-
- if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase() &&
- connectStarted) {
- SendPRBlockingTelemetry(connectStarted,
- Telemetry::PRCONNECTCONTINUE_BLOCKING_TIME_NORMAL,
- Telemetry::PRCONNECTCONTINUE_BLOCKING_TIME_SHUTDOWN,
- Telemetry::PRCONNECTCONTINUE_BLOCKING_TIME_CONNECTIVITY_CHANGE,
- Telemetry::PRCONNECTCONTINUE_BLOCKING_TIME_LINK_CHANGE,
- Telemetry::PRCONNECTCONTINUE_BLOCKING_TIME_OFFLINE);
- }
-
if (status == PR_SUCCESS) {
//
// we are connected!
@@ -3144,41 +3092,13 @@ nsSocketTransport::PRFileDescAutoLock::SetKeepaliveVals(bool aEnabled,
}
void
-nsSocketTransport::CloseSocket(PRFileDesc *aFd, bool aTelemetryEnabled)
+nsSocketTransport::CloseSocket(PRFileDesc *aFd)
{
#if defined(XP_WIN)
AttachShutdownLayer(aFd);
#endif
- // We use PRIntervalTime here because we need
- // nsIOService::LastOfflineStateChange time and
- // nsIOService::LastConectivityChange time to be atomic.
- PRIntervalTime closeStarted;
- if (aTelemetryEnabled) {
- closeStarted = PR_IntervalNow();
- }
-
PR_Close(aFd);
-
- if (aTelemetryEnabled) {
- SendPRBlockingTelemetry(closeStarted,
- Telemetry::PRCLOSE_TCP_BLOCKING_TIME_NORMAL,
- Telemetry::PRCLOSE_TCP_BLOCKING_TIME_SHUTDOWN,
- Telemetry::PRCLOSE_TCP_BLOCKING_TIME_CONNECTIVITY_CHANGE,
- Telemetry::PRCLOSE_TCP_BLOCKING_TIME_LINK_CHANGE,
- Telemetry::PRCLOSE_TCP_BLOCKING_TIME_OFFLINE);
- }
-}
-
-void
-nsSocketTransport::SendPRBlockingTelemetry(PRIntervalTime aStart,
- Telemetry::ID aIDNormal,
- Telemetry::ID aIDShutdown,
- Telemetry::ID aIDConnectivityChange,
- Telemetry::ID aIDLinkChange,
- Telemetry::ID aIDOffline)
-{
- /* STUB */
}
} // namespace net
diff --git a/netwerk/base/nsSocketTransport2.h b/netwerk/base/nsSocketTransport2.h
index 7c85ccdc4..310cc58d3 100644
--- a/netwerk/base/nsSocketTransport2.h
+++ b/netwerk/base/nsSocketTransport2.h
@@ -22,7 +22,6 @@
#include "nsIClassInfo.h"
#include "mozilla/net/DNS.h"
#include "nsASocketHandler.h"
-#include "mozilla/Telemetry.h"
#include "prerror.h"
#include "nsAutoPtr.h"
@@ -169,13 +168,7 @@ public:
uint64_t ByteCountReceived() override { return mInput.ByteCount(); }
uint64_t ByteCountSent() override { return mOutput.ByteCount(); }
- static void CloseSocket(PRFileDesc *aFd, bool aTelemetryEnabled);
- static void SendPRBlockingTelemetry(PRIntervalTime aStart,
- Telemetry::ID aIDNormal,
- Telemetry::ID aIDShutdown,
- Telemetry::ID aIDConnectivityChange,
- Telemetry::ID aIDLinkChange,
- Telemetry::ID aIDOffline);
+ static void CloseSocket(PRFileDesc *aFd);
protected:
virtual ~nsSocketTransport();
diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp
index 739388b0f..af5742564 100644
--- a/netwerk/base/nsSocketTransportService2.cpp
+++ b/netwerk/base/nsSocketTransportService2.cpp
@@ -22,7 +22,6 @@
#include "mozilla/PublicSSL.h"
#include "mozilla/ChaosMode.h"
#include "mozilla/PodOperations.h"
-#include "mozilla/Telemetry.h"
#include "nsThreadUtils.h"
#include "nsIFile.h"
#include "nsIWidget.h"
@@ -47,7 +46,6 @@ Atomic<PRThread*, Relaxed> gSocketThread;
#define SOCKET_LIMIT_MIN 50U
#define BLIP_INTERVAL_PREF "network.activity.blipIntervalMilliseconds"
#define MAX_TIME_BETWEEN_TWO_POLLS "network.sts.max_time_for_events_between_two_polls"
-#define TELEMETRY_PREF "toolkit.telemetry.enabled"
#define MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN "network.sts.max_time_for_pr_close_during_shutdown"
#define REPAIR_POLLABLE_EVENT_TIME 10
@@ -79,9 +77,7 @@ nsSocketTransportService::nsSocketTransportService()
, mKeepaliveEnabledPref(false)
, mServingPendingQueue(false)
, mMaxTimePerPollIter(100)
- , mTelemetryEnabledPref(false)
, mMaxTimeForPrClosePref(PR_SecondsToInterval(5))
- , mSleepPhase(false)
, mProbedMaxCount(false)
#if defined(XP_WIN)
, mPolling(false)
@@ -211,16 +207,9 @@ nsSocketTransportService::AttachSocket(PRFileDesc *fd, nsASocketHandler *handler
bool
nsSocketTransportService::CanAttachSocket()
{
- static bool reported900FDLimit = false;
-
uint32_t total = mActiveCount + mIdleCount;
bool rv = total < gMaxCount;
- if (mTelemetryEnabledPref &&
- (((total >= 900) || !rv) && !reported900FDLimit)) {
- reported900FDLimit = true;
- }
-
return rv;
}
@@ -438,13 +427,11 @@ nsSocketTransportService::PollTimeout()
}
int32_t
-nsSocketTransportService::Poll(uint32_t *interval,
- TimeDuration *pollDuration)
+nsSocketTransportService::Poll(uint32_t *interval)
{
PRPollDesc *pollList;
uint32_t pollCount;
PRIntervalTime pollTimeout;
- *pollDuration = 0;
// If there are pending events for this thread then
// DoPollIteration() should service the network without blocking.
@@ -470,8 +457,6 @@ nsSocketTransportService::Poll(uint32_t *interval,
PRIntervalTime ts = PR_IntervalNow();
- TimeStamp pollStart;
-
SOCKET_LOG((" timeout = %i milliseconds\n",
PR_IntervalToMilliseconds(pollTimeout)));
int32_t rv = PR_Poll(pollList, pollCount, pollTimeout);
@@ -530,7 +515,6 @@ nsSocketTransportService::Init()
tmpPrefService->AddObserver(KEEPALIVE_RETRY_INTERVAL_PREF, this, false);
tmpPrefService->AddObserver(KEEPALIVE_PROBE_COUNT_PREF, this, false);
tmpPrefService->AddObserver(MAX_TIME_BETWEEN_TWO_POLLS, this, false);
- tmpPrefService->AddObserver(TELEMETRY_PREF, this, false);
tmpPrefService->AddObserver(MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN, this, false);
}
UpdatePrefs();
@@ -539,8 +523,6 @@ nsSocketTransportService::Init()
if (obsSvc) {
obsSvc->AddObserver(this, "profile-initial-state", false);
obsSvc->AddObserver(this, "last-pb-context-exited", false);
- obsSvc->AddObserver(this, NS_WIDGET_SLEEP_OBSERVER_TOPIC, true);
- obsSvc->AddObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC, true);
obsSvc->AddObserver(this, "xpcom-shutdown-threads", false);
}
@@ -607,16 +589,9 @@ nsSocketTransportService::ShutdownThread()
if (obsSvc) {
obsSvc->RemoveObserver(this, "profile-initial-state");
obsSvc->RemoveObserver(this, "last-pb-context-exited");
- obsSvc->RemoveObserver(this, NS_WIDGET_SLEEP_OBSERVER_TOPIC);
- obsSvc->RemoveObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC);
obsSvc->RemoveObserver(this, "xpcom-shutdown-threads");
}
- if (mAfterWakeUpTimer) {
- mAfterWakeUpTimer->Cancel();
- mAfterWakeUpTimer = nullptr;
- }
-
NetworkActivityMonitor::Shutdown();
mInitialized = false;
@@ -851,24 +826,16 @@ nsSocketTransportService::Run()
// make sure the pseudo random number generator is seeded on this thread
srand(static_cast<unsigned>(PR_Now()));
- // Time blocked in poll().
- TimeDuration singlePollDuration;
-
int numberOfPendingEvents;
// If there is too many pending events queued, we will run some poll()
- // between them and the following variable is cumulative time spent
- // blocking in poll().
- TimeDuration pollDuration;
-
+ // between them.
for (;;) {
bool pendingEvents = false;
-
numberOfPendingEvents = 0;
- pollDuration = 0;
do {
- DoPollIteration(&singlePollDuration);
+ DoPollIteration();
mRawThread->HasPendingEvents(&pendingEvents);
if (pendingEvents) {
@@ -959,7 +926,7 @@ nsSocketTransportService::Reset(bool aGuardLocals)
}
nsresult
-nsSocketTransportService::DoPollIteration(TimeDuration *pollDuration)
+nsSocketTransportService::DoPollIteration()
{
SOCKET_LOG(("STS poll iter\n"));
@@ -1019,13 +986,12 @@ nsSocketTransportService::DoPollIteration(TimeDuration *pollDuration)
// Measures seconds spent while blocked on PR_Poll
uint32_t pollInterval = 0;
int32_t n = 0;
- *pollDuration = 0;
if (!gIOService->IsNetTearingDown()) {
// Let's not do polling during shutdown.
#if defined(XP_WIN)
StartPolling();
#endif
- n = Poll(&pollInterval, pollDuration);
+ n = Poll(&pollInterval);
#if defined(XP_WIN)
EndPolling();
#endif
@@ -1171,13 +1137,6 @@ nsSocketTransportService::UpdatePrefs()
mMaxTimePerPollIter = maxTimePref;
}
- bool telemetryPref = false;
- rv = tmpPrefService->GetBoolPref(TELEMETRY_PREF,
- &telemetryPref);
- if (NS_SUCCEEDED(rv)) {
- mTelemetryEnabledPref = telemetryPref;
- }
-
int32_t maxTimeForPrClosePref;
rv = tmpPrefService->GetIntPref(MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN,
&maxTimeForPrClosePref);
@@ -1255,10 +1214,6 @@ nsSocketTransportService::Observe(nsISupports *subject,
if (!strcmp(topic, NS_TIMER_CALLBACK_TOPIC)) {
nsCOMPtr<nsITimer> timer = do_QueryInterface(subject);
- if (timer == mAfterWakeUpTimer) {
- mAfterWakeUpTimer = nullptr;
- mSleepPhase = false;
- }
#if defined(XP_WIN)
if (timer == mPollRepairTimer) {
@@ -1266,19 +1221,6 @@ nsSocketTransportService::Observe(nsISupports *subject,
}
#endif
- } else if (!strcmp(topic, NS_WIDGET_SLEEP_OBSERVER_TOPIC)) {
- mSleepPhase = true;
- if (mAfterWakeUpTimer) {
- mAfterWakeUpTimer->Cancel();
- mAfterWakeUpTimer = nullptr;
- }
- } else if (!strcmp(topic, NS_WIDGET_WAKE_OBSERVER_TOPIC)) {
- if (mSleepPhase && !mAfterWakeUpTimer) {
- mAfterWakeUpTimer = do_CreateInstance("@mozilla.org/timer;1");
- if (mAfterWakeUpTimer) {
- mAfterWakeUpTimer->Init(this, 2000, nsITimer::TYPE_ONE_SHOT);
- }
- }
} else if (!strcmp(topic, "xpcom-shutdown-threads")) {
ShutdownThread();
}
diff --git a/netwerk/base/nsSocketTransportService2.h b/netwerk/base/nsSocketTransportService2.h
index 81c806793..0b88a6535 100644
--- a/netwerk/base/nsSocketTransportService2.h
+++ b/netwerk/base/nsSocketTransportService2.h
@@ -118,8 +118,6 @@ public:
// Returns true if keepalives are enabled in prefs.
bool IsKeepaliveEnabled() { return mKeepaliveEnabledPref; }
- bool IsTelemetryEnabledAndNotSleepPhase() { return mTelemetryEnabledPref &&
- !mSleepPhase; }
PRIntervalTime MaxTimeForPrClosePref() {return mMaxTimeForPrClosePref; }
protected:
@@ -191,7 +189,7 @@ private:
bool GrowActiveList();
bool GrowIdleList();
- void InitMaxCount();
+ void InitMaxCount();
// Total bytes number transfered through all the sockets except active ones
uint64_t mSentBytesCount;
@@ -206,15 +204,12 @@ private:
PRPollDesc *mPollList; /* mListSize + 1 entries */
PRIntervalTime PollTimeout(); // computes ideal poll timeout
- nsresult DoPollIteration(TimeDuration *pollDuration);
+ nsresult DoPollIteration();
// perfoms a single poll iteration
- int32_t Poll(uint32_t *interval,
- TimeDuration *pollDuration);
+ int32_t Poll(uint32_t *interval);
// calls PR_Poll. the out param
// interval indicates the poll
// duration in seconds.
- // pollDuration is used only for
- // telemetry
//-------------------------------------------------------------------------
// pending socket queue - see NotifyWhenCanAttachSocket
@@ -236,14 +231,8 @@ private:
Atomic<bool> mServingPendingQueue;
Atomic<int32_t, Relaxed> mMaxTimePerPollIter;
- Atomic<bool, Relaxed> mTelemetryEnabledPref;
Atomic<PRIntervalTime, Relaxed> mMaxTimeForPrClosePref;
- // Between a computer going to sleep and waking up the PR_*** telemetry
- // will be corrupted - so do not record it.
- Atomic<bool, Relaxed> mSleepPhase;
- nsCOMPtr<nsITimer> mAfterWakeUpTimer;
-
void OnKeepaliveEnabledPrefChange();
void NotifyKeepaliveEnabledPrefChange(SocketContext *sock);
diff --git a/netwerk/base/nsUDPSocket.cpp b/netwerk/base/nsUDPSocket.cpp
index 445b62d9c..06ecbf9ee 100644
--- a/netwerk/base/nsUDPSocket.cpp
+++ b/netwerk/base/nsUDPSocket.cpp
@@ -7,7 +7,6 @@
#include "mozilla/EndianUtils.h"
#include "mozilla/dom/TypedArray.h"
#include "mozilla/HoldDropJSObjects.h"
-#include "mozilla/Telemetry.h"
#include "nsSocketTransport2.h"
#include "nsUDPSocket.h"
@@ -275,7 +274,6 @@ void
nsUDPSocket::AddOutputBytes(uint64_t aBytes)
{
mByteWriteCount += aBytes;
- SaveNetworkStats(false);
}
void
@@ -465,7 +463,6 @@ nsUDPSocket::OnSocketReady(PRFileDesc *fd, int16_t outFlags)
return;
}
mByteReadCount += count;
- SaveNetworkStats(false);
FallibleTArray<uint8_t> data;
if (!data.AppendElements(buff, count, fallible)) {
@@ -512,7 +509,6 @@ nsUDPSocket::OnSocketDetached(PRFileDesc *fd)
NS_ASSERTION(mFD == fd, "wrong file descriptor");
CloseSocket();
}
- SaveNetworkStats(true);
if (mListener)
{
@@ -726,7 +722,6 @@ nsUDPSocket::Close()
// expects this happen synchronously.
CloseSocket();
- SaveNetworkStats(true);
return NS_OK;
}
}
@@ -755,12 +750,6 @@ nsUDPSocket::GetLocalAddr(nsINetAddr * *aResult)
}
void
-nsUDPSocket::SaveNetworkStats(bool aEnforce)
-{
- /*** STUB ***/
-}
-
-void
nsUDPSocket::CloseSocket()
{
if (mFD) {
diff --git a/netwerk/base/nsUDPSocket.h b/netwerk/base/nsUDPSocket.h
index f8ae87cee..2910a49dd 100644
--- a/netwerk/base/nsUDPSocket.h
+++ b/netwerk/base/nsUDPSocket.h
@@ -53,8 +53,6 @@ private:
const PRNetAddr& aIface);
nsresult SetMulticastInterfaceInternal(const PRNetAddr& aIface);
- void SaveNetworkStats(bool aEnforce);
-
void CloseSocket();
// lock protects access to mListener;