The JavaDoc for each is specific about what they provide. AtomicHistogram provides safe multi-threaded recording in fixed sized (as opposed to autosized) histograms. It does not provide safe auto-sizing or value shifting support when multiple recording threads are involved. Also, neither AtomicHistogram nor CouncurrentHistogram support concurrent reading or querying of data (concurrent with the writers, that is). You'll want to use one of the Recorder variants if you need that.
Histograms support set/get of start/end timestamps associated with the histogram. This can be generically useful, but is most often used in logging. E.g. the Recorder class (and variants) will produce interval histograms with the start/end timestamps set to indicate the time interval covered by the histogram. And the HistogramLogWriter will interpret the start/end time stamps on the histogram when producing log output. The two are often used together (e.g. see
jHiccup for an example).
c) What is the difference between DoubleHistogram, IntCountsHistogram and ShortCountsHistogram. I can't just understand the world "resolution", I need to see clear picture with good simple example
The JavaDocs are quite specific for each. You may want to read the package Javadoc in detail, as well as the specific wording in the JavaDoc of each histogram variant.
All the histogram variants provide for recording of Values, and track the Counts of recorded values (to within the precision requested, e.g. to 3 decimal points).
Values:
Histogram, IntCountsHistogram, ShortCountsHistogram (as well as AtomicHistogram and ConcurrentHistogram, Recorder, etc.) all deal with integer (long) recorded values, regardless of the count fidelity. In contrast DoubleHistigram (and it's Concurrent variant and DoubleRecorder variants) deals with recorded values that are doubles.
Counts:
Histogram uses long counts (i.e. can track up to Long.MAX_VALUE value recordings, even within a single internal bucket with no overflow). IntCounts and ShortCounts variants use int and short counts respectively (supporting "only" up to Integer.MAX_VALUE and only up to Short,MAX_VALUE recordings before overflow, respectively). The (only) benefit on the Int and Short counts variants is reduced footprint. This matter when you are tracking 40,000 different histograms in a single process (as some do), but doesn't much matter when toy are only tracking tens or hundreds of histograms.
WriterReaderPhaser is not really needed by common users of histograms. It just happens to have a game in HdrHistogram since it doesn't (yet) belong anywhere else, and may be generically useful as a synchronization primitive. See
blog post here for details. Several classes in HdrHistogram do use WriterReaderPhaser internally though, and can be seen as good examples of using the synchronization primitive. E.g. see the implementation internals in Recorder and ConcurrentHistogram.
SingleWriterDoubleRecorder is a faster variant of DoubleRecorder that is only safe for use with a single writer (working concurrently with reader(s)). Very useful in (common) use cases where a single writer is updating values that need to be sampled and logged externally. Same goes for SingleWriterRecorder.
Yes, Histograms are useful for recording all sorts of values: queue depth/size, latencies, color/intensity, etc. HdrHistograms are especially useful when the values recorded cover a wide dynamic range while maintaining a good relative precision across the range.