Ejemplo n.º 1
0
        public void Setup()
        {
            if (this._dataFewLow != null)
            {
                return;
            }

            Random rand = new Random(1234567);

            this._dataFewLow   = Enumerable.Range(0, _few).Select(x => (double)rand.Next(_few)).ToArray();
            this._dataManyLow  = Enumerable.Range(0, _many).Select(x => (double)rand.Next(_few)).ToArray();
            this._dataFewHigh  = Enumerable.Range(0, _few).Select(x => (double)rand.Next(_many)).ToArray();
            this._dataManyHigh = Enumerable.Range(0, _many).Select(x => (double)rand.Next(_many)).ToArray();

            this._dataFewLowL   = this._dataFewLow.Select(x => (long)x).ToArray();
            this._dataManyLowL  = this._dataManyLow.Select(x => (long)x).ToArray();
            this._dataFewHighL  = this._dataFewHigh.Select(x => (long)x).ToArray();
            this._dataManyHighL = this._dataManyHigh.Select(x => (long)x).ToArray();

            this._p2_95Fast = new PsquareSinglePercentileAlgorithmBuilder(95, Precision.LessPreciseAndFaster);
            this._p2_99Fast = new PsquareSinglePercentileAlgorithmBuilder(99, Precision.LessPreciseAndFaster);

            this._p2_95Normal = new PsquareSinglePercentileAlgorithmBuilder(95, Precision.Normal);
            this._p2_99Normal = new PsquareSinglePercentileAlgorithmBuilder(99, Precision.Normal);

            this._ckms_95lowPrec  = new ConstantErrorBasicCKMSBuilder(0.001, new double[] { 95 });
            this._ckms_95highPrec = new ConstantErrorBasicCKMSBuilder(0.000001, new double[] { 95 });

            this._hdr_low  = new IntHistogram(Int32.MaxValue / 2, 0);
            this._hdr_high = new IntHistogram(Int32.MaxValue, 0);

            this._tDigest = new TDigest();
        }
Ejemplo n.º 2
0
 public override IEnumerable<IHistogram> GetHistograms()
 {
     IntHistogram histogram = new IntHistogram(this, "Grayscale");
     foreach (GrayscalePixel pixel in this)
     {
         histogram.Add(pixel.Level);
     }
     yield return histogram;
 }
        public void Can_add_IntHistogram_with_values_in_range()
        {
            var intHistogram = new IntHistogram(short.MaxValue-1, 3);
            intHistogram.RecordValueWithCount(1, 100);
            intHistogram.RecordValueWithCount(short.MaxValue-1, 1000);

            var shortHistogram = new ShortHistogram(short.MaxValue-1, 3);
            shortHistogram.Add(intHistogram);

            HistogramAssert.AreValueEqual(intHistogram, shortHistogram);
        }
        public int HdrHistogramLow()
        {
            int res = 0;

            for (int i = 0; i < _allocCount; i++)
            {
                var obj = new IntHistogram(Int32.MaxValue / 2, 0);
                obj.RecordValue(1L);
                obj.RecordValue(2L);
                res += obj.GetHashCode();
            }

            return(res);
        }
Ejemplo n.º 5
0
        public void testScaledCopy()
        {
            Histogram histogram = new Histogram(1000, highestTrackableValue, numberOfSignificantValueDigits);

            histogram.recordValue(testValueLevel);
            histogram.recordValue(testValueLevel * 10);
            histogram.recordValueWithExpectedInterval(histogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copy of scaled Histogram:");
            assertEqual(histogram, histogram.copy());

            IntHistogram intHistogram = new IntHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);

            intHistogram.recordValue(testValueLevel);
            intHistogram.recordValue(testValueLevel * 10);
            intHistogram.recordValueWithExpectedInterval(intHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copy of scaled IntHistogram:");
            assertEqual(intHistogram, intHistogram.copy());

            ShortHistogram shortHistogram = new ShortHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);

            shortHistogram.recordValue(testValueLevel);
            shortHistogram.recordValue(testValueLevel * 10);
            shortHistogram.recordValueWithExpectedInterval(shortHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copy of scaled ShortHistogram:");
            assertEqual(shortHistogram, shortHistogram.copy());

            AtomicHistogram atomicHistogram = new AtomicHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);

            atomicHistogram.recordValue(testValueLevel);
            atomicHistogram.recordValue(testValueLevel * 10);
            atomicHistogram.recordValueWithExpectedInterval(atomicHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copy of scaled AtomicHistogram:");
            assertEqual(atomicHistogram, atomicHistogram.copy());

            SynchronizedHistogram syncHistogram = new SynchronizedHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);

            syncHistogram.recordValue(testValueLevel);
            syncHistogram.recordValue(testValueLevel * 10);
            syncHistogram.recordValueWithExpectedInterval(syncHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copy of scaled SynchronizedHistogram:");
            assertEqual(syncHistogram, syncHistogram.copy());
        }
Ejemplo n.º 6
0
        public override IEnumerable<IHistogram> GetHistograms()
        {
            IntHistogram redHistogram = new IntHistogram(this, "Red");
            IntHistogram greenHistogram = new IntHistogram(this, "Green");
            IntHistogram blueHistogram = new IntHistogram(this, "Blue");

            foreach (RgbPixel pixel in this)
            {
                redHistogram.Add(pixel.Red);
                greenHistogram.Add(pixel.Green);
                blueHistogram.Add(pixel.Blue);
            }

            yield return redHistogram;
            yield return greenHistogram;
            yield return blueHistogram;
        }
        public Recording32BitBenchmark()
        {
            const int lowestTrackableValue           = 1;
            var       highestTrackableValue          = TimeStamp.Minutes(10);
            const int numberOfSignificantValueDigits = 3;

            _testValues = TestValues(highestTrackableValue);

            _longHistogram  = new LongHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            _intHistogram   = new IntHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            _shortHistogram = new ShortHistogram(highestTrackableValue, numberOfSignificantValueDigits);

            _longConcurrentHistogram = new LongConcurrentHistogram(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits);
            _intConcurrentHistogram  = new IntConcurrentHistogram(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits);

            _longRecorder           = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new LongHistogram(id, low, hi, sf));
            _longConcurrentRecorder = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new LongConcurrentHistogram(id, low, hi, sf));
            _intRecorder            = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new IntHistogram(id, low, hi, sf));
            _intConcurrentRecorder  = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new IntConcurrentHistogram(id, low, hi, sf));
            _shortRecorder          = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new ShortHistogram(id, low, hi, sf));
        }
        public Recording32BitBenchmark()
        {
            const int lowestTrackableValue = 1;
            var highestTrackableValue = TimeStamp.Minutes(10);
            const int numberOfSignificantValueDigits = 3;

            _testValues = TestValues(highestTrackableValue);
            
            _longHistogram = new LongHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            _intHistogram = new IntHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            _shortHistogram = new ShortHistogram(highestTrackableValue, numberOfSignificantValueDigits);

            _longConcurrentHistogram = new LongConcurrentHistogram(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits);
            _intConcurrentHistogram = new IntConcurrentHistogram(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits);

            _longRecorder = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new LongHistogram(id, low, hi, sf));
            _longConcurrentRecorder = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new LongConcurrentHistogram(id, low, hi, sf));
            _intRecorder = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new IntHistogram(id, low, hi, sf));
            _intConcurrentRecorder = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new IntConcurrentHistogram(id, low, hi, sf));
            _shortRecorder = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new ShortHistogram(id, low, hi, sf));
        }
