Saving composed profiling session from 2 different session

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
Posts: 6
Joined: Wed Jul 11, 2012 1:48 pm

Saving composed profiling session from 2 different session

Post by JuergenKlopf » Mon Apr 08, 2013 3:22 pm

For a detailed analysis in the stand alone tool I need to saving a profiling session that is created in 2 different sessions.

Code: Select all

using (var savedSession = app.LoadSession(PathToPrimarySnapshot))
    var saveHeaders = savedSession.SessionFile.GetSnapshotHeaders();
    using (var activeSession = app.CreateSession(GetStartInfo()))
        var activeHeaders = activeSession.SessionFile.GetSnapshotHeaders();
        var comparison = activeSession.Comparison;
        comparison.CompareSnapshots(activeHeaders[0], saveHeaders[0]);

        var snapShotSaveSelections = new[]
                new SnapShotSaveSelection(saveHeaders[0], "primary", true),
                new SnapShotSaveSelection(activeHeaders[0], "comparison", true)

        var path = Path.Combine(WorkPath, _testCase + ".prfsession");
        activeSession.Save(path, snapShotSaveSelections, true, comparison);
Depending on which session the save method is called either the primary or the comparison snapshot will only be saved. Is there a possibility to save the combined session?

Thanks in advanced!

Andreas Suurkuusk
Posts: 1030
Joined: Wed Mar 02, 2005 7:53 pm

Re: Saving composed profiling session from 2 different sessi

Post by Andreas Suurkuusk » Wed Apr 10, 2013 9:17 pm

No, it is not possible to save a session that contains snapshots from two different sessions. The snapshots provided to the Save method should all belong to the session on which Save is called.

However, you can compare snapshots from two different sessions (as you have done). The compared type information will then contain delta information between the two snapshots. You can also compare two snapshots in the user interface. For more information, see the online documentation. The functionality to compare snapshots from two sessions is currently a bit limited, and the user interface is a bit awkward. This is something we will improve in a future version of the profiler.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests