I am trying to profile my specific code using dot memory api. When I call the dump() method my expectation is to take snapshot and save it to dir.
I am trying to take two snapshot here one before executing my code and after executing my code by calling dump() method.
Is it possible to create the both snapshot in the same output file as we option to do it from Stand alone dot memory?
Appreciate your suggestion. following is the code snippet
SelfAttach.Attach(new SaveSnapshotProfilingConfig
{
ProfilingControlKind = ProfilingControlKind.Api,
SaveDir = "D:\\SelfProfiling",
RedistDir = "D:\\Softwares\\JetBrains.Profiler.SelfSdk.2017.2.2",
ProfilingType = ProfilingType.Memory,
ListFile = "D:\\snapshot_list.xml"
});
while (SelfAttach.State != SelfApiState.Active)
{
Thread.Sleep(250); // wait until API starts
}
if (MemoryProfiler.IsActive)
{
MemoryProfiler.Dump();
MyMethodTobeProfiled();
MemoryProfiler.Dump();
}
if (MemoryProfiler.CanDetach)
MemoryProfiler.Detach();
I guess you can use dotMemory Command Line Profiler instead of "Self profiling" API to reach your needs.
Launch dotMemory command line profiler. Determine that profiler is already attached to your app, for that you need to analyze dotMemory CLT process output.
So, pseudo code to get what you need
Read more about dotMemory command line profiler here