3 ms·
The HdrHistogram class is part of a hierarchy, to make the code more sane, to make implementing specialised versions easier (Short, Long, etc) and to enforce th
by matthewwarren 12y ago
The HdrHistogram class is part of a hierarchy, to make the code more sane, to make implementing specialised versions easier (Short, Long, etc) and to enforce the memory layout:
- AbstractHistogramBase [0]
- AbstractHistogram [1]
- Histogram (or IntHistogram, ShortHistogram)
AbstractHistogram contains all the "Hot" fields, i.e. the ones that you want to get into memory at the same time, with the least possible work. These fields are used repeatedly when storing values, which is the "Hot Path" for HdrHistogram.
AbstractHistogramBase contains a lot of fields that are only used when you are iterating or displaying results, so the idea is that they are kept out of the way when recording values.
[0] https://github.com/HdrHistogram/HdrHistogram/blob/master/src/main/java/org/HdrHistogram/AbstractHistogram.java#L32 https://github.com/HdrHistogram/HdrHistogram/blob/master/src...
[1] https://github.com/HdrHistogram/HdrHistogram/blob/master/src/main/java/org/HdrHistogram/AbstractHistogram.java#L78 https://github.com/HdrHistogram/HdrHistogram/blob/master/src...