Ejemplo n.º 9
0
        public void TestScaledCopy()
        {
            var longHistogram = new LongHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);

            longHistogram.RecordValue(TestValueLevel);
            longHistogram.RecordValue(TestValueLevel * 10);
            longHistogram.RecordValueWithExpectedInterval(longHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copy of scaled Histogram:");
            AssertEqual(longHistogram, longHistogram.Copy());

            var intHistogram = new IntHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);

            intHistogram.RecordValue(TestValueLevel);
            intHistogram.RecordValue(TestValueLevel * 10);
            intHistogram.RecordValueWithExpectedInterval(intHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copy of scaled IntHistogram:");
            AssertEqual(intHistogram, intHistogram.Copy());

            var shortHistogram = new ShortHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);

            shortHistogram.RecordValue(TestValueLevel);
            shortHistogram.RecordValue(TestValueLevel * 10);
            shortHistogram.RecordValueWithExpectedInterval(shortHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copy of scaled ShortHistogram:");
            AssertEqual(shortHistogram, shortHistogram.Copy());

            var syncHistogram = new SynchronizedHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);

            syncHistogram.RecordValue(TestValueLevel);
            syncHistogram.RecordValue(TestValueLevel * 10);
            syncHistogram.RecordValueWithExpectedInterval(syncHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copy of scaled SynchronizedHistogram:");
            AssertEqual(syncHistogram, syncHistogram.Copy());
        }
