LeeCampbell / HdrHistogram.NET

Port of the HdrHistorgram to .NET/C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create synchronized version for each storage type

LeeCampbell opened this issue · comments

Currently only the LongHistogram has a matching synchronized version. It seems reasonable to provide implementations for short and int as well.

This feature also seems to be an appropriate time to introduce a factory to help guide consumers as to which one is appropriate e.g.

var defaultHistogram = Histogram.Factory.Create(); //Creates a LongHistogram
var synchronizedLongHistogram = Histogram.Factory.AsThreadSafe().Create(); //Creates a SynchronizedLongHistogram
var longHistogram = Histogram.Factory.AsLongBacked().Create(); //Creates a LongHistogram
var synchronizedLongHistogram2 = Histogram.Factory.AsLongBacked().AsThreadSafe().Create(); //Creates a SynchronizedLongHistogram

var intHistogram = Histogram.Factory.AsIntBacked().Create(); //Creates a IntHistogram
var synchronizedIntHistogram = Histogram.Factory.AsIntBacked().AsThreadSafe().Create(); //Creates a SynchronizedIntHistogram

var shortHistogram = Histogram.Factory.AsShortBacked().Create(); //Creates a ShortHistogram
var synchronizedShortHistogram = Histogram.Factory.AsShortBacked().AsThreadSafe().Create(); //Creates a SynchronizedShortHistogram

Effective implemented with a Recorder (single write, single reader) in HdrHistogram/HdrHistogram.NET#30 and HdrHistogram/HdrHistogram.NET#32