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); } }
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); }
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); } }
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)); }
public void RecordValue(long value) { var newValue = TruncateValue(value, _hdrHistogram); _hdrHistogram.RecordValue(newValue); }