Ejemplo n.º 10
0
        public void testHistogramEncoding() //throws Exception 
        {
            ShortHistogram shortHistogram = new ShortHistogram(highestTrackableValue, 3);
            IntHistogram intHistogram = new IntHistogram(highestTrackableValue, 3);
            Histogram histogram = new Histogram(highestTrackableValue, 3);
            AtomicHistogram atomicHistogram = new AtomicHistogram(highestTrackableValue, 3);
            SynchronizedHistogram synchronizedHistogram = new SynchronizedHistogram(highestTrackableValue, 3);

            for (int i = 0; i < 10000; i++) {
                shortHistogram.recordValueWithExpectedInterval(1000 /* 1 msec */, 10000 /* 10 msec expected interval */);
                intHistogram.recordValueWithExpectedInterval(2000 /* 1 msec */, 10000 /* 10 msec expected interval */);
                histogram.recordValueWithExpectedInterval(3000 /* 1 msec */, 10000 /* 10 msec expected interval */);
                atomicHistogram.recordValueWithExpectedInterval(4000 /* 1 msec */, 10000 /* 10 msec expected interval */);
                synchronizedHistogram.recordValueWithExpectedInterval(5000 /* 1 msec */, 10000 /* 10 msec expected interval */);
            }

            Console.WriteLine("\n\nTesting encoding of a ShortHistogram:");
            ByteBuffer targetBuffer = ByteBuffer.allocate(shortHistogram.getNeededByteBufferCapacity());
            shortHistogram.encodeIntoByteBuffer(targetBuffer);
            //Console.WriteLine("After ENCODING TargetBuffer length = {0} (position {1}), shortHistogram size = {2}",
            //                targetBuffer.capacity(), targetBuffer.position(), shortHistogram.getTotalCount());
            targetBuffer.rewind();

            ShortHistogram shortHistogram2 = ShortHistogram.decodeFromByteBuffer(targetBuffer, 0);
            Assert.assertEquals(shortHistogram, shortHistogram2);

            ByteBuffer targetCompressedBuffer = ByteBuffer.allocate(shortHistogram.getNeededByteBufferCapacity());
            shortHistogram.encodeIntoCompressedByteBuffer(targetCompressedBuffer);
            targetCompressedBuffer.rewind();

            ShortHistogram shortHistogram3 = ShortHistogram.decodeFromCompressedByteBuffer(targetCompressedBuffer, 0);
            Assert.assertEquals(shortHistogram, shortHistogram3);

            Console.WriteLine("\n\nTesting encoding of a IntHistogram:");
            targetBuffer = ByteBuffer.allocate(intHistogram.getNeededByteBufferCapacity());
            intHistogram.encodeIntoByteBuffer(targetBuffer);
            //Console.WriteLine("After ENCODING TargetBuffer length = {0} (position = {1}), intHistogram size = {2}", 
            //                targetBuffer.capacity(), targetBuffer.position(), intHistogram.getTotalCount());
            targetBuffer.rewind();

            IntHistogram intHistogram2 = IntHistogram.decodeFromByteBuffer(targetBuffer, 0);
            Assert.assertEquals(intHistogram, intHistogram2);

            targetCompressedBuffer = ByteBuffer.allocate(intHistogram.getNeededByteBufferCapacity());
            intHistogram.encodeIntoCompressedByteBuffer(targetCompressedBuffer);
            targetCompressedBuffer.rewind();

            IntHistogram intHistogram3 = IntHistogram.decodeFromCompressedByteBuffer(targetCompressedBuffer, 0);
            Assert.assertEquals(intHistogram, intHistogram3);

            Console.WriteLine("\n\nTesting encoding of a Histogram (long):");
            targetBuffer = ByteBuffer.allocate(histogram.getNeededByteBufferCapacity());
            histogram.encodeIntoByteBuffer(targetBuffer);
            //Console.WriteLine("After ENCODING TargetBuffer length = {0} (position = {1}), histogram size = {2}",
            //                targetBuffer.capacity(), targetBuffer.position(), histogram.getTotalCount());
            targetBuffer.rewind();

            Histogram histogram2 = Histogram.decodeFromByteBuffer(targetBuffer, 0);
            Assert.assertEquals(histogram, histogram2);

            targetCompressedBuffer = ByteBuffer.allocate(histogram.getNeededByteBufferCapacity());
            histogram.encodeIntoCompressedByteBuffer(targetCompressedBuffer);
            targetCompressedBuffer.rewind();

            Histogram histogram3 = Histogram.decodeFromCompressedByteBuffer(targetCompressedBuffer, 0);
            Assert.assertEquals(histogram, histogram3);

            Console.WriteLine("\n\nTesting encoding of a AtomicHistogram (long):");
            targetBuffer = ByteBuffer.allocate(atomicHistogram.getNeededByteBufferCapacity());
            atomicHistogram.encodeIntoByteBuffer(targetBuffer);
            //Console.WriteLine("After ENCODING TargetBuffer length = {0} (position {1}), atomicHistogram size = {2}",
            //                targetBuffer.capacity(), targetBuffer.position(), atomicHistogram.getTotalCount());
            targetBuffer.rewind();

            AtomicHistogram atomicHistogram2 = AtomicHistogram.decodeFromByteBuffer(targetBuffer, 0);
            Assert.assertEquals(atomicHistogram, atomicHistogram2);

            targetCompressedBuffer = ByteBuffer.allocate(atomicHistogram.getNeededByteBufferCapacity());
            atomicHistogram.encodeIntoCompressedByteBuffer(targetCompressedBuffer);
            targetCompressedBuffer.rewind();

            AtomicHistogram atomicHistogram3 = AtomicHistogram.decodeFromCompressedByteBuffer(targetCompressedBuffer, 0);
            Assert.assertEquals(atomicHistogram, atomicHistogram3);

            Console.WriteLine("\n\nTesting encoding of a SynchronizedHistogram:");
            targetBuffer = ByteBuffer.allocate(synchronizedHistogram.getNeededByteBufferCapacity());
            synchronizedHistogram.encodeIntoByteBuffer(targetBuffer);
            //Console.WriteLine("After ENCODING TargetBuffer length = {0} (position {1}), synchronizedHistogram size = {2}",
            //                targetBuffer.capacity(), targetBuffer.position(), synchronizedHistogram.getTotalCount());
            targetBuffer.rewind();

            SynchronizedHistogram synchronizedHistogram2 = SynchronizedHistogram.decodeFromByteBuffer(targetBuffer, 0);
            Assert.assertEquals(synchronizedHistogram, synchronizedHistogram2);

            targetCompressedBuffer = ByteBuffer.allocate(synchronizedHistogram.getNeededByteBufferCapacity());
            synchronizedHistogram.encodeIntoCompressedByteBuffer(targetCompressedBuffer);
            targetCompressedBuffer.rewind();

            SynchronizedHistogram synchronizedHistogram3 = SynchronizedHistogram.decodeFromCompressedByteBuffer(targetCompressedBuffer, 0);
            Assert.assertEquals(synchronizedHistogram, synchronizedHistogram3);
        }
