-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Removing number of iterations which isn't required for setting up a…
… benchmark, since benchmark.net will automatically determine the number itself. - All benchmarks will now be run by default when no arguments are passed. The results from each benchmark will be combined into a single report for command line and HTML. The report will now be automatically opened in the browser. - Since all benchmarks are being run by default, removed AllBenchmarks.cs which isn't necessary anymore. - Removed ProtobufSerializer.cs which is unused. - Cleaned up usings.
- Loading branch information
Showing
8 changed files
with
54 additions
and
302 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
src/Benchmarks/ServiceWire.Benchmarks/NewtonSoftSerializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,61 @@ | ||
using BenchmarkDotNet.Running; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System; | ||
using System.Diagnostics; | ||
using System.Runtime.InteropServices; | ||
using BenchmarkDotNet.Running; | ||
|
||
namespace ServiceWire.Benchmarks | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
//var summary = BenchmarkRunner.Run<NamedPipesBenchmarks>(); | ||
//summary = BenchmarkRunner.Run<TcpBenchmarks>(); | ||
// These can be helpful if you're just trying to work on a single benchmark | ||
//BenchmarkRunner.Run<ConnectionBenchmarks>(); | ||
//BenchmarkRunner.Run<NamedPipesBenchmarks>(); | ||
//BenchmarkRunner.Run<TcpBenchmarks>(); | ||
|
||
var summary = BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); | ||
|
||
var switcher = BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly); | ||
// Run with command line args if provided | ||
if (args.Length > 0) | ||
{ | ||
switcher.Run(args); | ||
return; | ||
} | ||
|
||
// Otherwise run them all and combine the results into a single report (command line, HTML) | ||
var summary = switcher.RunAllJoined(); | ||
|
||
// Launching the html report in the browser, makes it nice and easy to see the results | ||
string htmlReportPath = System.IO.Path.Combine(summary.ResultsDirectoryPath, $"{summary.Title}-report.html"); | ||
OpenUrl(htmlReportPath); | ||
} | ||
|
||
|
||
private static void OpenUrl(string url) | ||
{ | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
url = url.Replace("&", "^&"); | ||
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }); | ||
} | ||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) | ||
{ | ||
// Detects to see if the user is running in a "desktop environment"/GUI, or if they are running in a terminal session. | ||
// Won't be able to launch a web browser without a GUI | ||
// https://en.wikipedia.org/wiki/Desktop_environment | ||
var currDesktopEnvironment = Environment.GetEnvironmentVariable("XDG_CURRENT_DESKTOP"); | ||
if (String.IsNullOrEmpty(currDesktopEnvironment)) | ||
{ | ||
return; | ||
} | ||
|
||
Process.Start("xdg-open", url); | ||
} | ||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||
{ | ||
Process.Start("open", url); | ||
} | ||
} | ||
} | ||
} |
74 changes: 0 additions & 74 deletions
74
src/Benchmarks/ServiceWire.Benchmarks/ProtobufSerializer.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.