-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Ability to specify benchmark description in outputs #2386
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
Open
Nepp3r
wants to merge
21
commits into
dotnet:master
Choose a base branch
from
Nepp3r:classnameoutput
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5107b22
Adding new Attribute
cdonke f96a5a4
Sample applying new attribute
cdonke 23542d4
Change the DisplayName extension to show the custom attribute name value
cdonke d17ce13
Tests
cdonke 01a07d7
Tests
cdonke 1a778a3
Renaming BenchmarkName attribute to BenchmarkDescription
Nepp3r c4d89ca
Fixing samples/BenchmarkDotNet.Samples/IntroRenameTest.cs
Nepp3r 5282284
Editing src/BenchmarkDotNet/Running/BenchmarkConverter.cs for the ada…
Nepp3r c9b0362
Adding tests for situations with overridable description of benchmark
Nepp3r a5eacc3
Fixing DescriptorNameDescriptionTests
Nepp3r c8b795e
Transfering tests from DescriptorNameDescriptionOverrideTests to Benc…
Nepp3r fc92051
Starting fixing for TypeInfo to work correctly
Nepp3r 2d4d261
Ending fixing FromClassDescription test case
Nepp3r 7d91cbb
Fixing some of the problems from PR #2386
Nepp3r d58490c
Continue fixing
Nepp3r daaf3ee
Fixing tests for methods from multiple types
Nepp3r 711d64e
Choosing better name for new Markdown test
Nepp3r b56686e
Cosmetic changes
Nepp3r 1ea9abf
Cosmetic changes
Nepp3r ece8bf4
Cosmetic changes
Nepp3r 4a44743
Cosmetic changes
Nepp3r File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace BenchmarkDotNet.Samples | ||
{ | ||
[BenchmarkDescription("Used to be 'IntroRenameTest', now is 'My Renamed Test'")] | ||
public class IntroRenameTest | ||
{ | ||
// And define a method with the Benchmark attribute | ||
[Benchmark] | ||
public void Sleep() => Thread.Sleep(10); | ||
|
||
// You can write a description for your method. | ||
[Benchmark(Description = "Thread.Sleep(10)")] | ||
public void SleepWithDescription() => Thread.Sleep(10); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace BenchmarkDotNet.Attributes | ||
{ | ||
public class BenchmarkDescriptionAttribute : Attribute | ||
{ | ||
public BenchmarkDescriptionAttribute(){ } | ||
public BenchmarkDescriptionAttribute(string description) | ||
=> Description = description; | ||
|
||
public string Description { get; set; } | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
20 changes: 20 additions & 0 deletions
20
...ownExporterApprovalTests.GroupExporterTest.JobBaseline_RenameJob_MethodsJobs.approved.txt
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
=== JobBaseline_RenameJob_MethodsJobs === | ||
|
||
BenchmarkDotNet=v0.10.x-mock, OS=Microsoft Windows NT 10.0.x.mock, VM=Hyper-V | ||
MockIntel Core i7-6700HQ CPU 2.60GHz (Max: 3.10GHz), 1 CPU, 8 logical and 4 physical cores | ||
Frequency=2531248 Hz, Resolution=395.0620 ns, Timer=TSC | ||
[Host] : Clr 4.0.x.mock, 64mock RyuJIT-v4.6.x.mock CONFIGURATION | ||
Job1 : extra output line | ||
Job2 : extra output line | ||
|
||
|
||
Method | Job | Mean | Error | StdDev | Rank | LogicalGroup | Baseline | | ||
------- |----- |---------:|--------:|--------:|-----:|------------- |--------- | | ||
Base | Job1 | 102.0 ns | 6.09 ns | 1.58 ns | 1 | * | No | | ||
Foo | Job1 | 202.0 ns | 6.09 ns | 1.58 ns | 2 | * | No | | ||
Bar | Job1 | 302.0 ns | 6.09 ns | 1.58 ns | 3 | * | No | | ||
Base | Job2 | 402.0 ns | 6.09 ns | 1.58 ns | 4 | * | No | | ||
Foo | Job2 | 502.0 ns | 6.09 ns | 1.58 ns | 5 | * | No | | ||
Bar | Job2 | 602.0 ns | 6.09 ns | 1.58 ns | 6 | * | No | | ||
|
||
Errors: 0 |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.