LeeCampbell / HdrHistogram.NET

Port of the HdrHistorgram to .NET/C#
Other
18 stars 3 forks source link

Create synchronized version for each storage type #4

Closed LeeCampbell closed 7 years ago

LeeCampbell commented 8 years ago

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
LeeCampbell commented 7 years ago

Effective implemented with a Recorder (single write, single reader) in https://github.com/HdrHistogram/HdrHistogram.NET/pull/30 and https://github.com/HdrHistogram/HdrHistogram.NET/pull/32