Bug 1543393 - shardIndex should not use ceil(); r=chutten
authorLiang-Heng Chen <xeonchen@gmail.com>
Thu, 11 Apr 2019 18:47:28 +0000
changeset 469069 2ac987c37cda1baa5601f0578db03c6860824ccf
parent 469068 57c26f8e0bf7ab4e1d23bdbf68ed91c0bd925204
child 469070 d679d6a5d63f00f5a4bdacdd9280682a41138eca
push id35856
push usercsabou@mozilla.com
push dateFri, 12 Apr 2019 03:19:48 +0000
treeherdermozilla-central@940684cd1065 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten
bugs1543393
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1543393 - shardIndex should not use ceil(); r=chutten Differential Revision: https://phabricator.services.mozilla.com/D26909
toolkit/components/telemetry/core/TelemetryOrigin.cpp
--- a/toolkit/components/telemetry/core/TelemetryOrigin.cpp
+++ b/toolkit/components/telemetry/core/TelemetryOrigin.cpp
@@ -208,18 +208,17 @@ nsresult AppEncodeTo(const StaticMutexAu
           maxGeneration = std::max(maxGeneration, originCount);
 
           const nsACString& origin = originIt.Key();
           size_t index;
           if (!gOriginToIndexMap->Get(origin, &index)) {
             return NS_ERROR_FAILURE;
           }
           MOZ_ASSERT(index < gOriginsList->Length());
-          size_t shardIndex =
-              ceil(static_cast<double>(index) / PrioEncoder::gNumBooleans);
+          size_t shardIndex = index / PrioEncoder::gNumBooleans;
           MOZ_ASSERT(shardIndex < metricData.Length());
           MOZ_ASSERT(index % PrioEncoder::gNumBooleans <
                      metricData[shardIndex].Length());
           metricData[shardIndex][index % PrioEncoder::gNumBooleans] = true;
         }
       }
       aResult.AppendElement(MakePair(id, metricData));
     } while (generation < maxGeneration);
@@ -243,18 +242,18 @@ void TelemetryOrigin::InitializeGlobalSt
 
   MOZ_ASSERT(!gInitDone,
              "TelemetryOrigin::InitializeGlobalState "
              "may only be called once");
 
   // The contents and order of this array matters.
   // Both ensure a consistent app-encoding.
   gOriginsList = new nsTArray<const char*>({
+      "fb.com",
       "doubleclick.de",
-      "fb.com",
   });
 
   gPrioDatasPerMetric =
       ceil(static_cast<double>(gOriginsList->Length() + kNumMetaOrigins) /
            PrioEncoder::gNumBooleans);
 
   gOriginToIndexMap = new OriginToIndexMap(gOriginsList->Length());
   for (size_t i = 0; i < gOriginsList->Length(); ++i) {