예제 #1
0
        public IValue Measure(IValue value)
        {
            var distributionValue = (DistributionValue)value;

            _histogram.RecordValue(distributionValue._value);
            return(new DistributionValue(0, _histogram));
        }
 private static void RecordLoop(HistogramBase histogram, long loopCount)
 {
     for (long i = 0; i < loopCount; i++)
     {
         histogram.RecordValue(TestValueLevel + (i & 0x8000));
     }
 }
 private static void LoadHistogram(HistogramBase histogram)
 {
     for (int i = 0; i < 10000; i += 1000)
     {
         histogram.RecordValue(i);
     }
 }
예제 #4
0
        static void WorkerJob()
        {
            // Use a stopwatch to count how much time has elapsed
            // so we can exit the loop
            Stopwatch sw = new Stopwatch();

            sw.Start();

            byte[]        baseMem = new byte[baseMemUsage * 1024 * 1024];
            List <byte[]> list    = new List <byte[]>();

            while (sw.ElapsedMilliseconds < runDurationSec * 1000)
            {
                while (list.Count * allocationSizeKB < memSizeMB * 1024)
                {
                    // Surround the byte array allocation (to approximate pause time) with extremely
                    // accurate tick counters
                    long startTimestamp = Stopwatch.GetTimestamp();

                    byte[] byteArray = new byte[allocationSizeKB * 1024];

                    histogram.RecordValue(Stopwatch.GetTimestamp() - startTimestamp);
                    Interlocked.Increment(ref throughput);
                    list.Add(byteArray);
                }

                list.Clear();

                // Sleep the thread for the desired # of seconds
                Thread.Sleep(cycleTimeSec * 1000);
            }

            sw.Stop();
            Array.Clear(baseMem, 0, baseMem.Length);
        }
예제 #5
0
 protected override void RecordLoop(HistogramBase histogram, long loopCount)
 {
     for (long i = 0; i < loopCount; i++)
     {
         long startTimestamp = Stopwatch.GetTimestamp();
         base.IncrementNumber();
         long ticks = Stopwatch.GetTimestamp() - startTimestamp;
         histogram.RecordValue(ticks);
     }
 }
 protected override void RecordLoop(HistogramBase histogram, long loopCount)
 {
     for (long i = 0; i<loopCount; i++)
     {
         long startTimestamp = Stopwatch.GetTimestamp();
         var result = base.Md5HashIncrementingNumber();
         long ticks = Stopwatch.GetTimestamp() - startTimestamp;
         histogram.RecordValue(ticks);
     }
 }
예제 #7
0
 public void Dispose()
 {
     if (Histogram == null)
     {
         return;
     }
     lock (Histogram) {
         var valueToRecord = (((double)watch.ElapsedTicks - Start) / Stopwatch.Frequency) * 1000000000;
         if (valueToRecord < HighestPowerOf2(Histogram.HighestTrackableValue))
         {
             Histogram.RecordValue((long)valueToRecord);
         }
     }
 }
 private static void RecordLoop(HistogramBase histogram, long loopCount)
 {
     for (long i = 0; i < loopCount; i++)
         histogram.RecordValue(TestValueLevel + (i & 0x8000));
 }
예제 #9
0
        public void RecordValue(long value)
        {
            var newValue = TruncateValue(value, _hdrHistogram);

            _hdrHistogram.RecordValue(newValue);
        }