Skip to content

Commit a136737

Browse files
added dotTrace diagnoser to Benchmark.NET projects (#6864)
1 parent 147d039 commit a136737

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ PerfResults/
3333
# BenchmarkDotNet files
3434
[rR]esults/
3535

36+
# dotTrace files
37+
*.dtp
38+
*.dtp.*
39+
3640
# Visual Studo 2015 cache/options directory
3741
.vs/
3842

src/benchmark/Akka.Benchmarks/Akka.Benchmarks.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
<ItemGroup>
99
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetVersion)" />
10+
<PackageReference Include="BenchmarkDotNet.Diagnostics.dotTrace" Version="0.13.6" />
1011
<!-- FluentAssertions is used in some benchmarks to validate internal behaviors -->
1112
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
1213
</ItemGroup>

src/benchmark/Akka.Cluster.Benchmarks/Akka.Cluster.Benchmarks.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
<ItemGroup>
88
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetVersion)" />
9+
<PackageReference Include="BenchmarkDotNet.Diagnostics.dotTrace" Version="0.13.6" />
910
</ItemGroup>
1011

1112
<ItemGroup>

src/benchmark/Akka.Cluster.Benchmarks/Sharding/ShardMessageRoutingBenchmarks.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@
1414
using Akka.Cluster.Sharding;
1515
using Akka.Routing;
1616
using BenchmarkDotNet.Attributes;
17+
using BenchmarkDotNet.Diagnostics.dotTrace;
1718
using static Akka.Cluster.Benchmarks.Sharding.ShardingHelper;
1819

1920
namespace Akka.Cluster.Benchmarks.Sharding
2021
{
22+
[DotTraceDiagnoser]
2123
[Config(typeof(MonitoringConfig))]
2224
public class ShardMessageRoutingBenchmarks
2325
{
2426
[Params(StateStoreMode.Persistence, StateStoreMode.DData)]
2527
public StateStoreMode StateMode;
2628

27-
[Params(10000)]
28-
public int MsgCount;
29+
public const int MsgCount = 10000;
2930

30-
public int BatchSize = 20;
31+
public const int BatchSize = 20;
3132

3233
private ActorSystem _sys1;
3334
private ActorSystem _sys2;
@@ -141,36 +142,36 @@ public void PerIteration()
141142
_batchActor = _sys1.ActorOf(Props.Create(() => new BulkSendActor(tcs, MsgCount)));
142143
}
143144

144-
[Benchmark]
145+
[Benchmark(OperationsPerInvoke = MsgCount)]
145146
public async Task SingleRequestResponseToLocalEntity()
146147
{
147148
for (var i = 0; i < MsgCount; i++)
148149
await _shardRegion1.Ask<ShardedMessage>(_messageToSys1);
149150
}
150151

151-
[Benchmark]
152+
[Benchmark(OperationsPerInvoke = MsgCount * BatchSize)]
152153
public async Task StreamingToLocalEntity()
153154
{
154155
_batchActor.Tell(new BulkSendActor.BeginSend(_messageToSys1, _shardRegion1, BatchSize));
155156
await _batchComplete;
156157
}
157158

158-
[Benchmark]
159+
[Benchmark(OperationsPerInvoke = MsgCount)]
159160
public async Task SingleRequestResponseToRemoteEntity()
160161
{
161162
for (var i = 0; i < MsgCount; i++)
162163
await _shardRegion1.Ask<ShardedMessage>(_messageToSys2);
163164
}
164165

165166

166-
[Benchmark]
167+
[Benchmark(OperationsPerInvoke = MsgCount)]
167168
public async Task SingleRequestResponseToRemoteEntityWithLocalProxy()
168169
{
169170
for (var i = 0; i < MsgCount; i++)
170171
await _localRouter.Ask<ShardedMessage>(new SendShardedMessage(_messageToSys2.EntityId, _messageToSys2));
171172
}
172173

173-
[Benchmark]
174+
[Benchmark(OperationsPerInvoke = MsgCount*BatchSize)]
174175
public async Task StreamingToRemoteEntity()
175176
{
176177
_batchActor.Tell(new BulkSendActor.BeginSend(_messageToSys2, _shardRegion1, BatchSize));

0 commit comments

Comments
 (0)