Skip to content

Instantly share code, notes, and snippets.

@mattwarren
Last active August 29, 2015 14:03
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mattwarren/d7e56a3709d347862141 to your computer and use it in GitHub Desktop.
HistogramAllInOneClass
using CSharp.Atomic;
using HdrHistogram.NET.Iteration;
using HdrHistogram.NET.Utilities;
using LongBuffer = HdrHistogram.NET.Utilities.WrappedBuffer<long>;
namespace HdrHistogram.NET
{
public class HistogramAllInOneClass
{
internal static readonly AtomicLong constructionIdentityCount = new AtomicLong(0);
// "Cold" accessed fields. Not used in the recording code path:
internal long identity;
internal long highestTrackableValue;
internal long lowestTrackableValue;
internal int numberOfSignificantValueDigits;
internal int bucketCount;
internal int subBucketCount;
internal int countsArrayLength;
internal int wordSizeInBytes;
internal long startTimeStampMsec;
internal long endTimeStampMsec;
internal PercentileIterator percentileIterator;
internal RecordedValuesIterator recordedValuesIterator;
internal ByteBuffer intermediateUncompressedByteBuffer = null;
protected object updateLock = new object();
// "Hot" accessed fields (used in the the value recording code path) are bunched here, such
// that they will have a good chance of ending up in the same cache line as the totalCounts and
// counts array reference fields that subclass implementations will typically add.
internal int subBucketHalfCountMagnitude;
internal int unitMagnitude;
internal int subBucketHalfCount;
internal long subBucketMask;
// Sub-classes will typically add a totalCount field and a counts array field, which will likely be laid out
// right around here due to the subclass layout rules in most practical JVM implementations.
long totalCount;
readonly long[] counts;
private LongBuffer cachedDstLongBuffer = null;
private ByteBuffer cachedDstByteBuffer = null;
private int cachedDstByteBufferPosition = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment