使用wevtutil安装WPT清单时出现问题 [英] Problem installing WPT manifest using wevtutil

查看:153
本文介绍了使用wevtutil安装WPT清单时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将性能计数器和自定义事件添加到一个软件中,以便可以使用Windows Performance Toolkit程序(例如XPerf和GPUView)查看它们. 我将尽我所有的克制力,避免对该软件的文档状态以及我现在浪费时间尝试从网络中窃取线索的时间大肆宣扬.我将描述如何到达现在的位置,以防万一这对其他迷路的灵魂有用.

I'm trying to add performance counters and custom events to a piece of software, so that I can view these using Windows Performance Toolkit programs such as XPerf and GPUView. I am going to refrain, using all my powers of restraint, from launching into a cathartic rant regarding the state of the documentation for the software and the time I've now wasted trying to tease clues from the web. I'm going to describe how I got to where I am now, just in case this is of use to other lost souls.

到目前为止,我已经收集到我必须为性能计数器和事件编写一个事件清单.您可以手动执行此操作,也可以使用名为" ecmangen.exe "的工具进行此操作.该程序的文档为事件创建清单提供了很好的分步指南,但没有说明如何将它们与代码集成.

So far, I've gathered that I have to write an Event manifest for my performance counters and events. You can do this by hand or by using a tool called 'ecmangen.exe'. The documentation for that program gives a nice step by step guide for event creating manifests but doesn't explain how to integrate these with your code.

据我所知,下一步是使用两个神秘的命令行应用程序" MC.exe "和" CTRPP.exe ".这些似乎会生成C或C#头文件,源文件和资源文件,分别用于将事件和计数器检测添加到您的代码中. 接下来,您必须构建代码(查看"C:\ Program Files \ Microsoft SDKs \ Windows \ v7.1 \ Samples \ winbase \ Eventing"中的示例),然后转到当前遇到的问题:正确使用下一个加密工具" wevtutil.exe "

The next step, as far as I can work out, is to use two cryptic command line applications 'MC.exe' and 'CTRPP.exe'. These seem to generate C or C# headers, source and resource files for adding event and counter instrumentation to your code, respectively. Next, you have to build your code (look at the samples in 'C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\winbase\Eventing') and then we come to where I'm currently stuck: the correct use of the next cryptic tool 'wevtutil.exe'

此工具需要做两件事:使用这些资源在其中编译的二进制文件(exe或DLL)以及用于生成这些资源的清单文件.我遇到的麻烦是,对于二进制文件的位置,它非常挑剔,而且我无法确定这种挑剔的形式.焚化和献祭没有取得任何结果.

This tool needs two things: the binary (exe or DLL) that you've compiled with those resources in it and the manifest file you used to generate those resources. The trouble I'm having is that it's very picky about where the binary file is and I've been unable to determine the form of this pickiness. Incantations and goat sacrifices have yielded no results.

如果清单文件中"provider"标签的"resourceFileName"字段中定义了路径,例如"c:\ MYDIR \ TEd.exe",那就很好.但是,如果我将相同的exe放在另一个文件夹中(失败的文件夹是C:\ tw \ TEd.exe),它会抱怨.

If I have a path defined in the 'resourceFileName' field of the 'provider' tag in the manifest file such as 'c:\MYDIR\TEd.exe' then it is fine. If, however, I put the same exe in a different folder (one that failed was C:\tw\TEd.exe), it complains.

给出的错误消息为警告:无法访问Publisher TEd-Event-Provider资源." ,但没有更多关于其原因或尝试查找的解释.

The error message given is 'Warning: Publisher TEd-Event-Provider resources are not accessible.' but no more explanation as to why, or where it tried to look.

所以,我要以错误的方式添加工具吗,是否已经有指南来说明所有陷阱,以及'wevtutil.exe对目录名称的奇怪选择的本质是什么?

So, am I going about adding instrumentation in the wrong way, is there already a guide that explains all the gotchas and what is the nature of 'wevtutil.exe's strange selectivity towards directory names.

预先感谢

蒂姆.

推荐答案

我刚收到完全相同的消息,然后花了一个小时来解决它,然后才开始头脑风暴并读取错误消息msg ;-).

I've just had exactly the same message, and struggled for an hour to resolve it, before I had a brainwave and read the error msg ;-).

解决我的问题的方法只是将".rc"文件添加到我的项目中,然后重新生成.回头看是很明显的,但是它让我难过了一段时间.

The solution to my problem was simply to add the ".rc" file to my project, and then re-build. Looking back it is fairly obvious, but it had me stumped for a while.

希望这会有所帮助.

编辑-2月4日 好的,不太确定我是否知道您的问题是什么,但是下面的批处理脚本是我完成所有操作的方式.祝你好运.

Edit - 4th Feb Ok, not too sure if I know what your problem is, but the following batch script is how I did it all. Good luck.

rem -------------------------------------------------------------------
rem Do all of this from the project directory

rem -------------------------------------------------------------------
rem Generate Header and Resource - remove the ReadOnly attrib to "help" it along
attrib -r MyModuleTracing.h
mc.exe -um MyModuleTracing.xml
rem This generates MyModuleTracing.h and MyModuleTracing.rc, add both to your project

rem -------------------------------------------------------------------
rem ** Now build the project **
rem -------------------------------------------------------------------

rem Register MyModule Tracing with the system
if exist MyModuleTracing.xml (
  wevtutil um MyModuleTracing.xml

  copy MyModuleTracing.xml Release
  cd Release
  copy MyModule.dll %SystemRoot%\System32
  wevtutil im MyModuleTracing.xml
)

rem -------------------------------------------------------------------
rem Do a capture, and also export the results to an XML file.
xperf -start MyModuleSession -on [REPLACE_WITH_YOUR_GUID] -f MyModuleSession.etl
xperf -on base -f Kernel.etl

rem Run the app, wait until exit, and then stop the capture
start /wait MyModule.exe

xperf -stop
xperf -stop MyModuleSession
xperf -merge MyModuleSession.etl Kernel.etl MyModuleSessionMerged.etl

tracerpt MyModuleSessionMerged.etl -o MyModuleSessionMerged.xml -of XML

这篇关于使用wevtutil安装WPT清单时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