添加计数器时Perflib 2崩溃(来自Perfmon)

时间:2010-12-13 17:03:45

标签: c++ perfmon

我有一个C ++应用程序(在Win32下),我需要提供性能计数器信息。我正在使用Perflib v2,因此创建了一个由CTRPP处理的清单。

我的提供程序然后调用PerfAutoInitialize和PerfCreateInstance而没有错误。

当我在Perfmon中添加计数器时,我的应用程序崩溃了。遍历反汇编显示了perflib工作线程中调用内部函数(pcwum.dll)PerfpAddOrRemoveCounter的代码。这将调用PerfpValidateCounter,它返回edi中的地址;此地址无效,当调用者解除引用时,应用程序崩溃。

如果我重新启动提供程序,计数器仍然在Perfmon中可见并正确递增。

清单如下

<instrumentationManifest xsi:schemaLocation="http://schemas.microsoft.com/win/2004/08/events eventman.xsd"
     xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:trace="http://schemas.microsoft.com/win/2004/08/events/trace">
  <instrumentation>
    <counters xmlns="http://schemas.microsoft.com/win/2005/12/counters">
      <provider callback = "custom"
        applicationIdentity = "TPerfStatsCollector.exe"
            providerName = "TPerfstatscollector"
        providerType = "userMode"
        providerGuid = "{33d68436-4cf9-4f58-9976-44b048b072f3}"
        symbol = "symbolGUID">
        <counterSet guid = "{381300a5-3be6-46d8-8615-12d8b259aae4}"
          uri = "A.AxPServer.Counters.Basic"
          name = "Basic counters"
          description = "These are the sample counters"
          instances = "Single"
          symbol = "setGUID">
          <counter id = "1"
            uri = "A.AxPServer.Counters.Basic.Session"
            name = "Sessions"
            description = "Number of sessions"
            type = "perf_counter_rawcount"
            detailLevel = "standard"
            defaultScale = "1">            
          </counter>
        </counterSet>
      </provider>
   </counters>
  </instrumentation>
</instrumentationManifest>

1 个答案:

答案 0 :(得分:1)

我的坏。这是64/32位问题,我意识到我正在构建一个32位提供程序以在64位操作系统上运行。一切顺利,一切正常。

相关问题