【问题标题】:Getting Performance Results using benchmarkdotnet in ASP.net MVC在 ASP.net MVC 中使用 benchmarkdotnet 获取性能结果
【发布时间】:2017-03-01 03:35:30
【问题描述】:

我正在测试基准库来衡量代码的性能。我正在阅读文档。

我不知道如何打印出基准测试结果。 我有一个名为 user 的类,我想使用以下方法。

[Benchmark]
public bool FollowerAdded(User newFollower)
{
    // code for notifying user that they have an added follower
    Notification notification = new Notification();
    return notification.NotifyUser(this, newFollower.UserName + " is now following you!");
}

在 benchmarkdot net 的文档中,使用以下代码来打印输出 bechmarks。

var summary = BenchmarkRunner.Run<User>();

在 Asp.net MVC 应用程序获取基准测试结果的情况下,我们可以将这段代码放在哪里获取结果?

这是图书馆的网址 http://benchmarkdotnet.org/GettingStarted.htm

【问题讨论】:

    标签: c# asp.net-mvc benchmarkdotnet


    【解决方案1】:

    有点晚了,不过就这样吧,

    可能您需要一个控制台应用程序项目来引用您的库并运行基准测试,运行后结果将打印在控制台上,报告将位于

    summary.ResultsDirectoryPath
    

    通常

    $(TargetDir)BenchmarkDotNet.Artifacts\results\
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-06
      • 1970-01-01
      • 1970-01-01
      • 2011-04-22
      • 1970-01-01
      • 2010-09-07
      • 1970-01-01
      相关资源
      最近更新 更多