Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement --list - fixes #905 #914

Merged
merged 5 commits into from Oct 16, 2018
Merged

Implement --list - fixes #905 #914

merged 5 commits into from Oct 16, 2018

Conversation

@WojciechNagorski
Copy link
Collaborator

@WojciechNagorski WojciechNagorski commented Oct 16, 2018

Fix for #905

I've implemented '--list:[flat|tree]'.

Now you should be able to run BenchmarkDotNet.Samples.exe with options:

BenchmarkDotNet.Samples.exe --list flat

BenchmarkDotNet.Samples.Algo_Md5VsSha256.Md5
BenchmarkDotNet.Samples.Algo_Md5VsSha256.Sha256
BenchmarkDotNet.Samples.IntroArguments.Benchmark
BenchmarkDotNet.Samples.IntroArgumentsSource.SingleArgument
BenchmarkDotNet.Samples.IntroArgumentsSource.ManyArguments
BenchmarkDotNet.Samples.IntroArrayParam.ArrayIndexOf
BenchmarkDotNet.Samples.IntroArrayParam.ManualIndexOf
BenchmarkDotNet.Samples.IntroBasic.Sleep
BenchmarkDotNet.Samples.IntroBasic.Thread.Sleep(10)
[...]

BenchmarkDotNet.Samples.exe --list tree

BenchmarkDotNet
 └─Samples
    ├─Algo_Md5VsSha256
    │  ├─Md5
    │  └─Sha256
    ├─IntroArguments
    │  └─Benchmark
    ├─IntroArgumentsSource
    │  ├─SingleArgument
    │  └─ManyArguments
    ├─IntroArrayParam
    │  ├─ArrayIndexOf
    │  └─ManualIndexOf
    ├─IntroBasic
    │  ├─Sleep
    │  └─Thread
    │     └─Sleep(10)
[...]

You can also use filter option, like this:

BenchmarkDotNet.Samples.exe --list flat --filter *IntroSetupCleanup*

BenchmarkDotNet.Samples.IntroSetupCleanupGlobal.Logic
BenchmarkDotNet.Samples.IntroSetupCleanupIteration.Benchmark
BenchmarkDotNet.Samples.IntroSetupCleanupTarget.BenchmarkA
BenchmarkDotNet.Samples.IntroSetupCleanupTarget.BenchmarkB
BenchmarkDotNet.Samples.IntroSetupCleanupTarget.BenchmarkC
BenchmarkDotNet.Samples.IntroSetupCleanupTarget.BenchmarkD

BenchmarkDotNet.Samples.exe --list tree --filter *IntroSetupCleanup*

BenchmarkDotNet
 └─Samples
    ├─IntroSetupCleanupGlobal
    │  └─Logic
    ├─IntroSetupCleanupIteration
    │  └─Benchmark
    └─IntroSetupCleanupTarget
       ├─BenchmarkA
       ├─BenchmarkB
       ├─BenchmarkC
       └─BenchmarkD
@dnfclas
Copy link

@dnfclas dnfclas commented Oct 16, 2018

CLA assistant check
All CLA requirements met.

Copy link
Member

@adamsitnik adamsitnik left a comment

@wojtpl2 Great implementation of a really good idea! I can't wait to merge this PR!

I added some comments, mostly very minor things. Could you please fix them?

using System;

namespace BenchmarkDotNet.ListBenchmarks {

This comment has been minimized.


PrintNode(node, indent);
}

This comment has been minimized.


void PrintChildNode(Node node, string indent, bool isLast)
{
// Print the provided pipes/spaces indent

This comment has been minimized.

private readonly IBenchmarkCasesPrinter printer;

public BenchmarkCasesPrinter(ListBenchmarkCaseMode listBenchmarkCaseMode)
{

This comment has been minimized.

{
internal interface IBenchmarkCasesPrinter
{
void Print(IEnumerable<string> testName);

This comment has been minimized.

}

public void Print(IEnumerable<string> testName)
{

This comment has been minimized.

using System.Collections.Generic;
using System.Linq;

namespace BenchmarkDotNet.ListBenchmarks {

This comment has been minimized.

PrepareNodeTree(topLevelNodes, partsOfName);
}

var tree = new AsciiTreeDiagram();

This comment has been minimized.

if (listBenchmarkCase)
{
var testName = filteredBenchmarks.SelectMany(p => p.BenchmarksCases)
.Select(p => p.Descriptor.Type.Namespace + "." + p.Descriptor.DisplayInfo).Distinct();

This comment has been minimized.

@@ -0,0 +1,51 @@
using System;

namespace BenchmarkDotNet.ListBenchmarks {

This comment has been minimized.

@WojciechNagorski
Copy link
Collaborator Author

@WojciechNagorski WojciechNagorski commented Oct 16, 2018

Yes, great suggestions. I'll fix it.

@WojciechNagorski
Copy link
Collaborator Author

@WojciechNagorski WojciechNagorski commented Oct 16, 2018

Now everything is fixed.

@adamsitnik adamsitnik merged commit 330f66c into dotnet:master Oct 16, 2018
3 checks passed
@adamsitnik
Copy link
Member

@adamsitnik adamsitnik commented Oct 16, 2018

@wojtpl2 thank you! awesome PR!

@AndreyAkinshin AndreyAkinshin added this to the v0.11.2 milestone Oct 16, 2018
Ky7m added a commit to Ky7m/BenchmarkDotNet that referenced this issue Oct 16, 2018
* master:
  Implement `--list` - fixes dotnet#905 (dotnet#914)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants