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.
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.
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'
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.
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.
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.
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.
Thanks in advance,
Tim.