Ejemplo n.º 11
0
        public void testHistogramEncoding() //throws Exception
        {
            ShortHistogram        shortHistogram        = new ShortHistogram(highestTrackableValue, 3);
            IntHistogram          intHistogram          = new IntHistogram(highestTrackableValue, 3);
            Histogram             histogram             = new Histogram(highestTrackableValue, 3);
            AtomicHistogram       atomicHistogram       = new AtomicHistogram(highestTrackableValue, 3);
            SynchronizedHistogram synchronizedHistogram = new SynchronizedHistogram(highestTrackableValue, 3);

            for (int i = 0; i < 10000; i++)
            {
                shortHistogram.recordValueWithExpectedInterval(1000 /* 1 msec */, 10000 /* 10 msec expected interval */);
                intHistogram.recordValueWithExpectedInterval(2000 /* 1 msec */, 10000 /* 10 msec expected interval */);
                histogram.recordValueWithExpectedInterval(3000 /* 1 msec */, 10000 /* 10 msec expected interval */);
                atomicHistogram.recordValueWithExpectedInterval(4000 /* 1 msec */, 10000 /* 10 msec expected interval */);
                synchronizedHistogram.recordValueWithExpectedInterval(5000 /* 1 msec */, 10000 /* 10 msec expected interval */);
            }

            Console.WriteLine("\n\nTesting encoding of a ShortHistogram:");
            ByteBuffer targetBuffer = ByteBuffer.allocate(shortHistogram.getNeededByteBufferCapacity());

            shortHistogram.encodeIntoByteBuffer(targetBuffer);
            //Console.WriteLine("After ENCODING TargetBuffer length = {0} (position {1}), shortHistogram size = {2}",
            //                targetBuffer.capacity(), targetBuffer.position(), shortHistogram.getTotalCount());
            targetBuffer.rewind();

            ShortHistogram shortHistogram2 = ShortHistogram.decodeFromByteBuffer(targetBuffer, 0);

            Assert.assertEquals(shortHistogram, shortHistogram2);

            ByteBuffer targetCompressedBuffer = ByteBuffer.allocate(shortHistogram.getNeededByteBufferCapacity());

            shortHistogram.encodeIntoCompressedByteBuffer(targetCompressedBuffer);
            targetCompressedBuffer.rewind();

            ShortHistogram shortHistogram3 = ShortHistogram.decodeFromCompressedByteBuffer(targetCompressedBuffer, 0);

            Assert.assertEquals(shortHistogram, shortHistogram3);

            Console.WriteLine("\n\nTesting encoding of a IntHistogram:");
            targetBuffer = ByteBuffer.allocate(intHistogram.getNeededByteBufferCapacity());
            intHistogram.encodeIntoByteBuffer(targetBuffer);
            //Console.WriteLine("After ENCODING TargetBuffer length = {0} (position = {1}), intHistogram size = {2}",
            //                targetBuffer.capacity(), targetBuffer.position(), intHistogram.getTotalCount());
            targetBuffer.rewind();

            IntHistogram intHistogram2 = IntHistogram.decodeFromByteBuffer(targetBuffer, 0);

            Assert.assertEquals(intHistogram, intHistogram2);

            targetCompressedBuffer = ByteBuffer.allocate(intHistogram.getNeededByteBufferCapacity());
            intHistogram.encodeIntoCompressedByteBuffer(targetCompressedBuffer);
            targetCompressedBuffer.rewind();

            IntHistogram intHistogram3 = IntHistogram.decodeFromCompressedByteBuffer(targetCompressedBuffer, 0);

            Assert.assertEquals(intHistogram, intHistogram3);

            Console.WriteLine("\n\nTesting encoding of a Histogram (long):");
            targetBuffer = ByteBuffer.allocate(histogram.getNeededByteBufferCapacity());
            histogram.encodeIntoByteBuffer(targetBuffer);
            //Console.WriteLine("After ENCODING TargetBuffer length = {0} (position = {1}), histogram size = {2}",
            //                targetBuffer.capacity(), targetBuffer.position(), histogram.getTotalCount());
            targetBuffer.rewind();

            Histogram histogram2 = Histogram.decodeFromByteBuffer(targetBuffer, 0);

            Assert.assertEquals(histogram, histogram2);

            targetCompressedBuffer = ByteBuffer.allocate(histogram.getNeededByteBufferCapacity());
            histogram.encodeIntoCompressedByteBuffer(targetCompressedBuffer);
            targetCompressedBuffer.rewind();

            Histogram histogram3 = Histogram.decodeFromCompressedByteBuffer(targetCompressedBuffer, 0);

            Assert.assertEquals(histogram, histogram3);

            Console.WriteLine("\n\nTesting encoding of a AtomicHistogram (long):");
            targetBuffer = ByteBuffer.allocate(atomicHistogram.getNeededByteBufferCapacity());
            atomicHistogram.encodeIntoByteBuffer(targetBuffer);
            //Console.WriteLine("After ENCODING TargetBuffer length = {0} (position {1}), atomicHistogram size = {2}",
            //                targetBuffer.capacity(), targetBuffer.position(), atomicHistogram.getTotalCount());
            targetBuffer.rewind();

            AtomicHistogram atomicHistogram2 = AtomicHistogram.decodeFromByteBuffer(targetBuffer, 0);

            Assert.assertEquals(atomicHistogram, atomicHistogram2);

            targetCompressedBuffer = ByteBuffer.allocate(atomicHistogram.getNeededByteBufferCapacity());
            atomicHistogram.encodeIntoCompressedByteBuffer(targetCompressedBuffer);
            targetCompressedBuffer.rewind();

            AtomicHistogram atomicHistogram3 = AtomicHistogram.decodeFromCompressedByteBuffer(targetCompressedBuffer, 0);

            Assert.assertEquals(atomicHistogram, atomicHistogram3);

            Console.WriteLine("\n\nTesting encoding of a SynchronizedHistogram:");
            targetBuffer = ByteBuffer.allocate(synchronizedHistogram.getNeededByteBufferCapacity());
            synchronizedHistogram.encodeIntoByteBuffer(targetBuffer);
            //Console.WriteLine("After ENCODING TargetBuffer length = {0} (position {1}), synchronizedHistogram size = {2}",
            //                targetBuffer.capacity(), targetBuffer.position(), synchronizedHistogram.getTotalCount());
            targetBuffer.rewind();

            SynchronizedHistogram synchronizedHistogram2 = SynchronizedHistogram.decodeFromByteBuffer(targetBuffer, 0);

            Assert.assertEquals(synchronizedHistogram, synchronizedHistogram2);

            targetCompressedBuffer = ByteBuffer.allocate(synchronizedHistogram.getNeededByteBufferCapacity());
            synchronizedHistogram.encodeIntoCompressedByteBuffer(targetCompressedBuffer);
            targetCompressedBuffer.rewind();

            SynchronizedHistogram synchronizedHistogram3 = SynchronizedHistogram.decodeFromCompressedByteBuffer(targetCompressedBuffer, 0);

            Assert.assertEquals(synchronizedHistogram, synchronizedHistogram3);
        }
