最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - BenchmarkDotNet is showing no console and hence no output - Stack Overflow

programmeradmin0浏览0评论

I am using Lenovo T430, Windows 10, Visual Studio 2017, .NET 4.7.2, and BenchmarkDotNet 0.11.3.

I am seeing no console.

I am seeing no output.

What am I doing incorrectly?

using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

namespace BenchmarkTest
{
    public class BenchmarkSetup
    {
        private double num1;
        private double num2;

        [GlobalSetup]
        public void Setup()
        {
            num1 = 12345.6789;
            num2 = 98765.4321;
        }

        [Benchmark]
        public double Addition() => num1 + num2;

        [Benchmark]
        public double Subtraction() => num1 - num2;

        [Benchmark]
        public double Multiplication() => num1 * num2;

        [Benchmark]
        public double Division() => num1 / num2;
    }

    public class Program
    {
        public static void Main(string[] args)
        {
            // Run the benchmark
            var summary = BenchmarkRunner.Run<BenchmarkSetup>();

            // Display completion message
            Console.WriteLine("Benchmark completed.");
            Console.ReadLine();
        }
    }
}

发布评论

评论列表(0)

  1. 暂无评论