Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejgordon committed Nov 7, 2023
1 parent de2756a commit 5788e01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Profiler.SelfApi" Version="2.5.0" />
<PackageReference Include="JetBrains.Profiler.Api" Version="1.4.0" />
</ItemGroup>

Expand Down
28 changes: 3 additions & 25 deletions benchmarks/Elastic.Apm.Profiling/Program.cs
Original file line number Diff line number Diff line change
@@ -1,60 +1,38 @@
using JetBrains.Profiler.SelfApi;
using Elastic.Apm.Helpers;

using static Elastic.Apm.Benchmarks.Helpers.CgroupFileHelper;
using static Elastic.Apm.Metrics.MetricsProvider.CgroupMetricsProvider;
using Elastic.Apm.Logging;
using JetBrains.Profiler.Api;

//await DotMemory.EnsurePrerequisiteAsync();
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "dotTrace");
Console.WriteLine($"Saving to {path}");

//var config = new DotMemory.Config();
//config.SaveToDir(path);

var paths = CreateDefaultGroupFiles();

// WARMUP

var sut = TestableCgroupMetricsProvider(new NoopLogger(), new List<WildcardMatcher>(), paths.RootPath, true);
foreach (var metricSet in sut.GetSamples())
foreach (var _ in metricSet.Samples)
{
}

MemoryProfiler.CollectAllocations(true);

Thread.Sleep(1000);
// PROFILING

//DotMemory.Attach(config);

Thread.Sleep(1000);
MemoryProfiler.CollectAllocations(true);

//DotMemory.GetSnapshot("Before create");
MemoryProfiler.GetSnapshot("Before create");

sut = TestableCgroupMetricsProvider(new NoopLogger(), new List<WildcardMatcher>(), paths.RootPath, true);

Thread.Sleep(1000);

//DotMemory.GetSnapshot("After create");
MemoryProfiler.GetSnapshot("After create");

Thread.Sleep(1000);

foreach (var metricSet in sut.GetSamples())
foreach (var _ in metricSet.Samples)
{
}

Thread.Sleep(1000);

//DotMemory.GetSnapshot("After get samples");
MemoryProfiler.GetSnapshot("After get samples");

MemoryProfiler.CollectAllocations(false);
//DotMemory.Detach();
//Directory.Delete(paths.RootPath, true);

internal sealed class NoopLogger : IApmLogger
{
Expand Down

0 comments on commit 5788e01

Please sign in to comment.