Ejemplo n.º 1
0
        public static async Task <int> CompareAsync(
            string baselineFolder, string resultsFolder, bool failOnRegression, ILogger logger, CancellationToken token)
        {
            token.ThrowIfCancellationRequested();

            var(compareSucceeded, regressionDetected) = await BenchmarkDotNetDiffer.TryCompareBenchmarkDotNetResultsAsync(baselineFolder, resultsFolder, logger).ConfigureAwait(false);

            if (!compareSucceeded)
            {
                logger.LogError("Failed to compare the performance results see log.");
                return(1);
            }

            if (!regressionDetected)
            {
                logger.LogTrace("No performance regression found.");
                return(0);
            }

            var(etlCompareSucceeded, etlRegressionDetected) = CheckEltTraces(baselineFolder, resultsFolder, failOnRegression);
            if (!etlCompareSucceeded)
            {
                logger.LogTrace("We detected a regression in BMDN and there is no ETL info.");
                return(1);
            }

            if (etlRegressionDetected)
            {
                logger.LogTrace(" We detected a regression in BMDN and there _is_ ETL info which agress there was a regression.");
                return(1);
            }

            logger.LogTrace("We detected a regression in BMDN but examining the ETL trace determined that is was noise.");
            return(0);
        }
Ejemplo n.º 2
0
        public static async Task <int> CompareAsync(
            string baselineFolder, string resultsFolder, bool failOnRegression, ILogger logger, CancellationToken token)
        {
            token.ThrowIfCancellationRequested();

            var(success, shouldCheckETL) = await BenchmarkDotNetDiffer.TryCompareBenchmarkDotNetResultsAsync(baselineFolder, resultsFolder, logger).ConfigureAwait(false);

            if (!success)
            {
                return(1);
            }

            if (shouldCheckETL)
            {
                // get file paths
                if (!TryGetETLPaths(baselineFolder, out var baselineEtlPath))
                {
                    return(1);
                }

                if (!TryGetETLPaths(resultsFolder, out var resultsEtlPath))
                {
                    return(1);
                }

                // Compare ETL
                if (!EtlDiffer.TryCompareETL(resultsEtlPath, baselineEtlPath, out var regression))
                {
                    return(1);
                }

                if (regression && failOnRegression)
                {
                    return(1);
                }
            }

            return(0);
        }