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/nsSocketTransportService2.cpp | 43 ------------------------------ 1 file changed, 43 deletions(-) (limited to 'netwerk/base/nsSocketTransportService2.cpp') 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 -- cgit v1.2.3 From 81b341a9b37acae2b60e0334a9b0846bc5be8445 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sat, 29 Sep 2018 23:20:36 +0200 Subject: Clean up a number of unused variables. Tag #21. --- netwerk/base/nsSocketTransportService2.cpp | 36 ------------------------------ 1 file changed, 36 deletions(-) (limited to 'netwerk/base/nsSocketTransportService2.cpp') diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index 72afdc9e1..739388b0f 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -471,9 +471,6 @@ nsSocketTransportService::Poll(uint32_t *interval, PRIntervalTime ts = PR_IntervalNow(); TimeStamp pollStart; - if (mTelemetryEnabledPref) { - pollStart = TimeStamp::NowLoRes(); - } SOCKET_LOG((" timeout = %i milliseconds\n", PR_IntervalToMilliseconds(pollTimeout))); @@ -481,10 +478,6 @@ nsSocketTransportService::Poll(uint32_t *interval, PRIntervalTime passedInterval = PR_IntervalNow() - ts; - if (mTelemetryEnabledPref && !pollStart.IsNull()) { - *pollDuration = TimeStamp::NowLoRes() - pollStart; - } - SOCKET_LOG((" ...returned after %i milliseconds\n", PR_IntervalToMilliseconds(passedInterval))); @@ -858,20 +851,9 @@ nsSocketTransportService::Run() // make sure the pseudo random number generator is seeded on this thread srand(static_cast(PR_Now())); - // For the calculation of the duration of the last cycle (i.e. the last for-loop - // iteration before shutdown). - TimeStamp startOfCycleForLastCycleCalc; - int numberOfPendingEventsLastCycle; - - // For measuring of the poll iteration duration without time spent blocked - // in poll(). - TimeStamp pollCycleStart; // Time blocked in poll(). TimeDuration singlePollDuration; - // For calculating the time needed for a new element to run. - TimeStamp startOfIteration; - TimeStamp startOfNextIteration; int numberOfPendingEvents; // If there is too many pending events queued, we will run some poll() @@ -883,18 +865,9 @@ nsSocketTransportService::Run() bool pendingEvents = false; numberOfPendingEvents = 0; - numberOfPendingEventsLastCycle = 0; - if (mTelemetryEnabledPref) { - startOfCycleForLastCycleCalc = TimeStamp::NowLoRes(); - startOfNextIteration = TimeStamp::NowLoRes(); - } pollDuration = 0; do { - if (mTelemetryEnabledPref) { - pollCycleStart = TimeStamp::NowLoRes(); - } - DoPollIteration(&singlePollDuration); mRawThread->HasPendingEvents(&pendingEvents); @@ -909,15 +882,6 @@ nsSocketTransportService::Run() } else { mServingPendingQueue = true; } - - if (mTelemetryEnabledPref) { - startOfIteration = startOfNextIteration; - // Everything that comes after this point will - // be served in the next iteration. If no even - // arrives, startOfNextIteration will be reset at the - // beginning of each for-loop. - startOfNextIteration = TimeStamp::NowLoRes(); - } } TimeStamp eventQueueStart = TimeStamp::NowLoRes(); do { -- cgit v1.2.3 From 5335681cd2ab05ad47e81be7722c9eee19d54065 Mon Sep 17 00:00:00 2001 From: adeshkp Date: Sat, 12 Jan 2019 06:20:31 -0500 Subject: Telemetry: Remove stubs and related code --- netwerk/base/nsSocketTransportService2.cpp | 68 +++--------------------------- 1 file changed, 5 insertions(+), 63 deletions(-) (limited to 'netwerk/base/nsSocketTransportService2.cpp') 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 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(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 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(); } -- cgit v1.2.3