Skip to content

Commit

Permalink
#334: remove telemetry from places and autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
classilla committed Aug 26, 2017
1 parent a05b152 commit 127ef91
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions toolkit/components/places/AsyncFaviconHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ AsyncFetchAndSetIconForPage::OnStopRequest(nsIRequest* aRequest,

mIcon.expiration = GetExpirationTimeFromChannel(channel);

#if(0)
// 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")) {
Expand All @@ -700,6 +701,7 @@ AsyncFetchAndSetIconForPage::OnStopRequest(nsIRequest* aRequest,
else {
mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_OTHER_SIZES, mIcon.data.Length());
}
#endif

rv = OptimizeIconSize(mIcon, favicons);
NS_ENSURE_SUCCESS(rv, rv);
Expand Down
8 changes: 6 additions & 2 deletions toolkit/components/places/PlacesDBUtils.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ this.PlacesDBUtils = {
else {
// All tasks have been completed.
// Telemetry the time it took for maintenance, if a start time exists.
/*
if (aTasks._telemetryStart) {
Services.telemetry.getHistogramById("PLACES_IDLE_MAINTENANCE_TIME_MS")
.add(Date.now() - aTasks._telemetryStart);
aTasks._telemetryStart = 0;
}
*/

if (aTasks.callback) {
let scope = aTasks.scope || Cu.getGlobalForObject(aTasks.callback);
Expand Down Expand Up @@ -92,7 +94,7 @@ this.PlacesDBUtils = {
, this.checkCoherence
, this._refreshUI
]);
tasks._telemetryStart = Date.now();
//tasks._telemetryStart = Date.now();
tasks.callback = function() {
Services.prefs.setIntPref("places.database.lastMaintenance",
parseInt(Date.now() / 1000));
Expand Down Expand Up @@ -870,6 +872,7 @@ this.PlacesDBUtils = {
telemetry: function PDBU_telemetry(aTasks, aHealthReportCallback=null)
{
let tasks = new Tasks(aTasks);
/*
let isTelemetry = !aHealthReportCallback;
Expand Down Expand Up @@ -948,7 +951,7 @@ this.PlacesDBUtils = {
},
{ histogram: "PLACES_DATABASE_PAGESIZE_B",
query: "PRAGMA page_size /* PlacesDBUtils.jsm PAGESIZE_B */" },
query: "PRAGMA page_size" },
{ histogram: "PLACES_DATABASE_SIZE_PER_PAGE_B",
query: "PRAGMA page_count",
Expand Down Expand Up @@ -1053,6 +1056,7 @@ this.PlacesDBUtils = {
);
}
*/
PlacesDBUtils._executeTasks(tasks);
},

Expand Down
10 changes: 9 additions & 1 deletion toolkit/components/places/UnifiedComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,10 @@ 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",
Expand Down Expand Up @@ -859,9 +861,11 @@ 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.
Expand Down Expand Up @@ -1339,7 +1343,7 @@ Search.prototype = {
},

_onResultRow: function (row) {
TelemetryStopwatch.finish(TELEMETRY_1ST_RESULT, this);
//TelemetryStopwatch.finish(TELEMETRY_1ST_RESULT, this);
let queryType = row.getResultByIndex(QUERYINDEX_QUERYTYPE);
let match;
switch (queryType) {
Expand Down Expand Up @@ -1430,8 +1434,10 @@ Search.prototype = {
match.style,
match.finalCompleteValue);

/*
if (this._result.matchCount == 6)
TelemetryStopwatch.finish(TELEMETRY_6_FIRST_RESULTS, this);
*/

this.notifyResults(true);
},
Expand Down Expand Up @@ -1939,8 +1945,10 @@ 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;
this._lastLowResultsSearchSuggestion = search._lastLowResultsSearchSuggestion;
Expand Down
6 changes: 4 additions & 2 deletions toolkit/components/places/nsPlacesAutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ 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",
Expand Down Expand Up @@ -1525,7 +1527,7 @@ urlInlineComplete.prototype = {
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);
//TelemetryStopwatch.start(DOMAIN_QUERY_TELEMETRY);
let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
handleResult: aResultSet => {
if (this._pendingSearch != pendingSearch)
Expand Down Expand Up @@ -1555,7 +1557,7 @@ urlInlineComplete.prototype = {
handleCompletion: aReason => {
if (this._pendingSearch != pendingSearch)
return;
TelemetryStopwatch.finish(DOMAIN_QUERY_TELEMETRY);
//TelemetryStopwatch.finish(DOMAIN_QUERY_TELEMETRY);
this._finishSearch();
}
}, this._db);
Expand Down

0 comments on commit 127ef91

Please sign in to comment.