Bug 1381470 - Added a less memory consuming method to tell if a histogram is empty. r=chutten

This commit is contained in:
Dean 2017-07-31 21:38:48 +02:00
Родитель 3e9099fc0e
Коммит deef8d264a
2 изменённых файлов: 5 добавлений и 3 удалений

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

@ -115,6 +115,10 @@ class Histogram {
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
bool is_empty() const {
return this->sample_.counts(0) == 0 && this->sample_.sum() == 0;
}
//----------------------------------------------------------------------------
// Statistic values, developed over the life of the histogram.

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

@ -335,9 +335,7 @@ internal_CanRecordExtended() {
bool
internal_IsEmpty(const Histogram *h)
{
Histogram::SampleSet ss;
h->SnapshotSample(&ss);
return ss.counts(0) == 0 && ss.sum() == 0;
return h->is_empty();
}
bool