I'm trying to find the easiest way to record the HyperTransport Bandwidth counters while a multi-threaded process is running on my 48-core Magny-Cours Windows 2K8 server (64-bit). I would like to be able to plot a graph of HT bandwidth on each link while the app is running, with say one data point every second.
I've tried to find a way to do this with CAProfile and the CA Gui .. but it doesn't seem to be possible.
I just came across the CodeAnalyst API which looks promising. It has the notion of 'Counters' which you can manually sample during a profiling run.
The documentation is pretty minimal (i.e. list of parameters), but as far as I can tell I need to call the following functions in this order:
2) fnMakeProfileEvent(eventid, mask, ... , true, &performanceEvent)
3) fnSetCountingEvent(core, counterid, EventConfiguration)
4) fnStartProfiling(false, NULL, NULL)
5) while (!done) fnGetEventCount(core, counterid, &count);
When I do this, all functions return S_OK, until I get to fnGetEventCount which returns error 8000000a, "The profiler was not currently profiling"
If I add a call to fnGetProfilerState after step 4 it tells me the profiler is stopped, even though fnStartProfiling returned S_OK!
I've also tried coding this up using fnSetCountingConfiguration and fnGetAllEventCounts, but I get very similar errors.
Has anybody else managed to get this API to work? Alternatively, could somebody please suggest a way to either debug this API or obtain the same data using the GUI or command line profiler?