-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-23245 : MutableHistogram constructor changes and provide Histog… #787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,19 +63,19 @@ public void testSnapshot() { | |
| Snapshot snapshot = histogram.snapshot(); | ||
|
|
||
| assertEquals(100, snapshot.getCount()); | ||
| assertEquals(50, snapshot.getMedian()); | ||
| assertEquals(49, snapshot.getMedian()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you help me understanding why this became 49?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. getMin()=0, getMax()=99. Hence, ideally getMedian() should be 49. |
||
| assertEquals(49, snapshot.getMean()); | ||
| assertEquals(0, snapshot.getMin()); | ||
| assertEquals(99, snapshot.getMax()); | ||
| assertEquals(25, snapshot.get25thPercentile()); | ||
| assertEquals(75, snapshot.get75thPercentile()); | ||
| assertEquals(90, snapshot.get90thPercentile()); | ||
| assertEquals(95, snapshot.get95thPercentile()); | ||
| assertEquals(98, snapshot.get98thPercentile()); | ||
| assertEquals(99, snapshot.get99thPercentile()); | ||
| assertEquals(99, snapshot.get999thPercentile()); | ||
| assertEquals(24, snapshot.get25thPercentile()); | ||
| assertEquals(74, snapshot.get75thPercentile()); | ||
| assertEquals(89, snapshot.get90thPercentile()); | ||
| assertEquals(94, snapshot.get95thPercentile()); | ||
| assertEquals(97, snapshot.get98thPercentile()); | ||
| assertEquals(98, snapshot.get99thPercentile()); | ||
| assertEquals(98, snapshot.get999thPercentile()); | ||
|
|
||
| assertEquals(51, snapshot.getCountAtOrBelow(50)); | ||
| assertEquals(100, snapshot.getCountAtOrBelow(50)); | ||
|
|
||
| // check that histogram is reset. | ||
| assertEquals(100, histogram.getCount()); // count does not reset | ||
|
|
@@ -98,5 +98,23 @@ public void testSnapshot() { | |
| assertEquals(198, snapshot.get98thPercentile()); | ||
| assertEquals(199, snapshot.get99thPercentile()); | ||
| assertEquals(199, snapshot.get999thPercentile()); | ||
|
|
||
| IntStream.range(500, 1000).forEach(histogram::update); | ||
|
|
||
| snapshot = histogram.snapshot(); | ||
|
|
||
| assertEquals(500, snapshot.getCount()); | ||
| assertEquals(749, snapshot.getMedian()); | ||
| assertEquals(749, snapshot.getMean()); | ||
| assertEquals(500, snapshot.getMin()); | ||
| assertEquals(999, snapshot.getMax()); | ||
| assertEquals(624, snapshot.get25thPercentile()); | ||
| assertEquals(874, snapshot.get75thPercentile()); | ||
| assertEquals(949, snapshot.get90thPercentile()); | ||
| assertEquals(974, snapshot.get95thPercentile()); | ||
| assertEquals(989, snapshot.get98thPercentile()); | ||
| assertEquals(994, snapshot.get99thPercentile()); | ||
| assertEquals(998, snapshot.get999thPercentile()); | ||
|
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, this is the change that required the test changes