-
-
Notifications
You must be signed in to change notification settings - Fork 945
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
662719c
commit d8381b0
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using BenchmarkDotNet.Configs; | ||
using BenchmarkDotNet.Exporters; | ||
using BenchmarkDotNet.Jobs; | ||
using BenchmarkDotNet.Toolchains.Snapshot; | ||
using System.Threading; | ||
|
||
namespace BenchmarkDotNet.Samples | ||
{ | ||
[Config(typeof(Config))] | ||
public class IntroSnapshot | ||
{ | ||
private class Config : ManualConfig | ||
{ | ||
public Config() | ||
{ | ||
var store = Toolchains.Snapshot.Stores.JsonShanpshotStore.From("./snapshot.js"); | ||
var toolchain = SnapshotToolchain.From(store); | ||
AddJob(Job.Default.WithToolchain(toolchain).WithBaseline(true).WithId("Baseline")); | ||
AddJob(Job.ShortRun); | ||
AddExporter(SnapshotExporter.From(store)); | ||
} | ||
} | ||
// 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(15)")] | ||
public void SleepWithDescription() => Thread.Sleep(15); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.