mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-04-20 10:16:24 +02:00
perf. profiling
This commit is contained in:
parent
65e87e5aa9
commit
78a62ddf98
@ -9,11 +9,12 @@
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DefineConstants>SOTASK_PERF</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Capnp.Net.Runtime" Version="1.3.89-gdebe76be89" />
|
||||
<PackageReference Include="CapnpC.CSharp.MsBuild.Generation" Version="1.3.89-gdebe76be89" />
|
||||
<PackageReference Include="CapnpC.CSharp.MsBuild.Generation" Version="1.3.90-g65e87e5aa9" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -21,11 +21,27 @@ namespace CapnpProfile
|
||||
var payload = new byte[20];
|
||||
new Random().NextBytes(payload);
|
||||
|
||||
#if SOTASK_PERF
|
||||
int counter = 0;
|
||||
#endif
|
||||
|
||||
while (true)
|
||||
{
|
||||
var result = await echoer.Echo(payload);
|
||||
if (result.Count != payload.Length)
|
||||
throw new InvalidOperationException("Echo server malfunction");
|
||||
|
||||
#if SOTASK_PERF
|
||||
if (++counter == 1000)
|
||||
{
|
||||
counter = 0;
|
||||
|
||||
Console.WriteLine($"StrictlyOrderedTask performance statistics:");
|
||||
Console.WriteLine($"AwaitInternal: max. {Capnp.Util.StrictlyOrderedTaskExtensions.Stats.AwaitInternalMaxOuterIterations} outer iterations");
|
||||
Console.WriteLine($"AwaitInternal: max. {Capnp.Util.StrictlyOrderedTaskExtensions.Stats.AwaitInternalMaxInnerIterations} inner iterations");
|
||||
Console.WriteLine($"OnCompleted: max. {Capnp.Util.StrictlyOrderedTaskExtensions.Stats.OnCompletedMaxSpins} iterations");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -240,6 +240,9 @@ namespace Capnp.Util
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performance profiling statistics
|
||||
/// </summary>
|
||||
public static readonly Statistics Stats = new Statistics();
|
||||
#endif
|
||||
/// <summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user