使用DOT内存API在同一.dmv文件上拍摄多个快照



我正在尝试使用DOT MOMENE API介绍我的特定代码。当我调用dump()方法时,我的期望是拍摄快照并将其保存到dir。

我试图在执行我的代码之前和通过调用dump()方法执行代码之前,在执行代码之前将两个快照。

执行代码。

是否可以在同一输出文件中创建两个快照,以便从独立dot内存中进行操作?

感谢您的建议。以下是代码段

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();

是否可以在同一输出文件中创建两个快照,以便从独立dot内存中进行操作?

快照通常是一堆文件。.dmw是快照的存档。这是现在的设计。原因是能够立即开始将快照发送到远程主机。这是r#要求。

我想您可以使用dotmemory命令行探索器,而不是"自我proging" API来满足您的需求。

启动dotmemory命令行剖面。确定profiler已经连接到您的应用程序,因为您需要分析dotmemory clt流程输出。

所以,伪代码以获取您需要的东西

dotMemory.exe attach --service-output --use-api "your_app_PID"
// then the message will be printed to output
// ##dotMemory["connected",{"pid":your_app_PID,"name":"your_app_NAME.exe"}]
wait for this message
// the rest of your code remains the same
// and you need only JetBrains.Profiler.Windows.Api.dll
// no more need JetBrains.Profiler.Windows.SelfApi.dll
if (MemoryProfiler.IsActive)
{
    MemoryProfiler.Dump();
    MyMethodTobeProfiled();
    MemoryProfiler.Dump();
}
if (MemoryProfiler.CanDetach)
   MemoryProfiler.Detach();

在此处阅读有关dotmemory命令行探索器的更多信息

最新更新