I am working on a external memory profiling test, i.e. I have to attach to another process and analyze its memory profile.
I have a professional license for the NetMemProfiler5, and I am working with the 'SciTech.NetMemProfiler.Core.dll' version 18.104.22.168.
My issue is that I am unable to attach to a process, take a snapshot, run some C# code of indefinite length and then take another snapshot without using the GUI.
I have tried the following things:
1. Using the classes defined in: "SciTech.Profiler.ProfilerApplicationCore"
- My issue with this approach is that I am unable to create a "SciTech.Profiler.ActiveSession" for a process which is already running.
My code for profiling a new process looks like this:
Code: Select all
string applicationPath = "PathToApplication"; ProfilerApplicationCore application = new ProfilerApplicationCore(); ProfileProcessStartInfo profileProcessStartInfo = new ProfileProcessStartInfo(ProfilingType.Application, applicationPath); profileProcessStartInfo.ProgramArguments = "-embedding"; ActiveSession activeSession = application.CreateSession(profileProcessStartInfo);
2. Using NmpCore.exe
- My command looks similar to this: .\NmpCore.exe /a:20476 /cs1 /sf:C:\SessionFile\Session1
- By running this command, then running some C# code and then running this command again, I receive two session-files which I can load via the following code:
Code: Select all
ProfilerApplicationCore application = new ProfilerApplicationCore(); ProfilerSession session_1 = application.LoadSession(@"C:\SessionFile\SessionFile1.prfsession");
- Question: Is it possible to compare snapshots from different sessions using version 22.214.171.124?
Is there another way to programmatically achieve my goal? Thank you in advance.