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 --- toolkit/components/alerts/nsXULAlerts.cpp | 15 --- .../components/downloads/ApplicationReputation.cpp | 8 -- .../perfmonitoring/nsPerformanceStats.cpp | 16 --- .../components/perfmonitoring/nsPerformanceStats.h | 15 --- toolkit/components/places/Database.cpp | 2 +- toolkit/components/places/Helpers.cpp | 7 -- toolkit/components/places/Helpers.h | 21 ---- toolkit/components/places/nsNavHistory.cpp | 4 +- .../components/telemetry/TelemetryHistogram.cpp | 32 ------ .../nsUrlClassifierStreamUpdater.cpp | 110 --------------------- 10 files changed, 2 insertions(+), 228 deletions(-) (limited to 'toolkit') diff --git a/toolkit/components/alerts/nsXULAlerts.cpp b/toolkit/components/alerts/nsXULAlerts.cpp index 882617637..d353d8714 100644 --- a/toolkit/components/alerts/nsXULAlerts.cpp +++ b/toolkit/components/alerts/nsXULAlerts.cpp @@ -18,7 +18,6 @@ #include "nsIWindowWatcher.h" using namespace mozilla; -using mozilla::dom::NotificationTelemetryService; #define ALERT_CHROME_URL "chrome://global/content/alerts/alert.xul" @@ -185,20 +184,6 @@ nsXULAlerts::ShowAlertWithIconURI(nsIAlertNotification* aAlert, NS_ENSURE_SUCCESS(rv, rv); if (mDoNotDisturb) { - if (!inPrivateBrowsing) { - RefPtr telemetry = - NotificationTelemetryService::GetInstance(); - if (telemetry) { - // Record the number of unique senders for XUL alerts. The OS X and - // libnotify backends will fire `alertshow` even if "do not disturb" - // is enabled. In that case, `NotificationObserver` will record the - // sender. - nsCOMPtr principal; - if (NS_SUCCEEDED(aAlert->GetPrincipal(getter_AddRefs(principal)))) { - Unused << NS_WARN_IF(NS_FAILED(telemetry->RecordSender(principal))); - } - } - } if (aAlertListener) aAlertListener->Observe(nullptr, "alertfinished", cookie.get()); return NS_OK; diff --git a/toolkit/components/downloads/ApplicationReputation.cpp b/toolkit/components/downloads/ApplicationReputation.cpp index a369ca884..9fdc8a103 100644 --- a/toolkit/components/downloads/ApplicationReputation.cpp +++ b/toolkit/components/downloads/ApplicationReputation.cpp @@ -117,14 +117,6 @@ private: friend class PendingDBLookup; - // Telemetry states. - // Status of the remote response (valid or not). - enum SERVER_RESPONSE_TYPES { - SERVER_RESPONSE_VALID = 0, - SERVER_RESPONSE_FAILED = 1, - SERVER_RESPONSE_INVALID = 2, - }; - // Number of blocklist and allowlist hits we have seen. uint32_t mBlocklistCount; uint32_t mAllowlistCount; diff --git a/toolkit/components/perfmonitoring/nsPerformanceStats.cpp b/toolkit/components/perfmonitoring/nsPerformanceStats.cpp index 33aeaf7c2..6c470356a 100644 --- a/toolkit/components/perfmonitoring/nsPerformanceStats.cpp +++ b/toolkit/components/perfmonitoring/nsPerformanceStats.cpp @@ -662,9 +662,6 @@ nsPerformanceStatsService::nsPerformanceStatsService() nsPerformanceGroup::GroupScope::RUNTIME // scope )) , mIsHandlingUserInput(false) - , mProcessStayed(0) - , mProcessMoved(0) - , mProcessUpdateCounter(0) , mIsMonitoringPerCompartment(false) , mJankAlertThreshold(mozilla::MaxValue::value) // By default, no alerts , mJankAlertBufferingDelay(1000 /* ms */) @@ -953,13 +950,6 @@ nsPerformanceStatsService::SetJankAlertBufferingDelay(uint32_t value) { return NS_OK; } -nsresult -nsPerformanceStatsService::UpdateTelemetry() -{ - /* STUB */ - return NS_OK; -} - /* static */ nsIPerformanceStats* nsPerformanceStatsService::GetStatsForGroup(const js::PerformanceGroup* group) @@ -992,12 +982,6 @@ nsPerformanceStatsService::GetSnapshot(JSContext* cx, nsIPerformanceSnapshot * * } } - js::GetPerfMonitoringTestCpuRescheduling(cx, &mProcessStayed, &mProcessMoved); - - if (++mProcessUpdateCounter % 10 == 0) { - mozilla::Unused << UpdateTelemetry(); - } - snapshot.forget(aSnapshot); return NS_OK; diff --git a/toolkit/components/perfmonitoring/nsPerformanceStats.h b/toolkit/components/perfmonitoring/nsPerformanceStats.h index c82a3e92c..6902c840d 100644 --- a/toolkit/components/perfmonitoring/nsPerformanceStats.h +++ b/toolkit/components/perfmonitoring/nsPerformanceStats.h @@ -363,21 +363,6 @@ protected: nsPerformanceGroup* group); - - - /********************************************************** - * - * To check whether our algorithm makes sense, we keep count of the - * number of times the process has been rescheduled to another CPU - * while we were monitoring the performance of a group and we upload - * this data through Telemetry. - */ - nsresult UpdateTelemetry(); - - uint64_t mProcessStayed; - uint64_t mProcessMoved; - uint32_t mProcessUpdateCounter; - /********************************************************** * * Options controlling measurements. diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index a87c14b37..08c382377 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -597,7 +597,7 @@ Database::BackupAndReplaceDatabaseFile(nsCOMPtr& aStorage) // If anything fails from this point on, we have a stale connection or // database file, and there's not much more we can do. // The only thing we can try to do is to replace the database on the next - // startup, and report the problem through telemetry. + // startup. { enum eCorruptDBReplaceStage : int8_t { stage_closing = 0, diff --git a/toolkit/components/places/Helpers.cpp b/toolkit/components/places/Helpers.cpp index dda162197..13e040bfd 100644 --- a/toolkit/components/places/Helpers.cpp +++ b/toolkit/components/places/Helpers.cpp @@ -382,12 +382,5 @@ AsyncStatementCallbackNotifier::HandleCompletion(uint16_t aReason) //////////////////////////////////////////////////////////////////////////////// //// AsyncStatementCallbackNotifier -NS_IMETHODIMP -AsyncStatementTelemetryTimer::HandleCompletion(uint16_t aReason) -{ - /* STUB */ - return NS_OK; -} - } // namespace places } // namespace mozilla diff --git a/toolkit/components/places/Helpers.h b/toolkit/components/places/Helpers.h index 654e42539..4e79abc75 100644 --- a/toolkit/components/places/Helpers.h +++ b/toolkit/components/places/Helpers.h @@ -15,7 +15,6 @@ #include "nsThreadUtils.h" #include "nsProxyRelease.h" #include "prtime.h" -#include "mozilla/Telemetry.h" namespace mozilla { namespace places { @@ -270,26 +269,6 @@ private: const char* mTopic; }; -/** - * Used to notify a topic to system observers on async execute completion. - */ -class AsyncStatementTelemetryTimer : public AsyncStatementCallback -{ -public: - explicit AsyncStatementTelemetryTimer(Telemetry::ID aHistogramId, - TimeStamp aStart = TimeStamp::Now()) - : mHistogramId(aHistogramId) - , mStart(aStart) - { - } - - NS_IMETHOD HandleCompletion(uint16_t aReason); - -private: - const Telemetry::ID mHistogramId; - const TimeStamp mStart; -}; - } // namespace places } // namespace mozilla diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp index 49d911d65..e72526022 100644 --- a/toolkit/components/places/nsNavHistory.cpp +++ b/toolkit/components/places/nsNavHistory.cpp @@ -3063,17 +3063,15 @@ nsNavHistory::Observe(nsISupports *aSubject, const char *aTopic, namespace { -class DecayFrecencyCallback : public AsyncStatementTelemetryTimer +class DecayFrecencyCallback : public AsyncStatementCallback { public: DecayFrecencyCallback() - : AsyncStatementTelemetryTimer(Telemetry::PLACES_IDLE_FRECENCY_DECAY_TIME_MS) { } NS_IMETHOD HandleCompletion(uint16_t aReason) { - (void)AsyncStatementTelemetryTimer::HandleCompletion(aReason); if (aReason == REASON_FINISHED) { nsNavHistory *navHistory = nsNavHistory::GetHistoryService(); NS_ENSURE_STATE(navHistory); diff --git a/toolkit/components/telemetry/TelemetryHistogram.cpp b/toolkit/components/telemetry/TelemetryHistogram.cpp index ba0288979..c97367a36 100644 --- a/toolkit/components/telemetry/TelemetryHistogram.cpp +++ b/toolkit/components/telemetry/TelemetryHistogram.cpp @@ -2689,37 +2689,5 @@ TelemetryHistogram::IPCTimerFired(nsITimer* aTimer, void* aClosure) } } - switch (XRE_GetProcessType()) { - case GeckoProcessType_Content: { - mozilla::dom::ContentChild* contentChild = mozilla::dom::ContentChild::GetSingleton(); - mozilla::Unused << NS_WARN_IF(!contentChild); - if (contentChild) { - if (accumulationsToSend.Length()) { - mozilla::Unused << - NS_WARN_IF(!contentChild->SendAccumulateChildHistogram(accumulationsToSend)); - } - if (keyedAccumulationsToSend.Length()) { - mozilla::Unused << - NS_WARN_IF(!contentChild->SendAccumulateChildKeyedHistogram(keyedAccumulationsToSend)); - } - } - break; - } - case GeckoProcessType_GPU: { - if (mozilla::gfx::GPUParent* gpu = mozilla::gfx::GPUParent::GetSingleton()) { - if (accumulationsToSend.Length()) { - mozilla::Unused << gpu->SendAccumulateChildHistogram(accumulationsToSend); - } - if (keyedAccumulationsToSend.Length()) { - mozilla::Unused << gpu->SendAccumulateChildKeyedHistogram(keyedAccumulationsToSend); - } - } - break; - } - default: - MOZ_ASSERT_UNREACHABLE("Unsupported process type"); - break; - } - gIPCTimerArmed = false; } diff --git a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp index e230f6951..9319822d5 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp @@ -20,7 +20,6 @@ #include "mozilla/Logging.h" #include "nsIInterfaceRequestor.h" #include "mozilla/LoadContext.h" -#include "mozilla/Telemetry.h" #include "nsContentUtils.h" #include "nsIURLFormatter.h" @@ -503,115 +502,6 @@ nsUrlClassifierStreamUpdater::AddRequestBody(const nsACString &aRequestBody) return NS_OK; } -// Map the HTTP response code to a Telemetry bucket -static uint32_t HTTPStatusToBucket(uint32_t status) -{ - uint32_t statusBucket; - switch (status) { - case 100: - case 101: - // Unexpected 1xx return code - statusBucket = 0; - break; - case 200: - // OK - Data is available in the HTTP response body. - statusBucket = 1; - break; - case 201: - case 202: - case 203: - case 205: - case 206: - // Unexpected 2xx return code - statusBucket = 2; - break; - case 204: - // No Content - statusBucket = 3; - break; - case 300: - case 301: - case 302: - case 303: - case 304: - case 305: - case 307: - case 308: - // Unexpected 3xx return code - statusBucket = 4; - break; - case 400: - // Bad Request - The HTTP request was not correctly formed. - // The client did not provide all required CGI parameters. - statusBucket = 5; - break; - case 401: - case 402: - case 405: - case 406: - case 407: - case 409: - case 410: - case 411: - case 412: - case 414: - case 415: - case 416: - case 417: - case 421: - case 426: - case 428: - case 429: - case 431: - case 451: - // Unexpected 4xx return code - statusBucket = 6; - break; - case 403: - // Forbidden - The client id is invalid. - statusBucket = 7; - break; - case 404: - // Not Found - statusBucket = 8; - break; - case 408: - // Request Timeout - statusBucket = 9; - break; - case 413: - // Request Entity Too Large - Bug 1150334 - statusBucket = 10; - break; - case 500: - case 501: - case 510: - // Unexpected 5xx return code - statusBucket = 11; - break; - case 502: - case 504: - case 511: - // Local network errors, we'll ignore these. - statusBucket = 12; - break; - case 503: - // Service Unavailable - The server cannot handle the request. - // Clients MUST follow the backoff behavior specified in the - // Request Frequency section. - statusBucket = 13; - break; - case 505: - // HTTP Version Not Supported - The server CANNOT handle the requested - // protocol major version. - statusBucket = 14; - break; - default: - statusBucket = 15; - }; - return statusBucket; -} - /////////////////////////////////////////////////////////////////////////////// // nsIStreamListenerObserver implementation -- cgit v1.2.3