Skip to content

Commit

Permalink
Remove the dotnet global tool (#1572)
Browse files Browse the repository at this point in the history
* remove the source code of the Tool

* Update the how-to-run doc

* remove the mentions of the tool from the docs

* fix the CI build errors

* removing projects manually from solution file was a bad idea
  • Loading branch information
adamsitnik authored Oct 26, 2020
1 parent b4bda14 commit c209b12
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 493 deletions.
7 changes: 0 additions & 7 deletions BenchmarkDotNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.Disassemble
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.IntegrationTests.ManualRunning", "tests\BenchmarkDotNet.IntegrationTests.ManualRunning\BenchmarkDotNet.IntegrationTests.ManualRunning.csproj", "{9816D316-95C4-42E6-9E7B-A256C7E5D4BF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.Tool", "src\BenchmarkDotNet.Tool\BenchmarkDotNet.Tool.csproj", "{1336CAFF-5321-495E-BAFA-AB4DC6BF791C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.IntegrationTests.Static", "tests\BenchmarkDotNet.IntegrationTests.Static\BenchmarkDotNet.IntegrationTests.Static.csproj", "{B4405781-40D3-42B8-B168-00E711FABA15}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.Annotations", "src\BenchmarkDotNet.Annotations\BenchmarkDotNet.Annotations.csproj", "{D9F5065B-6190-431B-850C-117E3D64AB33}"
Expand Down Expand Up @@ -115,10 +113,6 @@ Global
{9816D316-95C4-42E6-9E7B-A256C7E5D4BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9816D316-95C4-42E6-9E7B-A256C7E5D4BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9816D316-95C4-42E6-9E7B-A256C7E5D4BF}.Release|Any CPU.Build.0 = Release|Any CPU
{1336CAFF-5321-495E-BAFA-AB4DC6BF791C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1336CAFF-5321-495E-BAFA-AB4DC6BF791C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1336CAFF-5321-495E-BAFA-AB4DC6BF791C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1336CAFF-5321-495E-BAFA-AB4DC6BF791C}.Release|Any CPU.Build.0 = Release|Any CPU
{B4405781-40D3-42B8-B168-00E711FABA15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4405781-40D3-42B8-B168-00E711FABA15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4405781-40D3-42B8-B168-00E711FABA15}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -151,7 +145,6 @@ Global
{E5A0833C-B633-4D62-B645-A927CEBFEEBB} = {D6597E3A-6892-4A68-8E14-042FC941FDA2}
{D189AAB3-46B4-4437-8E9C-72F021AB2B6E} = {D6597E3A-6892-4A68-8E14-042FC941FDA2}
{9816D316-95C4-42E6-9E7B-A256C7E5D4BF} = {14195214-591A-45B7-851A-19D3BA2413F9}
{1336CAFF-5321-495E-BAFA-AB4DC6BF791C} = {D6597E3A-6892-4A68-8E14-042FC941FDA2}
{B4405781-40D3-42B8-B168-00E711FABA15} = {14195214-591A-45B7-851A-19D3BA2413F9}
{D9F5065B-6190-431B-850C-117E3D64AB33} = {D6597E3A-6892-4A68-8E14-042FC941FDA2}
{B620D10A-CD8E-4A34-8B27-FD6257E63AD0} = {63B94FD6-3F3D-4E04-9727-48E86AC4384C}
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,7 @@ ManualConfig.CreateEmpty() // A configuration for our benchmarks

If you prefer command-line experience, you can configure your benchmarks via
the [console arguments](https://benchmarkdotnet.org/articles/guides/console-args.html)
in any console application or use
[.NET Core command-line tool](https://benchmarkdotnet.org/articles/guides/global-dotnet-tool.html)
to run benchmarks from any dll:

```sh
dotnet benchmark MyAssembly.dll --runtimes net472 netcoreapp2.1 Mono
```
in any console application (other types of applications are not supported).

### Automation

Expand Down
2 changes: 0 additions & 2 deletions build/build-and-pack.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ git clean -xfd
dotnet restore
dotnet build .\src\BenchmarkDotNet\BenchmarkDotNet.csproj -c Release
dotnet build .\src\BenchmarkDotNet.Diagnostics.Windows\BenchmarkDotNet.Diagnostics.Windows.csproj -c Release
dotnet build .\src\BenchmarkDotNet.Tool\BenchmarkDotNet.Tool.csproj -c Release
dotnet build .\src\BenchmarkDotNet.Annotations\BenchmarkDotNet.Annotations.csproj -c Release
dotnet build .\templates\BenchmarkDotNet.Templates.csproj -c Release
dotnet pack .\src\BenchmarkDotNet\BenchmarkDotNet.csproj -c Release --include-symbols -p:SymbolPackageFormat=snupkg
dotnet pack .\src\BenchmarkDotNet.Diagnostics.Windows\BenchmarkDotNet.Diagnostics.Windows.csproj -c Release --include-symbols -p:SymbolPackageFormat=snupkg
dotnet pack .\src\BenchmarkDotNet.Tool\BenchmarkDotNet.Tool.csproj -c Release --include-symbols -p:SymbolPackageFormat=snupkg
dotnet pack .\src\BenchmarkDotNet.Annotations\BenchmarkDotNet.Annotations.csproj -c Release --include-symbols -p:SymbolPackageFormat=snupkg
dotnet pack .\templates\BenchmarkDotNet.Templates.csproj -c Release
rmdir artifacts /s /q
Expand Down
35 changes: 18 additions & 17 deletions docs/articles/guides/how-to-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,36 @@ uid: docs.how-to-run

# How to run your benchmarks

There are several ways to run your benchmarks:
There are several ways to run your benchmarks. What is important is that **BenchmarkDotNet works only with Console Apps**. It does not support any other kind of application like ASP.NET, Azure WebJobs, etc.

## Types

If you have just a few types with benchmarks, you can use `BenchmarkRunner`:

```cs
var summary = BenchmarkRunner.Run<MyBenchmarkClass>();
var summary = BenchmarkRunner.Run(typeof(MyBenchmarkClass));
```

## Global dotnet tool
The disadvantage of `BenchmarkRunner` is that it always runs all benchmarks in a given type (or assembly) and to change the type you need to modify the source code. But it's great for a quick start.

You can also run a benchmark using `BenchmarkDotNet.Tool`.
## BenchmarkSwitcher

```log
dotnet tool install -g BenchmarkDotNet.Tool
If you have more types and you want to choose which benchmark to run (either by using console line arguments or console input) you should use `BenchmarkSwitcher`:

```cs
static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
```

Also you can use the config command style to specify some config from command line (more @docs.console-args):

```log
dotnet benchmark MyAssemblyWithBenchmarks.dll --filter *
dotnet run -c Release -- --job short --runtimes net461 netcoreapp21--filter *BenchmarkClass1*
```

The most important thing about `BenchmarkSwitcher` is that you need to pass the `args` from `Main` to the `Run` method. If you don't, it won't parse the arguments.


## Url

You can also run a benchmark directly from the internet:
Expand All @@ -34,24 +43,16 @@ string url = "<E.g. direct link to raw content of a gist>";
var summary = BenchmarkRunner.RunUrl(url);
```

**Note:** it works only for Full .NET Framework. It's not recommended to use this approach.

## Source

```cs
string benchmarkSource = "public class MyBenchmarkClass { ...";
var summary = BenchmarkRunner.RunSource(benchmarkSource);
```

## BenchmarkSwitcher

Or you can create a set of benchmarks and choose one from command line:

```cs
static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
```
**Note:** it works only for Full .NET Framework. It's not recommended to use this approach.

Also you can use the config command style to specify some config from command line (more @docs.console-args):

```log
dotnet run -c Release -- --job short --runtimes clr core --filter *BenchmarkClass1*
```

3 changes: 2 additions & 1 deletion docs/articles/guides/nuget.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ We have the following set of NuGet packages (you can install it directly from `n

* `BenchmarkDotNet`: Basic BenchmarkDotNet infrastructure and logic. This is all you need to run benchmarks.
* `BenchmarkDotNet.Diagnostics.Windows`: an additional optional package that provides a set of Windows diagnosers.
* `BenchmarkDotNet.Tool`: A dotnet tool to execute benchmarks built with BenchmarkDotNet.
* `BenchmarkDotNet.Templates`: Templates for BenchmarkDotNet.

You might find other NuGet packages that start with `BenchmarkDotNet` name, but they are internal BDN packages that should not be installed manually. All that matters are the three packages mentioned above.

## Versioning system and feeds
We have 3 kinds of versions: *stable*, *nightly*, and *develop*.
You can get the current version from the source code via `BenchmarkDotNetInfo.FullVersion` and the full title via `BenchmarkDotNetInfo.FullTitle`.
Expand Down
2 changes: 0 additions & 2 deletions docs/articles/guides/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@
href: console-args.md
- name: Troubleshooting
href: troubleshooting.md
- name: Command-line tool
href: tool.md
- name: BenchmarkDotNet templates
href: dotnet-new-templates.md
Loading

0 comments on commit c209b12

Please sign in to comment.