Bug 844146 - add BooleanHistogram::Accumulate to properly canonicalize values for boolean histograms; r=taras

This commit is contained in:
Nathan Froyd 2013-02-22 13:52:40 -05:00
parent 979a076f41
commit 715a3df5d3
2 changed files with 10 additions and 0 deletions

View File

@ -973,6 +973,14 @@ BooleanHistogram::BooleanHistogram(const std::string& name)
: LinearHistogram(name, 1, 2, 3) {
}
void
BooleanHistogram::Accumulate(Sample value, Count count, size_t index)
{
// Callers will have computed index based on the non-booleanified value.
// So we need to adjust the index manually.
LinearHistogram::Accumulate(!!value, count, value ? 1 : 0);
}
//------------------------------------------------------------------------------
// FlagHistogram:
//------------------------------------------------------------------------------

View File

@ -672,6 +672,8 @@ class BooleanHistogram : public LinearHistogram {
virtual void AddBoolean(bool value);
virtual void Accumulate(Sample value, Count count, size_t index);
protected:
explicit BooleanHistogram(const std::string& name);