GPUView is a powerful tool for GPU/CPU interaction profiling for Windows. It’s interface isn’t very user friendly, but it gets job done. I used it for optimizing in-house GPU lightmapper and spend some time trying to find a way to add custom event markers.
Most solutions on web are quite complicated – involving writing strange DLLs, manifests, using ECManGen.exe… Thankfully there is a much simpler solution.
First register an event handler using custom GUID:
REGHANDLE gEventHandle; GUID guid; UuidFromString( (RPC_CSTR) "a9744ea3-e5ac-4f2f-be6a-42aad08a9c6f", &guid ); EventRegister( &guid, nullptr, nullptr, &gEventHandle );
Then just call EventWriteString with custom text:
EventWriteString( gEventHandle, 0, 0, L"Render" );
Final step is to modify log.cmd in order to add this custom GUID for tracing (same one, which was passed to EventRegister). Just pass it as new Xperf parameter (see TRACE_DSHOW or TRACE_DX variables for reference).
During next GPUView profiling session open “Event Listing” dialog and locate custom event by GUID:
I guess it should also work for XPerf and other tools which use windows event tracing. For better integration look up Writing anifest-based events, Writing an Instrumentation Manifest and ECManGen.exe on MSDN.

Is it possible to provide the instrumentation manual – the xml file as input so that the gpuview would parse the ‘private data’ ?
LikeLike
where does the above code bock go?
LikeLike
You can register it at any point of you program, e.g. somewhere during init at startup.
LikeLike