Browse Source

Removed workaround from headless platform memory measurement code

pull/8105/head
Nikita Tsukanov 4 years ago
parent
commit
221a0f1341
  1. 10
      samples/ControlCatalog.NetCore/Program.cs

10
samples/ControlCatalog.NetCore/Program.cs

@ -60,12 +60,6 @@ namespace ControlCatalog.NetCore
}) })
.AfterSetup(_ => .AfterSetup(_ =>
{ {
static Task LowPriorityDelay(int ms)
{
return Task.Delay(ms).ContinueWith(_ =>
Dispatcher.UIThread.InvokeAsync(() => { }, DispatcherPriority.Background))
.Unwrap();
}
DispatcherTimer.RunOnce(async () => DispatcherTimer.RunOnce(async () =>
{ {
var window = ((IClassicDesktopStyleApplicationLifetime)Application.Current.ApplicationLifetime) var window = ((IClassicDesktopStyleApplicationLifetime)Application.Current.ApplicationLifetime)
@ -77,7 +71,7 @@ namespace ControlCatalog.NetCore
continue; continue;
Console.WriteLine("Selecting " + page.Header); Console.WriteLine("Selecting " + page.Header);
tc.SelectedItem = page; tc.SelectedItem = page;
await LowPriorityDelay(20); await Task.Delay(50);
} }
Console.WriteLine("Selecting the first page"); Console.WriteLine("Selecting the first page");
tc.SelectedItem = tc.Items.OfType<object>().First(); tc.SelectedItem = tc.Items.OfType<object>().First();
@ -86,7 +80,7 @@ namespace ControlCatalog.NetCore
for (var c = 0; c < 3; c++) for (var c = 0; c < 3; c++)
{ {
GC.Collect(2, GCCollectionMode.Forced); GC.Collect(2, GCCollectionMode.Forced);
await Task.Delay(00); await Task.Delay(50);
} }
void FormatMem(string metric, long bytes) void FormatMem(string metric, long bytes)

Loading…
Cancel
Save