These are chat archives for HdrHistogram/HdrHistogram

7th
Feb 2015
Ivan Topolnjak
@ivantopo
Feb 07 2015 02:30
Hello there guys, I have a quick question regarding the use of Recorder.getIntervalHistogram, more specifically in the meaning of this note: "NOTE: The caller is responsible for not recycling the same returned interval histogram more than once. If the same interval histogram instance is recycled more than once, behavior is undefined."
By reading through the code, it seems like every second call to getIntervalHistogram I will actually get the same Histogram instance, and what I really should do is make sure that I never recycle the same Histogram instance two consecutive times, is that correct?
Gil Tene
@giltene
Feb 07 2015 05:44
You should not recycle the same return value (from a given call) more than once. But each call gives you a separate return value.
Ivan Topolnjak
@ivantopo
Feb 07 2015 05:46
thanks Gil, so now I have something similar to recycleHistogram = recorder.getIntervalHistogram(recycleHistogram) that runs when I take the interval histogram
Gil Tene
@giltene
Feb 07 2015 05:46
And yes, in typical use the return value of every second call will be a reference to the same histogram instance. Recycling each return value (even when it is the same as a previous one) doesn't count as recycling the same return value twice...
Ivan Topolnjak
@ivantopo
Feb 07 2015 05:47
(y)
I just removed our old live histogram snapshot code in favor of Recorder, thanks for that addition!
Gil Tene
@giltene
Feb 07 2015 05:50
Yes, that's how it is meant to be used. I just call it intervalHistogram instead of recycleHistogram. As is intervalHistogram = recorder.getIntervalHistogram(intervalHistogram);
Ivan Topolnjak
@ivantopo
Feb 07 2015 07:15
thanks for the help, Gil