Bug 1338812 - Call TelemetryStopwatch only once per item (history / bookmarks / logins) rather than for each resource. r=Gijs

MozReview-Commit-ID: 7c5DgKDIFTv

--HG--
extra : rebase_source : 9141f895c95f31b682e047d7df203aed32e3d65b
This commit is contained in:
Dão Gottwald 2017-02-11 21:14:52 +01:00
Родитель c87ff7ce1d
Коммит e247cf9a5f
1 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -249,16 +249,16 @@ this.MigratorPrototype = {
}
return null;
};
let maybeStartTelemetryStopwatch = (resourceType, resource) => {
let maybeStartTelemetryStopwatch = (resourceType) => {
let histogram = getHistogramForResourceType(resourceType);
if (histogram) {
TelemetryStopwatch.startKeyed(histogram, this.getKey(), resource);
TelemetryStopwatch.startKeyed(histogram, this.getKey());
}
};
let maybeStopTelemetryStopwatch = (resourceType, resource) => {
let maybeStopTelemetryStopwatch = (resourceType) => {
let histogram = getHistogramForResourceType(resourceType);
if (histogram) {
TelemetryStopwatch.finishKeyed(histogram, this.getKey(), resource);
TelemetryStopwatch.finishKeyed(histogram, this.getKey());
}
};
@ -297,12 +297,12 @@ this.MigratorPrototype = {
for (let [migrationType, itemResources] of resourcesGroupedByItems) {
notify("Migration:ItemBeforeMigrate", migrationType);
maybeStartTelemetryStopwatch(migrationType);
let itemSuccess = false;
for (let res of itemResources) {
maybeStartTelemetryStopwatch(migrationType, res);
let completeDeferred = PromiseUtils.defer();
let resourceDone = function(aSuccess) {
maybeStopTelemetryStopwatch(migrationType, res);
itemResources.delete(res);
itemSuccess |= aSuccess;
if (itemResources.size == 0) {
@ -310,6 +310,9 @@ this.MigratorPrototype = {
"Migration:ItemAfterMigrate" : "Migration:ItemError",
migrationType);
resourcesGroupedByItems.delete(migrationType);
maybeStopTelemetryStopwatch(migrationType);
if (resourcesGroupedByItems.size == 0) {
collectQuantityTelemetry();
notify("Migration:Ended");