public void GcCollectionsSelector_should_create_1_GcCollectionsPerGenerationCollector_per_Generation()
 {
     var gcCollectionsSelector = new GcMeasurementConfigurator();
     var gcGenerations = SysInfo.Instance.MaxGcGeneration;
     var gcSetting = new GcMeasurementAttribute(GcMetric.TotalCollections, GcGeneration.AllGc);
     var gcCollectors = gcCollectionsSelector.GetBenchmarkSettings(gcSetting).Cast<GcBenchmarkSetting>().ToList();
     Assert.Equal(gcGenerations + 1,gcCollectors.Count);
     Assert.Equal(gcGenerations, (int)gcCollectors.Max(x => x.Generation));
 }
        public void GcCollectionsSelector_should_create_1_GcCollectionsPerGenerationCollector_per_Generation()
        {
            var gcCollectionsSelector = new GcMeasurementConfigurator();
            var gcGenerations         = SysInfo.Instance.MaxGcGeneration;
            var gcSetting             = new GcMeasurementAttribute(GcMetric.TotalCollections, GcGeneration.AllGc);
            var gcCollectors          = gcCollectionsSelector.GetBenchmarkSettings(gcSetting).Cast <GcBenchmarkSetting>().ToList();

            Assert.Equal(gcGenerations + 1, gcCollectors.Count);
            Assert.Equal(gcGenerations, (int)gcCollectors.Max(x => x.Generation));
        }
Ejemplo n.º 3
0
        public static GcBenchmarkSetting CreateBenchmarkSetting(GcMeasurementAttribute gcMeasurement)
        {
            var throughputAssertion = gcMeasurement as GcThroughputAssertionAttribute;
            var totalAssertion      = gcMeasurement as GcTotalAssertionAttribute;

            if (throughputAssertion != null)
            {
                return(new GcBenchmarkSetting(gcMeasurement.Metric, gcMeasurement.Generation, AssertionType.Throughput, new Assertion(throughputAssertion.Condition, throughputAssertion.AverageOperationsPerSecond, throughputAssertion.MaxAverageOperationsPerSecond)));
            }
            if (totalAssertion != null)
            {
                return(new GcBenchmarkSetting(gcMeasurement.Metric, gcMeasurement.Generation, AssertionType.Total, new Assertion(totalAssertion.Condition, totalAssertion.AverageOperationsTotal, totalAssertion.MaxAverageOperationsTotal)));
            }

            return(new GcBenchmarkSetting(gcMeasurement.Metric, gcMeasurement.Generation, AssertionType.Total, Assertion.Empty));
        }
Ejemplo n.º 4
0
 public static GcBenchmarkSetting CreateBenchmarkSetting(GcMeasurementAttribute gcMeasurement)
 {
     var throughputAssertion = gcMeasurement as GcThroughputAssertionAttribute;
     var totalAssertion = gcMeasurement as GcTotalAssertionAttribute;
     if (throughputAssertion != null)
     {
         return new GcBenchmarkSetting(gcMeasurement.Metric, gcMeasurement.Generation, AssertionType.Throughput, new Assertion(throughputAssertion.Condition, throughputAssertion.AverageOperationsPerSecond, throughputAssertion.MaxAverageOperationsPerSecond));
     }
     if (totalAssertion != null)
     {
         return new GcBenchmarkSetting(gcMeasurement.Metric, gcMeasurement.Generation, AssertionType.Total, new Assertion(totalAssertion.Condition, totalAssertion.AverageOperationsTotal, totalAssertion.MaxAverageOperationsTotal));
     }
     
     return new GcBenchmarkSetting(gcMeasurement.Metric, gcMeasurement.Generation, AssertionType.Total, Assertion.Empty);
 }