Ejemplo n.º 12
0
        public void TestScaledCopyInto()
        {
            var longHistogram = new LongHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetLongHistogram = new LongHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);
            longHistogram.RecordValue(TestValueLevel);
            longHistogram.RecordValue(TestValueLevel * 10);
            longHistogram.RecordValueWithExpectedInterval(longHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copyInto for scaled Histogram:");
            longHistogram.CopyInto(targetLongHistogram);
            AssertEqual(longHistogram, targetLongHistogram);

            longHistogram.RecordValue(TestValueLevel * 20);

            longHistogram.CopyInto(targetLongHistogram);
            AssertEqual(longHistogram, targetLongHistogram);

            var intHistogram = new IntHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetIntHistogram = new IntHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);
            intHistogram.RecordValue(TestValueLevel);
            intHistogram.RecordValue(TestValueLevel * 10);
            intHistogram.RecordValueWithExpectedInterval(intHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copyInto for scaled IntHistogram:");
            intHistogram.CopyInto(targetIntHistogram);
            AssertEqual(intHistogram, targetIntHistogram);

            intHistogram.RecordValue(TestValueLevel * 20);

            intHistogram.CopyInto(targetIntHistogram);
            AssertEqual(intHistogram, targetIntHistogram);

            var shortHistogram = new ShortHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetShortHistogram = new ShortHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);
            shortHistogram.RecordValue(TestValueLevel);
            shortHistogram.RecordValue(TestValueLevel * 10);
            shortHistogram.RecordValueWithExpectedInterval(shortHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copyInto for scaled ShortHistogram:");
            shortHistogram.CopyInto(targetShortHistogram);
            AssertEqual(shortHistogram, targetShortHistogram);

            shortHistogram.RecordValue(TestValueLevel * 20);

            shortHistogram.CopyInto(targetShortHistogram);
            AssertEqual(shortHistogram, targetShortHistogram);

            var syncHistogram = new SynchronizedHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetSyncHistogram = new SynchronizedHistogram(1000, HighestTrackableValue, NumberOfSignificantValueDigits);
            syncHistogram.RecordValue(TestValueLevel);
            syncHistogram.RecordValue(TestValueLevel * 10);
            syncHistogram.RecordValueWithExpectedInterval(syncHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copyInto for scaled SynchronizedHistogram:");
            syncHistogram.CopyInto(targetSyncHistogram);
            AssertEqual(syncHistogram, targetSyncHistogram);

            syncHistogram.RecordValue(TestValueLevel * 20);

            syncHistogram.CopyInto(targetSyncHistogram);
            AssertEqual(syncHistogram, targetSyncHistogram);
        }
Ejemplo n.º 13
0
        public void TestCopyInto()
        {
            var longHistogram = new LongHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetLongHistogram = new LongHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            longHistogram.RecordValue(TestValueLevel);
            longHistogram.RecordValue(TestValueLevel * 10);
            longHistogram.RecordValueWithExpectedInterval(longHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copyInto for Histogram:");
            longHistogram.CopyInto(targetLongHistogram);
            AssertEqual(longHistogram, targetLongHistogram);

            longHistogram.RecordValue(TestValueLevel * 20);

            longHistogram.CopyInto(targetLongHistogram);
            AssertEqual(longHistogram, targetLongHistogram);

            var intHistogram = new IntHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetIntHistogram = new IntHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            intHistogram.RecordValue(TestValueLevel);
            intHistogram.RecordValue(TestValueLevel * 10);
            intHistogram.RecordValueWithExpectedInterval(intHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copyInto for IntHistogram:");
            intHistogram.CopyInto(targetIntHistogram);
            AssertEqual(intHistogram, targetIntHistogram);

            intHistogram.RecordValue(TestValueLevel * 20);

            intHistogram.CopyInto(targetIntHistogram);
            AssertEqual(intHistogram, targetIntHistogram);

            var shortHistogram = new ShortHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetShortHistogram = new ShortHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            shortHistogram.RecordValue(TestValueLevel);
            shortHistogram.RecordValue(TestValueLevel * 10);
            shortHistogram.RecordValueWithExpectedInterval(shortHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copyInto for ShortHistogram:");
            shortHistogram.CopyInto(targetShortHistogram);
            AssertEqual(shortHistogram, targetShortHistogram);

            shortHistogram.RecordValue(TestValueLevel * 20);

            shortHistogram.CopyInto(targetShortHistogram);
            AssertEqual(shortHistogram, targetShortHistogram);

            Console.WriteLine("Testing copyInto for AtomicHistogram:");

            var syncHistogram = new SynchronizedHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetSyncHistogram = new SynchronizedHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            syncHistogram.RecordValue(TestValueLevel);
            syncHistogram.RecordValue(TestValueLevel * 10);
            syncHistogram.RecordValueWithExpectedInterval(syncHistogram.HighestTrackableValue - 1, 31000); // Should this really be 31, if it is the test takes 1min!!!);

            Console.WriteLine("Testing copyInto for SynchronizedHistogram:");
            syncHistogram.CopyInto(targetSyncHistogram);
            AssertEqual(syncHistogram, targetSyncHistogram);

            syncHistogram.RecordValue(TestValueLevel * 20);

            syncHistogram.CopyInto(targetSyncHistogram);
            AssertEqual(syncHistogram, targetSyncHistogram);
        }
Ejemplo n.º 14
0
        public void TestCopy()
        {
            var longHistogram = new LongHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            longHistogram.RecordValue(TestValueLevel);
            longHistogram.RecordValue(TestValueLevel * 10);
            longHistogram.RecordValueWithExpectedInterval(longHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copy of Histogram:");
            AssertEqual(longHistogram, longHistogram.Copy());

            var intHistogram = new IntHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            intHistogram.RecordValue(TestValueLevel);
            intHistogram.RecordValue(TestValueLevel * 10);
            intHistogram.RecordValueWithExpectedInterval(intHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copy of IntHistogram:");
            AssertEqual(intHistogram, intHistogram.Copy());

            var shortHistogram = new ShortHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            shortHistogram.RecordValue(TestValueLevel);
            shortHistogram.RecordValue(TestValueLevel * 10);
            shortHistogram.RecordValueWithExpectedInterval(shortHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copy of ShortHistogram:");
            AssertEqual(shortHistogram, shortHistogram.Copy());

            var syncHistogram = new SynchronizedHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            syncHistogram.RecordValue(TestValueLevel);
            syncHistogram.RecordValue(TestValueLevel * 10);
            syncHistogram.RecordValueWithExpectedInterval(syncHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copy of SynchronizedHistogram:");
            AssertEqual(syncHistogram, syncHistogram.Copy());
        }
Ejemplo n.º 15
0
        public void testCopyInto()
        {
            Histogram histogram       = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
            Histogram targetHistogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);

            histogram.recordValue(testValueLevel);
            histogram.recordValue(testValueLevel * 10);
            histogram.recordValueWithExpectedInterval(histogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for Histogram:");
            histogram.copyInto(targetHistogram);
            assertEqual(histogram, targetHistogram);

            histogram.recordValue(testValueLevel * 20);

            histogram.copyInto(targetHistogram);
            assertEqual(histogram, targetHistogram);

            IntHistogram intHistogram       = new IntHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            IntHistogram targetIntHistogram = new IntHistogram(highestTrackableValue, numberOfSignificantValueDigits);

            intHistogram.recordValue(testValueLevel);
            intHistogram.recordValue(testValueLevel * 10);
            intHistogram.recordValueWithExpectedInterval(intHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for IntHistogram:");
            intHistogram.copyInto(targetIntHistogram);
            assertEqual(intHistogram, targetIntHistogram);

            intHistogram.recordValue(testValueLevel * 20);

            intHistogram.copyInto(targetIntHistogram);
            assertEqual(intHistogram, targetIntHistogram);

            ShortHistogram shortHistogram       = new ShortHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            ShortHistogram targetShortHistogram = new ShortHistogram(highestTrackableValue, numberOfSignificantValueDigits);

            shortHistogram.recordValue(testValueLevel);
            shortHistogram.recordValue(testValueLevel * 10);
            shortHistogram.recordValueWithExpectedInterval(shortHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for ShortHistogram:");
            shortHistogram.copyInto(targetShortHistogram);
            assertEqual(shortHistogram, targetShortHistogram);

            shortHistogram.recordValue(testValueLevel * 20);

            shortHistogram.copyInto(targetShortHistogram);
            assertEqual(shortHistogram, targetShortHistogram);

            AtomicHistogram atomicHistogram       = new AtomicHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            AtomicHistogram targetAtomicHistogram = new AtomicHistogram(highestTrackableValue, numberOfSignificantValueDigits);

            atomicHistogram.recordValue(testValueLevel);
            atomicHistogram.recordValue(testValueLevel * 10);
            atomicHistogram.recordValueWithExpectedInterval(atomicHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for AtomicHistogram:");
            atomicHistogram.copyInto(targetAtomicHistogram);
            assertEqual(atomicHistogram, targetAtomicHistogram);

            atomicHistogram.recordValue(testValueLevel * 20);

            atomicHistogram.copyInto(targetAtomicHistogram);
            assertEqual(atomicHistogram, targetAtomicHistogram);

            SynchronizedHistogram syncHistogram       = new SynchronizedHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            SynchronizedHistogram targetSyncHistogram = new SynchronizedHistogram(highestTrackableValue, numberOfSignificantValueDigits);

            syncHistogram.recordValue(testValueLevel);
            syncHistogram.recordValue(testValueLevel * 10);
            syncHistogram.recordValueWithExpectedInterval(syncHistogram.getHighestTrackableValue() - 1, 31000); // Should this really be 31, if it is the test takes 1min!!!);

            Console.WriteLine("Testing copyInto for SynchronizedHistogram:");
            syncHistogram.copyInto(targetSyncHistogram);
            assertEqual(syncHistogram, targetSyncHistogram);

            syncHistogram.recordValue(testValueLevel * 20);

            syncHistogram.copyInto(targetSyncHistogram);
            assertEqual(syncHistogram, targetSyncHistogram);
        }
Ejemplo n.º 16
0
 public HdrHistogramBuilder(int highestTrackableValue, int numberOfSignificantValueDigits, double[] desiredPercentiles = null)
 {
     _desiredPercentiles = desiredPercentiles ?? Constants.DefaultPercentiles;
     _histogram          = new IntHistogram(highestTrackableValue, numberOfSignificantValueDigits);
 }
Ejemplo n.º 17
0
        public void testCopy()
        {
            Histogram histogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
            histogram.recordValue(testValueLevel);
            histogram.recordValue(testValueLevel * 10);
            histogram.recordValueWithExpectedInterval(histogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copy of Histogram:");
            assertEqual(histogram, histogram.copy());

            IntHistogram intHistogram = new IntHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            intHistogram.recordValue(testValueLevel);
            intHistogram.recordValue(testValueLevel * 10);
            intHistogram.recordValueWithExpectedInterval(intHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copy of IntHistogram:");
            assertEqual(intHistogram, intHistogram.copy());

            ShortHistogram shortHistogram = new ShortHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            shortHistogram.recordValue(testValueLevel);
            shortHistogram.recordValue(testValueLevel * 10);
            shortHistogram.recordValueWithExpectedInterval(shortHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copy of ShortHistogram:");
            assertEqual(shortHistogram, shortHistogram.copy());

            AtomicHistogram atomicHistogram = new AtomicHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            atomicHistogram.recordValue(testValueLevel);
            atomicHistogram.recordValue(testValueLevel * 10);
            atomicHistogram.recordValueWithExpectedInterval(atomicHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copy of AtomicHistogram:");
            assertEqual(atomicHistogram, atomicHistogram.copy());

            SynchronizedHistogram syncHistogram = new SynchronizedHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            syncHistogram.recordValue(testValueLevel);
            syncHistogram.recordValue(testValueLevel * 10);
            syncHistogram.recordValueWithExpectedInterval(syncHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copy of SynchronizedHistogram:");
            assertEqual(syncHistogram, syncHistogram.copy());
        }
Ejemplo n.º 18
0
        public void TestCopyInto()
        {
            var longHistogram       = new LongHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetLongHistogram = new LongHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);

            longHistogram.RecordValue(TestValueLevel);
            longHistogram.RecordValue(TestValueLevel * 10);
            longHistogram.RecordValueWithExpectedInterval(longHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copyInto for Histogram:");
            longHistogram.CopyInto(targetLongHistogram);
            AssertEqual(longHistogram, targetLongHistogram);

            longHistogram.RecordValue(TestValueLevel * 20);

            longHistogram.CopyInto(targetLongHistogram);
            AssertEqual(longHistogram, targetLongHistogram);

            var intHistogram       = new IntHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetIntHistogram = new IntHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);

            intHistogram.RecordValue(TestValueLevel);
            intHistogram.RecordValue(TestValueLevel * 10);
            intHistogram.RecordValueWithExpectedInterval(intHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copyInto for IntHistogram:");
            intHistogram.CopyInto(targetIntHistogram);
            AssertEqual(intHistogram, targetIntHistogram);

            intHistogram.RecordValue(TestValueLevel * 20);

            intHistogram.CopyInto(targetIntHistogram);
            AssertEqual(intHistogram, targetIntHistogram);

            var shortHistogram       = new ShortHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetShortHistogram = new ShortHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);

            shortHistogram.RecordValue(TestValueLevel);
            shortHistogram.RecordValue(TestValueLevel * 10);
            shortHistogram.RecordValueWithExpectedInterval(shortHistogram.HighestTrackableValue - 1, 31000);

            Console.WriteLine("Testing copyInto for ShortHistogram:");
            shortHistogram.CopyInto(targetShortHistogram);
            AssertEqual(shortHistogram, targetShortHistogram);

            shortHistogram.RecordValue(TestValueLevel * 20);

            shortHistogram.CopyInto(targetShortHistogram);
            AssertEqual(shortHistogram, targetShortHistogram);

            Console.WriteLine("Testing copyInto for AtomicHistogram:");

            var syncHistogram       = new SynchronizedHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);
            var targetSyncHistogram = new SynchronizedHistogram(HighestTrackableValue, NumberOfSignificantValueDigits);

            syncHistogram.RecordValue(TestValueLevel);
            syncHistogram.RecordValue(TestValueLevel * 10);
            syncHistogram.RecordValueWithExpectedInterval(syncHistogram.HighestTrackableValue - 1, 31000); // Should this really be 31, if it is the test takes 1min!!!);

            Console.WriteLine("Testing copyInto for SynchronizedHistogram:");
            syncHistogram.CopyInto(targetSyncHistogram);
            AssertEqual(syncHistogram, targetSyncHistogram);

            syncHistogram.RecordValue(TestValueLevel * 20);

            syncHistogram.CopyInto(targetSyncHistogram);
            AssertEqual(syncHistogram, targetSyncHistogram);
        }
Ejemplo n.º 19
0
        public void testCopyInto()  
        {
            Histogram histogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
            Histogram targetHistogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
            histogram.recordValue(testValueLevel);
            histogram.recordValue(testValueLevel * 10);
            histogram.recordValueWithExpectedInterval(histogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for Histogram:");
            histogram.copyInto(targetHistogram);
            assertEqual(histogram, targetHistogram);

            histogram.recordValue(testValueLevel * 20);

            histogram.copyInto(targetHistogram);
            assertEqual(histogram, targetHistogram);

            IntHistogram intHistogram = new IntHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            IntHistogram targetIntHistogram = new IntHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            intHistogram.recordValue(testValueLevel);
            intHistogram.recordValue(testValueLevel * 10);
            intHistogram.recordValueWithExpectedInterval(intHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for IntHistogram:");
            intHistogram.copyInto(targetIntHistogram);
            assertEqual(intHistogram, targetIntHistogram);

            intHistogram.recordValue(testValueLevel * 20);

            intHistogram.copyInto(targetIntHistogram);
            assertEqual(intHistogram, targetIntHistogram);

            ShortHistogram shortHistogram = new ShortHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            ShortHistogram targetShortHistogram = new ShortHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            shortHistogram.recordValue(testValueLevel);
            shortHistogram.recordValue(testValueLevel * 10);
            shortHistogram.recordValueWithExpectedInterval(shortHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for ShortHistogram:");
            shortHistogram.copyInto(targetShortHistogram);
            assertEqual(shortHistogram, targetShortHistogram);

            shortHistogram.recordValue(testValueLevel * 20);

            shortHistogram.copyInto(targetShortHistogram);
            assertEqual(shortHistogram, targetShortHistogram);

            AtomicHistogram atomicHistogram = new AtomicHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            AtomicHistogram targetAtomicHistogram = new AtomicHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            atomicHistogram.recordValue(testValueLevel);
            atomicHistogram.recordValue(testValueLevel * 10);
            atomicHistogram.recordValueWithExpectedInterval(atomicHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for AtomicHistogram:");
            atomicHistogram.copyInto(targetAtomicHistogram);
            assertEqual(atomicHistogram, targetAtomicHistogram);

            atomicHistogram.recordValue(testValueLevel * 20);

            atomicHistogram.copyInto(targetAtomicHistogram);
            assertEqual(atomicHistogram, targetAtomicHistogram);

            SynchronizedHistogram syncHistogram = new SynchronizedHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            SynchronizedHistogram targetSyncHistogram = new SynchronizedHistogram(highestTrackableValue, numberOfSignificantValueDigits);
            syncHistogram.recordValue(testValueLevel);
            syncHistogram.recordValue(testValueLevel * 10);
            syncHistogram.recordValueWithExpectedInterval(syncHistogram.getHighestTrackableValue() - 1, 31000); // Should this really be 31, if it is the test takes 1min!!!);

            Console.WriteLine("Testing copyInto for SynchronizedHistogram:");
            syncHistogram.copyInto(targetSyncHistogram);
            assertEqual(syncHistogram, targetSyncHistogram);

            syncHistogram.recordValue(testValueLevel * 20);

            syncHistogram.copyInto(targetSyncHistogram);
            assertEqual(syncHistogram, targetSyncHistogram);
        }
Ejemplo n.º 20
0
 public MetricPublisherXEventHandler()
 {
     _latencyHistogram     = new LongHistogram(TimeStamp.Minutes(1), 3);
     _conflactionHistogram = new IntHistogram(10000, 1);
 }
Ejemplo n.º 21
0
        public void testScaledCopyInto()  
        {
            Histogram histogram = new Histogram(1000, highestTrackableValue, numberOfSignificantValueDigits);
            Histogram targetHistogram = new Histogram(1000, highestTrackableValue, numberOfSignificantValueDigits);
            histogram.recordValue(testValueLevel);
            histogram.recordValue(testValueLevel * 10);
            histogram.recordValueWithExpectedInterval(histogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for scaled Histogram:");
            histogram.copyInto(targetHistogram);
            assertEqual(histogram, targetHistogram);

            histogram.recordValue(testValueLevel * 20);

            histogram.copyInto(targetHistogram);
            assertEqual(histogram, targetHistogram);

            IntHistogram intHistogram = new IntHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);
            IntHistogram targetIntHistogram = new IntHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);
            intHistogram.recordValue(testValueLevel);
            intHistogram.recordValue(testValueLevel * 10);
            intHistogram.recordValueWithExpectedInterval(intHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for scaled IntHistogram:");
            intHistogram.copyInto(targetIntHistogram);
            assertEqual(intHistogram, targetIntHistogram);

            intHistogram.recordValue(testValueLevel * 20);

            intHistogram.copyInto(targetIntHistogram);
            assertEqual(intHistogram, targetIntHistogram);

            ShortHistogram shortHistogram = new ShortHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);
            ShortHistogram targetShortHistogram = new ShortHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);
            shortHistogram.recordValue(testValueLevel);
            shortHistogram.recordValue(testValueLevel * 10);
            shortHistogram.recordValueWithExpectedInterval(shortHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for scaled ShortHistogram:");
            shortHistogram.copyInto(targetShortHistogram);
            assertEqual(shortHistogram, targetShortHistogram);

            shortHistogram.recordValue(testValueLevel * 20);

            shortHistogram.copyInto(targetShortHistogram);
            assertEqual(shortHistogram, targetShortHistogram);

            AtomicHistogram atomicHistogram = new AtomicHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);
            AtomicHistogram targetAtomicHistogram = new AtomicHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);
            atomicHistogram.recordValue(testValueLevel);
            atomicHistogram.recordValue(testValueLevel * 10);
            atomicHistogram.recordValueWithExpectedInterval(atomicHistogram.getHighestTrackableValue() - 1, 31000);

            atomicHistogram.copyInto(targetAtomicHistogram);
            assertEqual(atomicHistogram, targetAtomicHistogram);

            atomicHistogram.recordValue(testValueLevel * 20);

            Console.WriteLine("Testing copyInto for scaled AtomicHistogram:");
            atomicHistogram.copyInto(targetAtomicHistogram);
            assertEqual(atomicHistogram, targetAtomicHistogram);

            SynchronizedHistogram syncHistogram = new SynchronizedHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);
            SynchronizedHistogram targetSyncHistogram = new SynchronizedHistogram(1000, highestTrackableValue, numberOfSignificantValueDigits);
            syncHistogram.recordValue(testValueLevel);
            syncHistogram.recordValue(testValueLevel * 10);
            syncHistogram.recordValueWithExpectedInterval(syncHistogram.getHighestTrackableValue() - 1, 31000);

            Console.WriteLine("Testing copyInto for scaled SynchronizedHistogram:");
            syncHistogram.copyInto(targetSyncHistogram);
            assertEqual(syncHistogram, targetSyncHistogram);

            syncHistogram.recordValue(testValueLevel * 20);

            syncHistogram.copyInto(targetSyncHistogram);
            assertEqual(syncHistogram, targetSyncHistogram);
        }