Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Performance Results using benchmarkdotnet in ASP.net MVC

I am testing benchmark library to measure the performance of the code. I am reading up the documentation.

I am not able to figure out how to print out results of benchmarks. I have a class called user and i want to bechmark the following method.

[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!");
}

In the documentation of benchmarkdot net, Use the following code to get printout of bechmarks.

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

Where can we put this code to get the results in case of Asp.net MVC application to get the benchmarking results?

here is the URL of the library http://benchmarkdotnet.org/GettingStarted.htm

like image 400
kiran iqbal Avatar asked Nov 21 '25 07:11

kiran iqbal


1 Answers

A bit late but here it goes,

Probably you need a console application project to reference your library and run the benchmark, after running it the results will be printed on the console and the reports will be located in

summary.ResultsDirectoryPath

typically

$(TargetDir)BenchmarkDotNet.Artifacts\results\
like image 92
Adrian Rus Avatar answered Nov 22 '25 19:11

Adrian Rus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!