Skip to content

Commit

Permalink
MB-33549: add isEmpty method to HdrHistogram
Browse files Browse the repository at this point in the history
Used in new EPStats tests, and generally useful.

Change-Id: Iba1a031de27df8744311a526e3ca3b62c3bea876
Reviewed-on: https://review.couchbase.org/c/platform/+/173268
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>
  • Loading branch information
redm2 authored and daverigby committed Apr 5, 2022
1 parent 5f42599 commit a3c5cb0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hdrhistogram/hdrhistogram.cc
Expand Up @@ -101,6 +101,10 @@ uint64_t HdrHistogram::getValueCount() const {
return static_cast<uint64_t>(histogram.rlock()->get()->total_count);
}

bool HdrHistogram::isEmpty() const {
return getValueCount() == 0;
}

uint64_t HdrHistogram::getMinValue() const {
return static_cast<uint64_t>(hdr_min(histogram.rlock()->get()));
}
Expand Down
5 changes: 5 additions & 0 deletions include/hdrhistogram/hdrhistogram.h
Expand Up @@ -272,6 +272,11 @@ class HdrHistogram {
*/
uint64_t getValueCount() const;

/**
* Returns true if zero values have been added to the histogram.
*/
bool isEmpty() const;

/**
* Returns the min value stored to the histogram
*/
Expand Down

0 comments on commit a3c5cb0

Please sign in to comment.