-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathIntroExportJson.cs
More file actions
44 lines (39 loc) · 1.33 KB
/
IntroExportJson.cs
File metadata and controls
44 lines (39 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.Threading;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Exporters.Json;
namespace BenchmarkDotNet.Samples
{
// *** Attribute style ***
[DryJob]
[UseLocalJobOnly]
[JsonExporterAttribute.Brief]
[JsonExporterAttribute.Full]
[JsonExporterAttribute.BriefCompressed]
[JsonExporterAttribute.FullCompressed]
[JsonExporter("-custom", indentJson: true, excludeMeasurements: true)]
public class IntroExportJson
{
[Benchmark] public void Sleep10() => Thread.Sleep(10);
[Benchmark] public void Sleep20() => Thread.Sleep(20);
}
// *** Object style ***
[Config(typeof(Config))]
public class IntroJsonExportObjectStyle
{
private class Config : ManualConfig
{
public Config()
{
AddExporter(JsonExporter.Brief);
AddExporter(JsonExporter.Brief);
AddExporter(JsonExporter.Full);
AddExporter(JsonExporter.BriefCompressed);
AddExporter(JsonExporter.FullCompressed);
AddExporter(JsonExporter.Custom("-custom", indentJson: true, excludeMeasurements: true));
}
}
[Benchmark] public void Sleep10() => Thread.Sleep(10);
[Benchmark] public void Sleep20() => Thread.Sleep(20);
}
}