-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathProgram.cs
43 lines (34 loc) · 1.38 KB
/
Program.cs
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
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
global using Elastic.Transport;
global using Elastic.Ingest.Elasticsearch.Benchmarks;
global using Elastic.Ingest.Elasticsearch.Indices;
global using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using System.Globalization;
using Elastic.Ingest.Elasticsearch.Benchmarks.Benchmarks;
using Perfolizer.Metrology;
#if DEBUG
// MANUALLY RUN A BENCHMARKED METHOD DURING DEBUGGING
//var bm = new BulkIngestion();
//bm.Setup();
//await bm.BulkAllAsync()
//Console.WriteLine("DONE");
var bm = new BulkRequestCreationWithFixedIndexNameBenchmarks();
bm.Setup();
//await bm.WriteToStreamAsync();
var length = bm.MemoryStream.Length;
bm.MemoryStream.Position = 0;
var sr = new StreamReader(bm.MemoryStream);
var json = sr.ReadToEnd();
Console.ReadKey();
#else
var config = ManualConfig.Create(DefaultConfig.Instance);
config.SummaryStyle = new SummaryStyle(CultureInfo.CurrentCulture, true, SizeUnit.B, null!, ratioStyle: BenchmarkDotNet.Columns.RatioStyle.Percentage);
config.AddDiagnoser(MemoryDiagnoser.Default);
BenchmarkRunner.Run<BulkRequestCreationWithTemplatedIndexNameBenchmarks>(config);
#endif