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
parent 3e9099fc0e
commit deef8d264a
2 changed files with 5 additions and 3 deletions

View File

@ -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.

View File

@ -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