如何在 windows 10 个通用应用程序中创建自定义 wpr 配置文件

How to create custom wpr profile in windows 10 universal apps

我需要在 windows 10 中创建一个文件日志记录模式。为此,我需要在 windows 10 个通用应用程序中创建一个自定义配置文件,以便我可以更改默认日志记录从内存模式到文件模式,并更改缓冲区设置。

请帮忙。

Microsoft 在“C:\Program Files (x86)\Windows Kits\Windows Performance Toolkit\SampleWPRControlProfiles.wprp

中提供了一个演示 WPR 配置文件

显示如何配置记录到文件(LoggingMode="File")

    <Profile
        Description="Sample profile: File I/O activity"
        DetailLevel="Verbose"
        Id="MyFileIO.Verbose.File"
        LoggingMode="File"
        Name="MyFileIO"
        >
      <ProblemCategories>
        <ProblemCategory Value="First Level Triage"/>
      </ProblemCategories>
      <Collectors>
        <SystemCollectorId Value="SystemCollector_FileIO">
          <SystemProviderId Value="SystemProvider_FileIO"/>
        </SystemCollectorId>
        <EventCollectorId Value="EventCollector_KernelPower">
          <EventProviders>
            <EventProviderId Value="EventProvider_DotNetProvider"/>
            <EventProviderId Value="EventProvider_Microsoft-Windows-Kernel-Power_AC-DC-State"/>
          </EventProviders>
        </EventCollectorId>
      </Collectors>
    </Profile>

要验证 WPRP 文件,请在 Visual Studio 中打开它,从 windowsperformancerecordercontrol.dll and load it in Visual Studio

中提取最新的 WPRControlProfiles.xsd
  1. 在 Visual Studio 中打开您的 .wprp 文件。

  2. 在主菜单中,选择XML,然后选择Schemas

  3. 在出现的 XML 模式对话框中,选择 Add

  4. 选择 WPRControlProfiles.xsd 架构。

稍后将 WPRP 文件与 WPR.exe 一起使用:

"C:\Program Files (x86)\Windows Kits\Windows Performance Toolkit\wpr.exe" -start MyProfile.wprp

运行 您的应用并停止录制 运行 这个:

"C:\Program Files (x86)\Windows Kits\Windows Performance Toolkit\wpr.exe" -stop Result.etl

现在用 WPA.exe 或 Perfview 分析 ETL 文件。