mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 14:52:16 +00:00
Bug 1800492 - Fix division by zero when calculating GC_TENURED_SURVIVAL_RATE telemetry r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D162016
This commit is contained in:
parent
4bcd987494
commit
a69165bcbb
@ -1071,7 +1071,7 @@ void Statistics::sendGCTelemetry() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!lastSlice.wasReset()) {
|
||||
if (!lastSlice.wasReset() && preCollectedHeapBytes != 0) {
|
||||
size_t bytesSurvived = 0;
|
||||
for (ZonesIter zone(runtime, WithAtoms); !zone.done(); zone.next()) {
|
||||
if (zone->wasCollected()) {
|
||||
@ -1080,9 +1080,9 @@ void Statistics::sendGCTelemetry() {
|
||||
}
|
||||
|
||||
MOZ_ASSERT(preCollectedHeapBytes >= bytesSurvived);
|
||||
double survialRate =
|
||||
double survivalRate =
|
||||
100.0 * double(bytesSurvived) / double(preCollectedHeapBytes);
|
||||
runtime->metrics().GC_TENURED_SURVIVAL_RATE(uint32_t(survialRate));
|
||||
runtime->metrics().GC_TENURED_SURVIVAL_RATE(uint32_t(survivalRate));
|
||||
|
||||
// Calculate 'effectiveness' in MB / second, on main thread only for now.
|
||||
if (!runtime->parentRuntime) {
|
||||
|
@ -263,7 +263,7 @@ class Metrics {
|
||||
struct Enumeration {
|
||||
using SourceType = int;
|
||||
static uint32_t convert(SourceType sample) {
|
||||
MOZ_ASSERT(sample <= 100);
|
||||
MOZ_ASSERT(sample >= 0 && sample <= 100);
|
||||
return static_cast<uint32_t>(sample);
|
||||
}
|
||||
};
|
||||
@ -274,7 +274,7 @@ class Metrics {
|
||||
struct Percentage {
|
||||
using SourceType = int;
|
||||
static uint32_t convert(SourceType sample) {
|
||||
MOZ_ASSERT(sample <= 100);
|
||||
MOZ_ASSERT(sample >= 0 && sample <= 100);
|
||||
return static_cast<uint32_t>(sample);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user