本文整理汇总了C#中Histogram.getTotalCount方法的典型用法代码示例。如果您正苦于以下问题:C# Histogram.getTotalCount方法的具体用法?C# Histogram.getTotalCount怎么用?C# Histogram.getTotalCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Histogram
的用法示例。
在下文中一共展示了Histogram.getTotalCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testRawRecordingSpeed
public void testRawRecordingSpeed()
{
AbstractHistogram histogram;
histogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
Console.WriteLine("\n\nTiming Histogram:");
testRawRecordingSpeedAtExpectedInterval("Histogram: ", histogram, 1000000000, rawtimingLoopCount);
// Check that the histogram contains as many values are we wrote to it
Assert.AreEqual(rawtimingLoopCount, histogram.getTotalCount());
}
示例2: testReset
public void testReset()
{
Histogram histogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
histogram.recordValue(testValueLevel);
histogram.reset();
Assert.assertEquals(0L, histogram.getCountAtValue(testValueLevel));
Assert.assertEquals(0L, histogram.getTotalCount());
}
示例3: testAdd
public void testAdd()
{
Histogram histogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
Histogram other = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
histogram.recordValue(testValueLevel);
histogram.recordValue(testValueLevel * 1000);
other.recordValue(testValueLevel);
other.recordValue(testValueLevel * 1000);
histogram.add(other);
Assert.assertEquals(2L, histogram.getCountAtValue(testValueLevel));
Assert.assertEquals(2L, histogram.getCountAtValue(testValueLevel * 1000));
Assert.assertEquals(4L, histogram.getTotalCount());
Histogram biggerOther = new Histogram(highestTrackableValue * 2, numberOfSignificantValueDigits);
biggerOther.recordValue(testValueLevel);
biggerOther.recordValue(testValueLevel * 1000);
// Adding the smaller histogram to the bigger one should work:
biggerOther.add(histogram);
Assert.assertEquals(3L, biggerOther.getCountAtValue(testValueLevel));
Assert.assertEquals(3L, biggerOther.getCountAtValue(testValueLevel * 1000));
Assert.assertEquals(6L, biggerOther.getTotalCount());
// But trying to add a larger histogram into a smaller one should throw an AIOOB:
bool thrown = false;
try
{
// This should throw:
histogram.add(biggerOther);
}
catch (ArgumentOutOfRangeException)
{
thrown = true;
}
Assert.assertTrue(thrown);
}
示例4: testRecordValueWithExpectedInterval
public void testRecordValueWithExpectedInterval()
{
Histogram histogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
histogram.recordValueWithExpectedInterval(testValueLevel, testValueLevel/4);
Histogram rawHistogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
rawHistogram.recordValue(testValueLevel);
// The data will include corrected samples:
Assert.assertEquals(1L, histogram.getCountAtValue((testValueLevel * 1 )/4));
Assert.assertEquals(1L, histogram.getCountAtValue((testValueLevel * 2 )/4));
Assert.assertEquals(1L, histogram.getCountAtValue((testValueLevel * 3 )/4));
Assert.assertEquals(1L, histogram.getCountAtValue((testValueLevel * 4 )/4));
Assert.assertEquals(4L, histogram.getTotalCount());
// But the raw data will not:
Assert.assertEquals(0L, rawHistogram.getCountAtValue((testValueLevel * 1 )/4));
Assert.assertEquals(0L, rawHistogram.getCountAtValue((testValueLevel * 2 )/4));
Assert.assertEquals(0L, rawHistogram.getCountAtValue((testValueLevel * 3 )/4));
Assert.assertEquals(1L, rawHistogram.getCountAtValue((testValueLevel * 4 )/4));
Assert.assertEquals(1L, rawHistogram.getTotalCount());
}