23 lines
832 B
C#
23 lines
832 B
C#
using System.Diagnostics;
|
|
using System.Runtime;
|
|
using System.Text.Json;
|
|
using Microsoft.Extensions.Logging;
|
|
using Opc.Ua;
|
|
var dispose = args[0] == "dispose";
|
|
for (int i = 0; i <= 10000; i++)
|
|
{
|
|
if (i > 0)
|
|
{
|
|
var t = DefaultTelemetry.Create(_ => { });
|
|
t.LoggerFactory.CreateLogger("TelemetryControl").LogDebug("control");
|
|
if (dispose) ((IDisposable)t).Dispose();
|
|
}
|
|
if (i % 250 == 0)
|
|
{
|
|
var live = GC.GetTotalMemory(true);
|
|
using var p = Process.GetCurrentProcess();
|
|
p.Refresh();
|
|
Console.WriteLine(JsonSerializer.Serialize(new { i, dispose, live, rss = p.WorkingSet64, methods = JitInfo.GetCompiledMethodCount(), il = JitInfo.GetCompiledILBytes(), gc = GC.GetGCMemoryInfo().TotalCommittedBytes, threads = p.Threads.Count, timers = Timer.ActiveCount }));
|
|
}
|
|
}
|