diff options
Diffstat (limited to 'toolkit/components/glean/bindings/private/DistributionData.h')
-rw-r--r-- | toolkit/components/glean/bindings/private/DistributionData.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/toolkit/components/glean/bindings/private/DistributionData.h b/toolkit/components/glean/bindings/private/DistributionData.h index fb9bba720e..782fe17c98 100644 --- a/toolkit/components/glean/bindings/private/DistributionData.h +++ b/toolkit/components/glean/bindings/private/DistributionData.h @@ -27,6 +27,28 @@ struct DistributionData final { this->values.InsertOrUpdate(aBuckets[i], aCounts[i]); } } + + friend std::ostream& operator<<(std::ostream& aStream, + const DistributionData& aDist) { + aStream << "DistributionData("; + aStream << "sum=" << aDist.sum << ", "; + aStream << "count=" << aDist.count << ", "; + aStream << "values={"; + bool first = true; + for (const auto& entry : aDist.values) { + if (!first) { + aStream << ", "; + } + first = false; + + const uint64_t bucket = entry.GetKey(); + const uint64_t count = entry.GetData(); + aStream << bucket << "=" << count; + } + aStream << "}"; + aStream << ")"; + return aStream; + } }; } // namespace mozilla::glean |