summaryrefslogtreecommitdiffstats
path: root/toolkit/components
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components')
-rw-r--r--toolkit/components/alerts/nsAlertsService.cpp4
-rw-r--r--toolkit/components/downloads/ApplicationReputation.cpp31
-rw-r--r--toolkit/components/osfile/modules/osfile_async_front.jsm4
-rw-r--r--toolkit/components/perfmonitoring/nsPerformanceStats.cpp18
-rw-r--r--toolkit/components/places/Database.cpp3
-rw-r--r--toolkit/components/places/FaviconHelpers.cpp28
-rw-r--r--toolkit/components/places/Helpers.cpp4
-rw-r--r--toolkit/components/places/UnifiedComplete.js14
-rw-r--r--toolkit/components/places/nsPlacesAutoComplete.js5
-rw-r--r--toolkit/components/search/current/nsSearchService.js6
-rw-r--r--toolkit/components/search/orginal/nsSearchService.js20
-rw-r--r--toolkit/components/startup/nsAppStartup.cpp12
-rw-r--r--toolkit/components/telemetry/TelemetryStopwatch.jsm335
-rw-r--r--toolkit/components/telemetry/moz.build1
-rw-r--r--toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js156
-rw-r--r--toolkit/components/telemetry/tests/unit/xpcshell.ini1
-rw-r--r--toolkit/components/url-classifier/Classifier.cpp8
-rw-r--r--toolkit/components/url-classifier/Entries.h2
-rw-r--r--toolkit/components/url-classifier/LookupCache.cpp9
-rw-r--r--toolkit/components/url-classifier/LookupCacheV4.cpp13
-rw-r--r--toolkit/components/url-classifier/VariableLengthPrefixSet.cpp13
-rw-r--r--toolkit/components/url-classifier/nsUrlClassifierDBService.cpp6
-rw-r--r--toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp16
-rw-r--r--toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp5
24 files changed, 32 insertions, 682 deletions
diff --git a/toolkit/components/alerts/nsAlertsService.cpp b/toolkit/components/alerts/nsAlertsService.cpp
index dd67ad983..73dbb265c 100644
--- a/toolkit/components/alerts/nsAlertsService.cpp
+++ b/toolkit/components/alerts/nsAlertsService.cpp
@@ -6,7 +6,6 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/Preferences.h"
-#include "mozilla/Telemetry.h"
#include "nsXULAppAPI.h"
#include "nsAlertsService.h"
@@ -292,9 +291,6 @@ NS_IMETHODIMP nsAlertsService::SetManualDoNotDisturb(bool aDoNotDisturb)
NS_ENSURE_TRUE(alertsDND, NS_ERROR_NOT_IMPLEMENTED);
nsresult rv = alertsDND->SetManualDoNotDisturb(aDoNotDisturb);
- if (NS_SUCCEEDED(rv)) {
- Telemetry::Accumulate(Telemetry::ALERTS_SERVICE_DND_ENABLED, 1);
- }
return rv;
#endif
}
diff --git a/toolkit/components/downloads/ApplicationReputation.cpp b/toolkit/components/downloads/ApplicationReputation.cpp
index 7bd219dbf..a369ca884 100644
--- a/toolkit/components/downloads/ApplicationReputation.cpp
+++ b/toolkit/components/downloads/ApplicationReputation.cpp
@@ -34,7 +34,6 @@
#include "mozilla/LoadContext.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
-#include "mozilla/Telemetry.h"
#include "mozilla/TimeStamp.h"
#include "nsAutoPtr.h"
@@ -59,7 +58,6 @@ using mozilla::DocShellOriginAttributes;
using mozilla::PrincipalOriginAttributes;
using mozilla::Preferences;
using mozilla::TimeStamp;
-using mozilla::Telemetry::Accumulate;
using safe_browsing::ClientDownloadRequest;
using safe_browsing::ClientDownloadRequest_CertificateChain;
using safe_browsing::ClientDownloadRequest_Resource;
@@ -356,7 +354,6 @@ PendingDBLookup::HandleEvent(const nsACString& tables)
Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE, &blockList);
if (!mAllowlistOnly && FindInReadable(blockList, tables)) {
mPendingLookup->mBlocklistCount++;
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, BLOCK_LIST);
LOG(("Found principal %s on blocklist [this = %p]", mSpec.get(), this));
return mPendingLookup->OnComplete(true, NS_OK,
nsIApplicationReputationService::VERDICT_DANGEROUS);
@@ -366,13 +363,11 @@ PendingDBLookup::HandleEvent(const nsACString& tables)
Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, &allowList);
if (FindInReadable(allowList, tables)) {
mPendingLookup->mAllowlistCount++;
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, ALLOW_LIST);
LOG(("Found principal %s on allowlist [this = %p]", mSpec.get(), this));
// Don't call onComplete, since blocklisting trumps allowlisting
} else {
LOG(("Didn't find principal %s on any list [this = %p]", mSpec.get(),
this));
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, NO_LIST);
}
return mPendingLookup->LookupNext();
}
@@ -1000,7 +995,7 @@ PendingLookup::GetSpecHash(nsACString& aSpec, nsACString& hexEncodedHash)
static const char* const hex = "0123456789ABCDEF";
hexEncodedHash.SetCapacity(2 * binaryHash.Length());
for (size_t i = 0; i < binaryHash.Length(); ++i) {
- auto c = static_cast<const unsigned char>(binaryHash[i]);
+ auto c = static_cast<unsigned char>(binaryHash[i]);
hexEncodedHash.Append(hex[(c >> 4) & 0x0F]);
hexEncodedHash.Append(hex[c & 0x0F]);
}
@@ -1144,8 +1139,6 @@ PendingLookup::OnComplete(bool shouldBlock, nsresult rv, uint32_t verdict)
mTimeoutTimer = nullptr;
}
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SHOULD_BLOCK,
- shouldBlock);
double t = (TimeStamp::Now() - mStartTime).ToMilliseconds();
LOG(("Application Reputation verdict is %lu, obtained in %f ms [this = %p]",
verdict, t, this));
@@ -1393,8 +1386,6 @@ PendingLookup::Notify(nsITimer* aTimer)
{
LOG(("Remote lookup timed out [this = %p]", this));
MOZ_ASSERT(aTimer == mTimeoutTimer);
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_REMOTE_LOOKUP_TIMEOUT,
- true);
mChannel->Cancel(NS_ERROR_NET_TIMEOUT);
mTimeoutTimer->Cancel();
return NS_OK;
@@ -1457,8 +1448,6 @@ PendingLookup::OnStopRequest(nsIRequest *aRequest,
bool shouldBlock = false;
uint32_t verdict = nsIApplicationReputationService::VERDICT_SAFE;
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_REMOTE_LOOKUP_TIMEOUT,
- false);
nsresult rv = OnStopRequestInternal(aRequest, aContext, aResult,
&shouldBlock, &verdict);
@@ -1473,8 +1462,6 @@ PendingLookup::OnStopRequestInternal(nsIRequest *aRequest,
bool* aShouldBlock,
uint32_t* aVerdict) {
if (NS_FAILED(aResult)) {
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
- SERVER_RESPONSE_FAILED);
return aResult;
}
@@ -1483,22 +1470,16 @@ PendingLookup::OnStopRequestInternal(nsIRequest *aRequest,
nsresult rv;
nsCOMPtr<nsIHttpChannel> channel = do_QueryInterface(aRequest, &rv);
if (NS_FAILED(rv)) {
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
- SERVER_RESPONSE_FAILED);
return rv;
}
uint32_t status = 0;
rv = channel->GetResponseStatus(&status);
if (NS_FAILED(rv)) {
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
- SERVER_RESPONSE_FAILED);
return rv;
}
if (status != 200) {
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
- SERVER_RESPONSE_FAILED);
return NS_ERROR_NOT_AVAILABLE;
}
@@ -1506,16 +1487,9 @@ PendingLookup::OnStopRequestInternal(nsIRequest *aRequest,
safe_browsing::ClientDownloadResponse response;
if (!response.ParseFromString(buf)) {
LOG(("Invalid protocol buffer response [this = %p]: %s", this, buf.c_str()));
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
- SERVER_RESPONSE_INVALID);
return NS_ERROR_CANNOT_CONVERT_DATA;
}
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
- SERVER_RESPONSE_VALID);
- // Clamp responses 0-7, we only know about 0-4 for now.
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER_VERDICT,
- std::min<uint32_t>(response.verdict(), 7));
switch(response.verdict()) {
case safe_browsing::ClientDownloadResponse::DANGEROUS:
*aShouldBlock = Preferences::GetBool(PREF_BLOCK_DANGEROUS, true);
@@ -1583,11 +1557,8 @@ ApplicationReputationService::QueryReputation(
NS_ENSURE_ARG_POINTER(aQuery);
NS_ENSURE_ARG_POINTER(aCallback);
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_COUNT, true);
nsresult rv = QueryReputationInternal(aQuery, aCallback);
if (NS_FAILED(rv)) {
- Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SHOULD_BLOCK,
- false);
aCallback->OnComplete(false, rv,
nsIApplicationReputationService::VERDICT_SAFE);
}
diff --git a/toolkit/components/osfile/modules/osfile_async_front.jsm b/toolkit/components/osfile/modules/osfile_async_front.jsm
index 964e53084..93c7e66d6 100644
--- a/toolkit/components/osfile/modules/osfile_async_front.jsm
+++ b/toolkit/components/osfile/modules/osfile_async_front.jsm
@@ -56,7 +56,6 @@ Cu.import("resource://gre/modules/Task.jsm", this);
// The implementation of communications
Cu.import("resource://gre/modules/PromiseWorker.jsm", this);
Cu.import("resource://gre/modules/Services.jsm", this);
-Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this);
Cu.import("resource://gre/modules/AsyncShutdown.jsm", this);
var Native = Cu.import("resource://gre/modules/osfile/osfile_native.jsm", {});
@@ -1171,13 +1170,10 @@ File.writeAtomic = function writeAtomic(path, buffer, options = {}) {
if (isTypedArray(buffer) && (!("bytes" in options))) {
options.bytes = buffer.byteLength;
};
- let refObj = {};
- TelemetryStopwatch.start("OSFILE_WRITEATOMIC_JANK_MS", refObj);
let promise = Scheduler.post("writeAtomic",
[Type.path.toMsg(path),
Type.void_t.in_ptr.toMsg(buffer),
options], [options, buffer, path]);
- TelemetryStopwatch.finish("OSFILE_WRITEATOMIC_JANK_MS", refObj);
return promise;
};
diff --git a/toolkit/components/perfmonitoring/nsPerformanceStats.cpp b/toolkit/components/perfmonitoring/nsPerformanceStats.cpp
index eb924de46..33aeaf7c2 100644
--- a/toolkit/components/perfmonitoring/nsPerformanceStats.cpp
+++ b/toolkit/components/perfmonitoring/nsPerformanceStats.cpp
@@ -27,7 +27,6 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/Services.h"
-#include "mozilla/Telemetry.h"
#if defined(XP_WIN)
#include <processthreadsapi.h>
@@ -957,22 +956,7 @@ nsPerformanceStatsService::SetJankAlertBufferingDelay(uint32_t value) {
nsresult
nsPerformanceStatsService::UpdateTelemetry()
{
- // Promote everything to floating-point explicitly before dividing.
- const double processStayed = mProcessStayed;
- const double processMoved = mProcessMoved;
-
- if (processStayed <= 0 || processMoved <= 0 || processStayed + processMoved <= 0) {
- // Overflow/underflow/nothing to report
- return NS_OK;
- }
-
- const double proportion = (100 * processStayed) / (processStayed + processMoved);
- if (proportion < 0 || proportion > 100) {
- // Overflow/underflow
- return NS_OK;
- }
-
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::PERF_MONITORING_TEST_CPU_RESCHEDULING_PROPORTION_MOVED, (uint32_t)proportion);
+ /* STUB */
return NS_OK;
}
diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp
index 37502e2a1..a87c14b37 100644
--- a/toolkit/components/places/Database.cpp
+++ b/toolkit/components/places/Database.cpp
@@ -615,9 +615,6 @@ Database::BackupAndReplaceDatabaseFile(nsCOMPtr<mozIStorageService>& aStorage)
// Set up a pref to try replacing the database at the next startup.
Preferences::SetBool(PREF_FORCE_DATABASE_REPLACEMENT, true);
}
- // Report the corruption through telemetry.
- Telemetry::Accumulate(Telemetry::PLACES_DATABASE_CORRUPTION_HANDLING_STAGE,
- static_cast<int8_t>(stage));
});
// Close database connection if open.
diff --git a/toolkit/components/places/FaviconHelpers.cpp b/toolkit/components/places/FaviconHelpers.cpp
index 69c202338..ca08cdff4 100644
--- a/toolkit/components/places/FaviconHelpers.cpp
+++ b/toolkit/components/places/FaviconHelpers.cpp
@@ -14,7 +14,6 @@
#include "nsNavHistory.h"
#include "nsFaviconService.h"
#include "mozilla/storage.h"
-#include "mozilla/Telemetry.h"
#include "nsNetUtil.h"
#include "nsPrintfCString.h"
#include "nsStreamUtils.h"
@@ -581,33 +580,6 @@ AsyncFetchAndSetIconForPage::OnStopRequest(nsIRequest* aRequest,
mIcon.expiration = GetExpirationTimeFromChannel(channel);
- // Telemetry probes to measure the favicon file sizes for each different file type.
- // This allow us to measure common file sizes while also observing each type popularity.
- if (mIcon.mimeType.EqualsLiteral("image/png")) {
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_PNG_SIZES, mIcon.data.Length());
- }
- else if (mIcon.mimeType.EqualsLiteral("image/x-icon") ||
- mIcon.mimeType.EqualsLiteral("image/vnd.microsoft.icon")) {
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_ICO_SIZES, mIcon.data.Length());
- }
- else if (mIcon.mimeType.EqualsLiteral("image/jpeg") ||
- mIcon.mimeType.EqualsLiteral("image/pjpeg")) {
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_JPEG_SIZES, mIcon.data.Length());
- }
- else if (mIcon.mimeType.EqualsLiteral("image/gif")) {
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_GIF_SIZES, mIcon.data.Length());
- }
- else if (mIcon.mimeType.EqualsLiteral("image/bmp") ||
- mIcon.mimeType.EqualsLiteral("image/x-windows-bmp")) {
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_BMP_SIZES, mIcon.data.Length());
- }
- else if (mIcon.mimeType.EqualsLiteral("image/svg+xml")) {
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_SVG_SIZES, mIcon.data.Length());
- }
- else {
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_OTHER_SIZES, mIcon.data.Length());
- }
-
rv = OptimizeIconSize(mIcon, favicons);
NS_ENSURE_SUCCESS(rv, rv);
diff --git a/toolkit/components/places/Helpers.cpp b/toolkit/components/places/Helpers.cpp
index 66c4e79a9..dda162197 100644
--- a/toolkit/components/places/Helpers.cpp
+++ b/toolkit/components/places/Helpers.cpp
@@ -385,9 +385,7 @@ AsyncStatementCallbackNotifier::HandleCompletion(uint16_t aReason)
NS_IMETHODIMP
AsyncStatementTelemetryTimer::HandleCompletion(uint16_t aReason)
{
- if (aReason == mozIStorageStatementCallback::REASON_FINISHED) {
- Telemetry::AccumulateTimeDelta(mHistogramId, mStart);
- }
+ /* STUB */
return NS_OK;
}
diff --git a/toolkit/components/places/UnifiedComplete.js b/toolkit/components/places/UnifiedComplete.js
index acd358b11..2efae9cbe 100644
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -262,8 +262,6 @@ Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
- "resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
@@ -887,10 +885,6 @@ Search.prototype = {
if (!this.pending)
return;
- TelemetryStopwatch.start(TELEMETRY_1ST_RESULT, this);
- if (this._searchString)
- TelemetryStopwatch.start(TELEMETRY_6_FIRST_RESULTS, this);
-
// Since we call the synchronous parseSubmissionURL function later, we must
// wait for the initialization of PlacesSearchAutocompleteProvider first.
yield PlacesSearchAutocompleteProvider.ensureInitialized();
@@ -1468,9 +1462,6 @@ Search.prototype = {
},
_onResultRow: function (row) {
- if (this._localMatchesCount == 0) {
- TelemetryStopwatch.finish(TELEMETRY_1ST_RESULT, this);
- }
let queryType = row.getResultByIndex(QUERYINDEX_QUERYTYPE);
let match;
switch (queryType) {
@@ -1566,9 +1557,6 @@ Search.prototype = {
match.style,
match.finalCompleteValue);
- if (this._result.matchCount == 6)
- TelemetryStopwatch.finish(TELEMETRY_6_FIRST_RESULTS, this);
-
this.notifyResults(true);
},
@@ -2088,8 +2076,6 @@ UnifiedComplete.prototype = {
* results or not.
*/
finishSearch: function (notify=false) {
- TelemetryStopwatch.cancel(TELEMETRY_1ST_RESULT, this);
- TelemetryStopwatch.cancel(TELEMETRY_6_FIRST_RESULTS, this);
// Clear state now to avoid race conditions, see below.
let search = this._currentSearch;
if (!search)
diff --git a/toolkit/components/places/nsPlacesAutoComplete.js b/toolkit/components/places/nsPlacesAutoComplete.js
index 29bdae4c1..9c6452ecd 100644
--- a/toolkit/components/places/nsPlacesAutoComplete.js
+++ b/toolkit/components/places/nsPlacesAutoComplete.js
@@ -8,8 +8,6 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
- "resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
@@ -1510,8 +1508,6 @@ urlInlineComplete.prototype = {
// Do a synchronous search on the table of hosts.
let query = this._hostQuery;
query.params.search_string = this._currentSearchString.toLowerCase();
- // This is just to measure the delay to reach the UI, not the query time.
- TelemetryStopwatch.start(DOMAIN_QUERY_TELEMETRY);
let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
handleResult: aResultSet => {
if (this._pendingSearch != pendingSearch)
@@ -1541,7 +1537,6 @@ urlInlineComplete.prototype = {
handleCompletion: aReason => {
if (this._pendingSearch != pendingSearch)
return;
- TelemetryStopwatch.finish(DOMAIN_QUERY_TELEMETRY);
this._finishSearch();
}
}, this._db);
diff --git a/toolkit/components/search/current/nsSearchService.js b/toolkit/components/search/current/nsSearchService.js
index 9f9003516..99e73b50b 100644
--- a/toolkit/components/search/current/nsSearchService.js
+++ b/toolkit/components/search/current/nsSearchService.js
@@ -21,8 +21,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
- "resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SearchStaticData",
"resource://gre/modules/SearchStaticData.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
@@ -3873,21 +3871,17 @@ SearchService.prototype = {
LOG("SearchService.init");
let self = this;
if (!this._initStarted) {
- TelemetryStopwatch.start("SEARCH_SERVICE_INIT_MS");
this._initStarted = true;
Task.spawn(function* task() {
try {
// Complete initialization by calling asynchronous initializer.
yield self._asyncInit();
- TelemetryStopwatch.finish("SEARCH_SERVICE_INIT_MS");
} catch (ex) {
if (ex.result == Cr.NS_ERROR_ALREADY_INITIALIZED) {
// No need to pursue asynchronous because synchronous fallback was
// called and has finished.
- TelemetryStopwatch.finish("SEARCH_SERVICE_INIT_MS");
} else {
self._initObservers.reject(ex);
- TelemetryStopwatch.cancel("SEARCH_SERVICE_INIT_MS");
}
}
});
diff --git a/toolkit/components/search/orginal/nsSearchService.js b/toolkit/components/search/orginal/nsSearchService.js
index 56d378b39..8d81e1a27 100644
--- a/toolkit/components/search/orginal/nsSearchService.js
+++ b/toolkit/components/search/orginal/nsSearchService.js
@@ -2237,7 +2237,10 @@ Engine.prototype = {
get lazySerializeTask() {
if (!this._lazySerializeTask) {
let task = function taskCallback() {
- this._serializeToFile();
+ // This check should be done by caller, but it is better to be safe than sorry.
+ if (!this._readOnly && this._file) {
+ this._serializeToFile();
+ }
}.bind(this);
this._lazySerializeTask = new DeferredTask(task, LAZY_SERIALIZE_DELAY);
}
@@ -2245,6 +2248,17 @@ Engine.prototype = {
return this._lazySerializeTask;
},
+ // This API is required by some search engine management extensions, so let's restore it.
+ // Old API was using a timer to do its work, but this can lead us too far. If extension is
+ // rely on such subtle internal details, that extension should be fixed, not browser.
+ _lazySerializeToFile: function SRCH_ENG_lazySerializeToFile() {
+ // This check should be done by caller, but it is better to be safe than sorry.
+ // Besides, we don't have to create a task for r/o or non-file engines.
+ if (!this._readOnly && this._file) {
+ this.lazySerializeTask.arm();
+ }
+ },
+
/**
* Serializes the engine object to file.
*/
@@ -3058,6 +3072,10 @@ SearchService.prototype = {
continue;
}
+ // Write out serialized search engine files when rebuilding cache.
+ // Do it lazily, to: 1) reuse existing API; 2) make browser interface more responsive
+ engine._lazySerializeToFile();
+
let cacheKey = parent.path;
if (!cache.directories[cacheKey]) {
let cacheEntry = {};
diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp
index 391389605..53f8c5670 100644
--- a/toolkit/components/startup/nsAppStartup.cpp
+++ b/toolkit/components/startup/nsAppStartup.cpp
@@ -758,11 +758,6 @@ nsAppStartup::GetStartupInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aRetva
procTime = TimeStamp::ProcessCreation(error);
- if (error) {
- Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS,
- StartupTimeline::PROCESS_CREATION);
- }
-
StartupTimeline::Record(StartupTimeline::PROCESS_CREATION, procTime);
}
@@ -777,8 +772,6 @@ nsAppStartup::GetStartupInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aRetva
// Always define main to aid with bug 689256.
stamp = procTime;
MOZ_ASSERT(!stamp.IsNull());
- Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS,
- StartupTimeline::MAIN);
}
if (!stamp.IsNull()) {
@@ -787,8 +780,6 @@ nsAppStartup::GetStartupInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aRetva
/ PR_USEC_PER_MSEC;
JS::Rooted<JSObject*> date(aCx, JS::NewDateObject(aCx, JS::TimeClip(prStamp)));
JS_DefineProperty(aCx, obj, StartupTimeline::Describe(ev), date, JSPROP_ENUMERATE);
- } else {
- Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, ev);
}
}
}
@@ -887,9 +878,6 @@ nsAppStartup::TrackStartupCrashBegin(bool *aIsSafeModeNecessary)
if (PR_Now() / PR_USEC_PER_SEC <= lastSuccessfulStartup)
return NS_ERROR_FAILURE;
- // The last startup was a crash so include it in the count regardless of when it happened.
- Telemetry::Accumulate(Telemetry::STARTUP_CRASH_DETECTED, true);
-
if (inSafeMode) {
GetAutomaticSafeModeNecessary(aIsSafeModeNecessary);
return NS_OK;
diff --git a/toolkit/components/telemetry/TelemetryStopwatch.jsm b/toolkit/components/telemetry/TelemetryStopwatch.jsm
deleted file mode 100644
index ab6c6eafb..000000000
--- a/toolkit/components/telemetry/TelemetryStopwatch.jsm
+++ /dev/null
@@ -1,335 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-this.EXPORTED_SYMBOLS = ["TelemetryStopwatch"];
-
-Cu.import("resource://gre/modules/Log.jsm", this);
-var Telemetry = Cc["@mozilla.org/base/telemetry;1"]
- .getService(Ci.nsITelemetry);
-
-// Weak map does not allow using null objects as keys. These objects are used
-// as 'null' placeholders.
-const NULL_OBJECT = {};
-const NULL_KEY = {};
-
-/**
- * Timers is a variation of a Map used for storing information about running
- * Stopwatches. Timers has the following data structure:
- *
- * {
- * "HISTOGRAM_NAME": WeakMap {
- * Object || NULL_OBJECT: Map {
- * "KEY" || NULL_KEY: startTime
- * ...
- * }
- * ...
- * }
- * ...
- * }
- *
- *
- * @example
- * // Stores current time for a keyed histogram "PLAYING_WITH_CUTE_ANIMALS".
- * Timers.put("PLAYING_WITH_CUTE_ANIMALS", null, "CATS", Date.now());
- *
- * @example
- * // Returns information about a simple Stopwatch.
- * let startTime = Timers.get("PLAYING_WITH_CUTE_ANIMALS", null, "CATS");
- */
-let Timers = {
- _timers: new Map(),
-
- _validTypes: function(histogram, obj, key) {
- let nonEmptyString = value => {
- return typeof value === "string" && value !== "" && value.length > 0;
- };
- return nonEmptyString(histogram) &&
- typeof obj == "object" &&
- (key === NULL_KEY || nonEmptyString(key));
- },
-
- get: function(histogram, obj, key) {
- key = key === null ? NULL_KEY : key;
- obj = obj || NULL_OBJECT;
-
- if (!this.has(histogram, obj, key)) {
- return null;
- }
-
- return this._timers.get(histogram).get(obj).get(key);
- },
-
- put: function(histogram, obj, key, startTime) {
- key = key === null ? NULL_KEY : key;
- obj = obj || NULL_OBJECT;
-
- if (!this._validTypes(histogram, obj, key)) {
- return false;
- }
-
- let objectMap = this._timers.get(histogram) || new WeakMap();
- let keyedInfo = objectMap.get(obj) || new Map();
- keyedInfo.set(key, startTime);
- objectMap.set(obj, keyedInfo);
- this._timers.set(histogram, objectMap);
- return true;
- },
-
- has: function(histogram, obj, key) {
- key = key === null ? NULL_KEY : key;
- obj = obj || NULL_OBJECT;
-
- return this._timers.has(histogram) &&
- this._timers.get(histogram).has(obj) &&
- this._timers.get(histogram).get(obj).has(key);
- },
-
- delete: function(histogram, obj, key) {
- key = key === null ? NULL_KEY : key;
- obj = obj || NULL_OBJECT;
-
- if (!this.has(histogram, obj, key)) {
- return false;
- }
- let objectMap = this._timers.get(histogram);
- let keyedInfo = objectMap.get(obj);
- if (keyedInfo.size > 1) {
- keyedInfo.delete(key);
- return true;
- }
- objectMap.delete(obj);
- // NOTE:
- // We never delete empty objecMaps from this._timers because there is no
- // nice solution for tracking the number of objects in a WeakMap.
- // WeakMap is not enumerable, so we can't deterministically say when it's
- // empty. We accept that trade-off here, given that entries for short-lived
- // objects will go away when they are no longer referenced
- return true;
- }
-};
-
-this.TelemetryStopwatch = {
- /**
- * Starts a timer associated with a telemetry histogram. The timer can be
- * directly associated with a histogram, or with a pair of a histogram and
- * an object.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {Object} aObj - Optional parameter. If specified, the timer is
- * associated with this object, meaning that multiple
- * timers for the same histogram may be run
- * concurrently, as long as they are associated with
- * different objects.
- *
- * @returns {Boolean} True if the timer was successfully started, false
- * otherwise. If a timer already exists, it can't be
- * started again, and the existing one will be cleared in
- * order to avoid measurements errors.
- */
- start: function(aHistogram, aObj) {
- return TelemetryStopwatchImpl.start(aHistogram, aObj, null);
- },
-
- /**
- * Deletes the timer associated with a telemetry histogram. The timer can be
- * directly associated with a histogram, or with a pair of a histogram and
- * an object. Important: Only use this method when a legitimate cancellation
- * should be done.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {Object} aObj - Optional parameter. If specified, the timer is
- * associated with this object, meaning that multiple
- * timers or a same histogram may be run concurrently,
- * as long as they are associated with different
- * objects.
- *
- * @returns {Boolean} True if the timer exist and it was cleared, False
- * otherwise.
- */
- cancel: function(aHistogram, aObj) {
- return TelemetryStopwatchImpl.cancel(aHistogram, aObj, null);
- },
-
- /**
- * Returns the elapsed time for a particular stopwatch. Primarily for
- * debugging purposes. Must be called prior to finish.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- * If an invalid name is given, the function will
- * throw.
- *
- * @param (Object) aObj - Optional parameter which associates the histogram
- * timer with the given object.
- *
- * @returns {Integer} time in milliseconds or -1 if the stopwatch was not
- * found.
- */
- timeElapsed: function(aHistogram, aObj) {
- return TelemetryStopwatchImpl.timeElapsed(aHistogram, aObj, null);
- },
-
- /**
- * Stops the timer associated with the given histogram (and object),
- * calculates the time delta between start and finish, and adds the value
- * to the histogram.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {Object} aObj - Optional parameter which associates the histogram
- * timer with the given object.
- *
- * @returns {Boolean} True if the timer was succesfully stopped and the data
- * was added to the histogram, False otherwise.
- */
- finish: function(aHistogram, aObj) {
- return TelemetryStopwatchImpl.finish(aHistogram, aObj, null);
- },
-
- /**
- * Starts a timer associated with a keyed telemetry histogram. The timer can
- * be directly associated with a histogram and its key. Similarly to
- * @see{TelemetryStopwatch.stat} the histogram and its key can be associated
- * with an object. Each key may have multiple associated objects and each
- * object can be associated with multiple keys.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {String} aKey - a string which must be a valid histgram key.
- *
- * @param {Object} aObj - Optional parameter. If specified, the timer is
- * associated with this object, meaning that multiple
- * timers for the same histogram may be run
- * concurrently,as long as they are associated with
- * different objects.
- *
- * @returns {Boolean} True if the timer was successfully started, false
- * otherwise. If a timer already exists, it can't be
- * started again, and the existing one will be cleared in
- * order to avoid measurements errors.
- */
- startKeyed: function(aHistogram, aKey, aObj) {
- return TelemetryStopwatchImpl.start(aHistogram, aObj, aKey);
- },
-
- /**
- * Deletes the timer associated with a keyed histogram. Important: Only use
- * this method when a legitimate cancellation should be done.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {String} aKey - a string which must be a valid histgram key.
- *
- * @param {Object} aObj - Optional parameter. If specified, the timer
- * associated with this object is deleted.
- *
- * @return {Boolean} True if the timer exist and it was cleared, False
- * otherwise.
- */
- cancelKeyed: function(aHistogram, aKey, aObj) {
- return TelemetryStopwatchImpl.cancel(aHistogram, aObj, aKey);
- },
-
- /**
- * Returns the elapsed time for a particular stopwatch. Primarily for
- * debugging purposes. Must be called prior to finish.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {String} aKey - a string which must be a valid histgram key.
- *
- * @param {Object} aObj - Optional parameter. If specified, the timer
- * associated with this object is used to calculate
- * the elapsed time.
- *
- * @return {Integer} time in milliseconds or -1 if the stopwatch was not
- * found.
- */
- timeElapsedKeyed: function(aHistogram, aKey, aObj) {
- return TelemetryStopwatchImpl.timeElapsed(aHistogram, aObj, aKey);
- },
-
- /**
- * Stops the timer associated with the given keyed histogram (and object),
- * calculates the time delta between start and finish, and adds the value
- * to the keyed histogram.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {String} aKey - a string which must be a valid histgram key.
- *
- * @param {Object} aObj - optional parameter which associates the histogram
- * timer with the given object.
- *
- * @returns {Boolean} True if the timer was succesfully stopped and the data
- * was added to the histogram, False otherwise.
- */
- finishKeyed: function(aHistogram, aKey, aObj) {
- return TelemetryStopwatchImpl.finish(aHistogram, aObj, aKey);
- }
-};
-
-this.TelemetryStopwatchImpl = {
- start: function(histogram, object, key) {
- if (Timers.has(histogram, object, key)) {
- Timers.delete(histogram, object, key);
- Cu.reportError(`TelemetryStopwatch: key "${histogram}" was already ` +
- "initialized");
- return false;
- }
-
- return Timers.put(histogram, object, key, Components.utils.now());
- },
-
- cancel: function (histogram, object, key) {
- return Timers.delete(histogram, object, key);
- },
-
- timeElapsed: function(histogram, object, key) {
- let startTime = Timers.get(histogram, object, key);
- if (startTime === null) {
- Cu.reportError("TelemetryStopwatch: requesting elapsed time for " +
- `nonexisting stopwatch. Histogram: "${histogram}", ` +
- `key: "${key}"`);
- return -1;
- }
-
- try {
- let delta = Components.utils.now() - startTime
- return Math.round(delta);
- } catch (e) {
- Cu.reportError("TelemetryStopwatch: failed to calculate elapsed time " +
- `for Histogram: "${histogram}", key: "${key}", ` +
- `exception: ${Log.exceptionStr(e)}`);
- return -1;
- }
- },
-
- finish: function(histogram, object, key) {
- let delta = this.timeElapsed(histogram, object, key);
- if (delta == -1) {
- return false;
- }
-
- try {
- if (key) {
- Telemetry.getKeyedHistogramById(histogram).add(key, delta);
- } else {
- Telemetry.getHistogramById(histogram).add(delta);
- }
- } catch (e) {
- Cu.reportError("TelemetryStopwatch: failed to update the Histogram " +
- `"${histogram}", using key: "${key}", ` +
- `exception: ${Log.exceptionStr(e)}`);
- return false;
- }
-
- return Timers.delete(histogram, object, key);
- }
-}
diff --git a/toolkit/components/telemetry/moz.build b/toolkit/components/telemetry/moz.build
index 118d61b71..7765c59b4 100644
--- a/toolkit/components/telemetry/moz.build
+++ b/toolkit/components/telemetry/moz.build
@@ -64,7 +64,6 @@ EXTRA_JS_MODULES += [
'TelemetryReportingPolicy.jsm',
'TelemetrySend.jsm',
'TelemetrySession.jsm',
- 'TelemetryStopwatch.jsm',
'TelemetryStorage.jsm',
'TelemetryTimestamps.jsm',
'TelemetryUtils.jsm',
diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js b/toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js
deleted file mode 100644
index d162d9b17..000000000
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js
+++ /dev/null
@@ -1,156 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-var tmpScope = {};
-Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", tmpScope);
-var TelemetryStopwatch = tmpScope.TelemetryStopwatch;
-
-const HIST_NAME = "TELEMETRY_SEND_SUCCESS";
-const HIST_NAME2 = "RANGE_CHECKSUM_ERRORS";
-const KEYED_HIST = { id: "TELEMETRY_INVALID_PING_TYPE_SUBMITTED", key: "TEST" };
-
-var refObj = {}, refObj2 = {};
-
-var originalCount1, originalCount2;
-
-function run_test() {
- let histogram = Telemetry.getHistogramById(HIST_NAME);
- let snapshot = histogram.snapshot();
- originalCount1 = snapshot.counts.reduce((a, b) => a += b);
-
- histogram = Telemetry.getHistogramById(HIST_NAME2);
- snapshot = histogram.snapshot();
- originalCount2 = snapshot.counts.reduce((a, b) => a += b);
-
- histogram = Telemetry.getKeyedHistogramById(KEYED_HIST.id);
- snapshot = histogram.snapshot(KEYED_HIST.key);
- originalCount3 = snapshot.counts.reduce((a, b) => a += b);
-
- do_check_false(TelemetryStopwatch.start(3));
- do_check_false(TelemetryStopwatch.start({}));
- do_check_false(TelemetryStopwatch.start("", 3));
- do_check_false(TelemetryStopwatch.start("", ""));
- do_check_false(TelemetryStopwatch.start({}, {}));
-
- do_check_true(TelemetryStopwatch.start("mark1"));
- do_check_true(TelemetryStopwatch.start("mark2"));
-
- do_check_true(TelemetryStopwatch.start("mark1", refObj));
- do_check_true(TelemetryStopwatch.start("mark2", refObj));
-
- // Same timer can't be re-started before being stopped
- do_check_false(TelemetryStopwatch.start("mark1"));
- do_check_false(TelemetryStopwatch.start("mark1", refObj));
-
- // Can't stop a timer that was accidentaly started twice
- do_check_false(TelemetryStopwatch.finish("mark1"));
- do_check_false(TelemetryStopwatch.finish("mark1", refObj));
-
- do_check_true(TelemetryStopwatch.start("NON-EXISTENT_HISTOGRAM"));
- do_check_false(TelemetryStopwatch.finish("NON-EXISTENT_HISTOGRAM"));
-
- do_check_true(TelemetryStopwatch.start("NON-EXISTENT_HISTOGRAM", refObj));
- do_check_false(TelemetryStopwatch.finish("NON-EXISTENT_HISTOGRAM", refObj));
-
- do_check_true(TelemetryStopwatch.start(HIST_NAME));
- do_check_true(TelemetryStopwatch.start(HIST_NAME2));
- do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj));
- do_check_true(TelemetryStopwatch.start(HIST_NAME2, refObj));
- do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj2));
- do_check_true(TelemetryStopwatch.start(HIST_NAME2, refObj2));
-
- do_check_true(TelemetryStopwatch.finish(HIST_NAME));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME2));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME, refObj));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME2, refObj));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME, refObj2));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME2, refObj2));
-
- // Verify that TS.finish deleted the timers
- do_check_false(TelemetryStopwatch.finish(HIST_NAME));
- do_check_false(TelemetryStopwatch.finish(HIST_NAME, refObj));
-
- // Verify that they can be used again
- do_check_true(TelemetryStopwatch.start(HIST_NAME));
- do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME, refObj));
-
- do_check_false(TelemetryStopwatch.finish("unknown-mark")); // Unknown marker
- do_check_false(TelemetryStopwatch.finish("unknown-mark", {})); // Unknown object
- do_check_false(TelemetryStopwatch.finish(HIST_NAME, {})); // Known mark on unknown object
-
- // Test cancel
- do_check_true(TelemetryStopwatch.start(HIST_NAME));
- do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj));
- do_check_true(TelemetryStopwatch.cancel(HIST_NAME));
- do_check_true(TelemetryStopwatch.cancel(HIST_NAME, refObj));
-
- // Verify that can not cancel twice
- do_check_false(TelemetryStopwatch.cancel(HIST_NAME));
- do_check_false(TelemetryStopwatch.cancel(HIST_NAME, refObj));
-
- // Verify that cancel removes the timers
- do_check_false(TelemetryStopwatch.finish(HIST_NAME));
- do_check_false(TelemetryStopwatch.finish(HIST_NAME, refObj));
-
- // Verify that keyed stopwatch reject invalid keys.
- for (let key of [3, {}, ""]) {
- do_check_false(TelemetryStopwatch.startKeyed(KEYED_HIST.id, key));
- }
-
- // Verify that keyed histograms can be started.
- do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1"));
- do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY2"));
- do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1", refObj));
- do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY2", refObj));
-
- // Restarting keyed histograms should fail.
- do_check_false(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1"));
- do_check_false(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1", refObj));
-
- // Finishing a stopwatch of a non existing histogram should return false.
- do_check_false(TelemetryStopwatch.finishKeyed("HISTOGRAM", "KEY2"));
- do_check_false(TelemetryStopwatch.finishKeyed("HISTOGRAM", "KEY2", refObj));
-
- // Starting & finishing a keyed stopwatch for an existing histogram should work.
- do_check_true(TelemetryStopwatch.startKeyed(KEYED_HIST.id, KEYED_HIST.key));
- do_check_true(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, KEYED_HIST.key));
- // Verify that TS.finish deleted the timers
- do_check_false(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, KEYED_HIST.key));
-
- // Verify that they can be used again
- do_check_true(TelemetryStopwatch.startKeyed(KEYED_HIST.id, KEYED_HIST.key));
- do_check_true(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, KEYED_HIST.key));
-
- do_check_false(TelemetryStopwatch.finishKeyed("unknown-mark", "unknown-key"));
- do_check_false(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, "unknown-key"));
-
- // Verify that keyed histograms can only be canceled through "keyed" API.
- do_check_true(TelemetryStopwatch.startKeyed(KEYED_HIST.id, KEYED_HIST.key));
- do_check_false(TelemetryStopwatch.cancel(KEYED_HIST.id, KEYED_HIST.key));
- do_check_true(TelemetryStopwatch.cancelKeyed(KEYED_HIST.id, KEYED_HIST.key));
- do_check_false(TelemetryStopwatch.cancelKeyed(KEYED_HIST.id, KEYED_HIST.key));
-
- finishTest();
-}
-
-function finishTest() {
- let histogram = Telemetry.getHistogramById(HIST_NAME);
- let snapshot = histogram.snapshot();
- let newCount = snapshot.counts.reduce((a, b) => a += b);
-
- do_check_eq(newCount - originalCount1, 5, "The correct number of histograms were added for histogram 1.");
-
- histogram = Telemetry.getHistogramById(HIST_NAME2);
- snapshot = histogram.snapshot();
- newCount = snapshot.counts.reduce((a, b) => a += b);
-
- do_check_eq(newCount - originalCount2, 3, "The correct number of histograms were added for histogram 2.");
-
- histogram = Telemetry.getKeyedHistogramById(KEYED_HIST.id);
- snapshot = histogram.snapshot(KEYED_HIST.key);
- newCount = snapshot.counts.reduce((a, b) => a += b);
-
- do_check_eq(newCount - originalCount3, 2, "The correct number of histograms were added for histogram 3.");
-}
diff --git a/toolkit/components/telemetry/tests/unit/xpcshell.ini b/toolkit/components/telemetry/tests/unit/xpcshell.ini
index 42354c4cd..224516f57 100644
--- a/toolkit/components/telemetry/tests/unit/xpcshell.ini
+++ b/toolkit/components/telemetry/tests/unit/xpcshell.ini
@@ -41,7 +41,6 @@ tags = addons
[test_TelemetryController_idle.js]
[test_TelemetryControllerShutdown.js]
tags = addons
-[test_TelemetryStopwatch.js]
[test_TelemetryControllerBuildID.js]
[test_TelemetrySendOldPings.js]
skip-if = os == "android" # Disabled due to intermittent orange on Android
diff --git a/toolkit/components/url-classifier/Classifier.cpp b/toolkit/components/url-classifier/Classifier.cpp
index bbaeaf535..b9d0ace1b 100644
--- a/toolkit/components/url-classifier/Classifier.cpp
+++ b/toolkit/components/url-classifier/Classifier.cpp
@@ -15,7 +15,6 @@
#include "nsNetCID.h"
#include "nsPrintfCString.h"
#include "nsThreadUtils.h"
-#include "mozilla/Telemetry.h"
#include "mozilla/Logging.h"
#include "mozilla/SyncRunnable.h"
#include "mozilla/Base64.h"
@@ -413,8 +412,6 @@ Classifier::Check(const nsACString& aSpec,
uint32_t aFreshnessGuarantee,
LookupResultArray& aResults)
{
- Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_CL_CHECK_TIME> timer;
-
// Get the set of fragments based on the url. This is necessary because we
// only look up at most 5 URLs per aSpec, even if aSpec has more than 5
// components.
@@ -498,9 +495,6 @@ Classifier::Check(const nsACString& aSpec,
matchingStatistics |= PrefixMatch::eMatchV2Prefix;
}
}
-
- Telemetry::Accumulate(Telemetry::URLCLASSIFIER_PREFIX_MATCH,
- static_cast<uint8_t>(matchingStatistics));
}
return NS_OK;
@@ -509,8 +503,6 @@ Classifier::Check(const nsACString& aSpec,
nsresult
Classifier::ApplyUpdates(nsTArray<TableUpdate*>* aUpdates)
{
- Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_CL_UPDATE_TIME> timer;
-
PRIntervalTime clockStart = 0;
if (LOG_ENABLED()) {
clockStart = PR_IntervalNow();
diff --git a/toolkit/components/url-classifier/Entries.h b/toolkit/components/url-classifier/Entries.h
index 969f4f739..b7fb34516 100644
--- a/toolkit/components/url-classifier/Entries.h
+++ b/toolkit/components/url-classifier/Entries.h
@@ -100,7 +100,7 @@ struct SafebrowsingHash
aStr.SetCapacity(2 * len);
for (size_t i = 0; i < len; ++i) {
- const char c = static_cast<const char>(buf[i]);
+ const char c = static_cast<char>(buf[i]);
aStr.Append(lut[(c >> 4) & 0x0F]);
aStr.Append(lut[c & 15]);
}
diff --git a/toolkit/components/url-classifier/LookupCache.cpp b/toolkit/components/url-classifier/LookupCache.cpp
index 5a3b1e36d..7c4d7682b 100644
--- a/toolkit/components/url-classifier/LookupCache.cpp
+++ b/toolkit/components/url-classifier/LookupCache.cpp
@@ -6,7 +6,6 @@
#include "LookupCache.h"
#include "HashStore.h"
#include "nsISeekableStream.h"
-#include "mozilla/Telemetry.h"
#include "mozilla/Logging.h"
#include "nsNetUtil.h"
#include "prprf.h"
@@ -451,9 +450,6 @@ nsresult
LookupCacheV2::Build(AddPrefixArray& aAddPrefixes,
AddCompleteArray& aAddCompletes)
{
- Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LC_COMPLETIONS,
- static_cast<uint32_t>(aAddCompletes.Length()));
-
mUpdateCompletions.Clear();
mUpdateCompletions.SetCapacity(aAddCompletes.Length());
for (uint32_t i = 0; i < aAddCompletes.Length(); i++) {
@@ -462,9 +458,6 @@ LookupCacheV2::Build(AddPrefixArray& aAddPrefixes,
aAddCompletes.Clear();
mUpdateCompletions.Sort();
- Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LC_PREFIXES,
- static_cast<uint32_t>(aAddPrefixes.Length()));
-
nsresult rv = ConstructPrefixSet(aAddPrefixes);
NS_ENSURE_SUCCESS(rv, rv);
mPrimed = true;
@@ -548,8 +541,6 @@ static void EnsureSorted(T* aArray)
nsresult
LookupCacheV2::ConstructPrefixSet(AddPrefixArray& aAddPrefixes)
{
- Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_CONSTRUCT_TIME> timer;
-
nsTArray<uint32_t> array;
if (!array.SetCapacity(aAddPrefixes.Length(), fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
diff --git a/toolkit/components/url-classifier/LookupCacheV4.cpp b/toolkit/components/url-classifier/LookupCacheV4.cpp
index 7258ae358..a96e4931a 100644
--- a/toolkit/components/url-classifier/LookupCacheV4.cpp
+++ b/toolkit/components/url-classifier/LookupCacheV4.cpp
@@ -144,9 +144,6 @@ LookupCacheV4::LoadFromFile(nsIFile* aFile)
}
rv = VerifyChecksum(checksum);
- Telemetry::Accumulate(Telemetry::URLCLASSIFIER_VLPS_LOAD_CORRUPT,
- rv == NS_ERROR_FILE_CORRUPTED);
-
return rv;
}
@@ -231,8 +228,6 @@ LookupCacheV4::ApplyUpdate(TableUpdateV4* aTableUpdate,
if (!isOldMapEmpty && !isAddMapEmpty) {
if (smallestOldPrefix == smallestAddPrefix) {
LOG(("Add prefix should not exist in the original prefix set."));
- Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR_TYPE,
- DUPLICATE_PREFIX);
return NS_ERROR_FAILURE;
}
@@ -274,15 +269,11 @@ LookupCacheV4::ApplyUpdate(TableUpdateV4* aTableUpdate,
// the number of original prefix plus add prefix.
if (index <= 0) {
LOG(("There are still prefixes remaining after reaching maximum runs."));
- Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR_TYPE,
- INFINITE_LOOP);
return NS_ERROR_FAILURE;
}
if (removalIndex < removalArray.Length()) {
LOG(("There are still prefixes to remove after exhausting the old PrefixSet."));
- Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR_TYPE,
- WRONG_REMOVAL_INDICES);
return NS_ERROR_FAILURE;
}
@@ -290,8 +281,6 @@ LookupCacheV4::ApplyUpdate(TableUpdateV4* aTableUpdate,
crypto->Finish(false, checksum);
if (aTableUpdate->Checksum().IsEmpty()) {
LOG(("Update checksum missing."));
- Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR_TYPE,
- MISSING_CHECKSUM);
// Generate our own checksum to tableUpdate to ensure there is always
// checksum in .metadata
@@ -300,8 +289,6 @@ LookupCacheV4::ApplyUpdate(TableUpdateV4* aTableUpdate,
} else if (aTableUpdate->Checksum() != checksum){
LOG(("Checksum mismatch after applying partial update"));
- Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR_TYPE,
- CHECKSUM_MISMATCH);
return NS_ERROR_FAILURE;
}
diff --git a/toolkit/components/url-classifier/VariableLengthPrefixSet.cpp b/toolkit/components/url-classifier/VariableLengthPrefixSet.cpp
index e9d6770d3..a387a698c 100644
--- a/toolkit/components/url-classifier/VariableLengthPrefixSet.cpp
+++ b/toolkit/components/url-classifier/VariableLengthPrefixSet.cpp
@@ -209,8 +209,6 @@ VariableLengthPrefixSet::LoadFromFile(nsIFile* aFile)
NS_ENSURE_ARG_POINTER(aFile);
- Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_VLPS_FILELOAD_TIME> timer;
-
nsCOMPtr<nsIInputStream> localInFile;
nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(localInFile), aFile,
PR_RDONLY | nsIFile::OS_READAHEAD);
@@ -255,15 +253,12 @@ VariableLengthPrefixSet::StoreToFile(nsIFile* aFile)
uint32_t fileSize = 0;
// Preallocate the file storage
- {
- nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile));
- Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_VLPS_FALLOCATE_TIME> timer;
+ nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile));
- fileSize += mFixedPrefixSet->CalculatePreallocateSize();
- fileSize += CalculatePreallocateSize();
+ fileSize += mFixedPrefixSet->CalculatePreallocateSize();
+ fileSize += CalculatePreallocateSize();
- Unused << fos->Preallocate(fileSize);
- }
+ Unused << fos->Preallocate(fileSize);
// Convert to buffered stream
nsCOMPtr<nsIOutputStream> out =
diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
index 2ad8b6b51..d3018aa2d 100644
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -37,7 +37,6 @@
#include "mozilla/Mutex.h"
#include "mozilla/Preferences.h"
#include "mozilla/TimeStamp.h"
-#include "mozilla/Telemetry.h"
#include "mozilla/Logging.h"
#include "prprf.h"
#include "prnetdb.h"
@@ -320,9 +319,6 @@ nsUrlClassifierDBServiceWorker::HandlePendingLookups()
MutexAutoUnlock unlock(mPendingLookupLock);
DoLookup(lookup.mKey, lookup.mTables, lookup.mCallback);
}
- double lookupTime = (TimeStamp::Now() - lookup.mStartTime).ToMilliseconds();
- Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LOOKUP_TIME,
- static_cast<uint32_t>(lookupTime));
}
return NS_OK;
@@ -1818,8 +1814,6 @@ nsUrlClassifierDBService::Shutdown()
gShuttingDownThread = true;
- Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_SHUTDOWN_TIME> timer;
-
mCompleters.Clear();
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
diff --git a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
index 874565470..3cfdf7a35 100644
--- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
@@ -315,8 +315,6 @@ nsUrlClassifierPrefixSet::LoadFromFile(nsIFile* aFile)
{
MutexAutoLock lock(mLock);
- Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_FILELOAD_TIME> timer;
-
nsCOMPtr<nsIInputStream> localInFile;
nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(localInFile), aFile,
PR_RDONLY | nsIFile::OS_READAHEAD);
@@ -356,17 +354,13 @@ nsUrlClassifierPrefixSet::StoreToFile(nsIFile* aFile)
uint32_t fileSize;
- // Preallocate the file storage
- {
- nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile));
- Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_FALLOCATE_TIME> timer;
+ nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile));
- fileSize = CalculatePreallocateSize();
+ fileSize = CalculatePreallocateSize();
- // Ignore failure, the preallocation is a hint and we write out the entire
- // file later on
- Unused << fos->Preallocate(fileSize);
- }
+ // Ignore failure, the preallocation is a hint and we write out the entire
+ // file later on
+ Unused << fos->Preallocate(fileSize);
// Convert to buffered stream
nsCOMPtr<nsIOutputStream> out =
diff --git a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
index 554bff342..e230f6951 100644
--- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
@@ -646,9 +646,6 @@ nsUrlClassifierStreamUpdater::OnStartRequest(nsIRequest *request,
if (NS_FAILED(status)) {
// Assume we're overloading the server and trigger backoff.
downloadError = true;
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::URLCLASSIFIER_UPDATE_REMOTE_STATUS,
- 15 /* unknown response code */);
-
} else {
bool succeeded = false;
rv = httpChannel->GetRequestSucceeded(&succeeded);
@@ -657,8 +654,6 @@ nsUrlClassifierStreamUpdater::OnStartRequest(nsIRequest *request,
uint32_t requestStatus;
rv = httpChannel->GetResponseStatus(&requestStatus);
NS_ENSURE_SUCCESS(rv, rv);
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::URLCLASSIFIER_UPDATE_REMOTE_STATUS,
- HTTPStatusToBucket(requestStatus));
LOG(("nsUrlClassifierStreamUpdater::OnStartRequest %s (%d)", succeeded ?
"succeeded" : "failed", requestStatus));
if (!succeeded) {