Browse Source

update LoadResizeSaveParallelMemoryStress

af/UniformUnmanagedMemoryPoolMemoryAllocator-02-MemoryGuards
Anton Firszov 4 years ago
parent
commit
2b6d940d6f
  1. 12
      tests/ImageSharp.Tests.ProfilingSandbox/LoadResizeSaveParallelMemoryStress.cs
  2. 1
      tests/ImageSharp.Tests.ProfilingSandbox/Program.cs

12
tests/ImageSharp.Tests.ProfilingSandbox/LoadResizeSaveParallelMemoryStress.cs

@ -52,7 +52,12 @@ namespace SixLabors.ImageSharp.Tests.ProfilingSandbox
{
Console.WriteLine("Running ImageSharp with options:");
Console.WriteLine(options.ToString());
Configuration.Default.MemoryAllocator = options.CreateMemoryAllocator();
if (!options.KeepDefaultAllocator)
{
MemoryAllocator.Default = Configuration.Default.MemoryAllocator = options.CreateMemoryAllocator();
}
timer = Stopwatch.StartNew();
try
{
@ -197,6 +202,9 @@ namespace SixLabors.ImageSharp.Tests.ProfilingSandbox
[Option('i', "imagesharp", Required = false, Default = false, HelpText = "Test ImageSharp without benchmark switching")]
public bool ImageSharp { get; set; }
[Option('d', "default-allocator", Required = false, Default = false, HelpText = "Keep default MemoryAllocator and ignore all settings")]
public bool KeepDefaultAllocator { get; set; }
[Option('m', "max-contiguous", Required = false, Default = 4, HelpText = "Maximum size of contiguous pool buffers in MegaBytes")]
public int MaxContiguousPoolBufferMegaBytes { get; set; } = 4;
@ -244,7 +252,7 @@ namespace SixLabors.ImageSharp.Tests.ProfilingSandbox
}
public override string ToString() =>
$"p({this.MaxDegreeOfParallelism})_i({this.ImageSharp})_m({this.MaxContiguousPoolBufferMegaBytes})_s({this.MaxPoolSizeMegaBytes})_u({this.MaxCapacityOfNonPoolBuffersMegaBytes})_r({this.RepeatCount})_g({this.FinalGcCount})_e({this.ReleaseRetainedResourcesAtEnd})";
$"p({this.MaxDegreeOfParallelism})_i({this.ImageSharp})_d({this.KeepDefaultAllocator})_m({this.MaxContiguousPoolBufferMegaBytes})_s({this.MaxPoolSizeMegaBytes})_u({this.MaxCapacityOfNonPoolBuffersMegaBytes})_r({this.RepeatCount})_g({this.FinalGcCount})_e({this.ReleaseRetainedResourcesAtEnd})";
public MemoryAllocator CreateMemoryAllocator()
{

1
tests/ImageSharp.Tests.ProfilingSandbox/Program.cs

@ -36,7 +36,6 @@ namespace SixLabors.ImageSharp.Tests.ProfilingSandbox
{
try
{
Console.WriteLine("WUT: " + GetNetCoreVersion());
LoadResizeSaveParallelMemoryStress.Run(args);
}
catch (Exception ex)

Loading…
Cancel
Save