Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIforETW should use -capturestate correctly #136

Open
randomascii opened this issue Jul 9, 2019 · 2 comments
Open

UIforETW should use -capturestate correctly #136

randomascii opened this issue Jul 9, 2019 · 2 comments

Comments

@randomascii
Copy link
Contributor

The -capturestate option's behavior/intent/etc. is only lightly documented, however it appears that UIforETW is probably using it incorrectly. The documentation suggests that it is only needed for circular-buffer tracing whereas UIforETW always uses it:

https://docs.microsoft.com/en-us/windows-hardware/test/wpt/start

This comment suggests that -capturestate is best used just before recording the circular buffers, in order to get the EventSource to dump its manifest into the trace.
https://blogs.msdn.microsoft.com/vancem/2014/04/10/more-on-using-eventsources-with-xperf-or-wpr/#comment-3903

So, probably UIforETW should be doing -capturestate just before recording circular buffer traces, and nowhere else.

@Zhentar
Copy link

Zhentar commented Oct 28, 2019

I do think that in most cases -capturestate is only needed for circular buffer traces, but that is definitely not the case for Microsoft-Windows-DxgKrnl - it does not emit state when it is enabled and so requires a capturestate call. I'm also pretty sure I've seen EventSource providers fail to emit their manifest without a capturestate command.

It also seems like capturestate command responses tend to be pretty cheap so I'd recommend erring on the side of doing unnecessary -capturestate commands.

@randomascii
Copy link
Contributor Author

Thanks for the feedback. I recently (August 20th, 410fc6e) found that the Microsoft-Windows-Win32k provider needs a -capturestate command in order to reliably get window focus information. That is, if you don't change focus and don't do a -capturestate for it then the window-in-focus graph will be blank. This explains problems that I had many years ago.

With my new and improving understanding of this I think that the existing usage should be retained (it is needed for some providers) and an additional invocation just before recording circular-memory buffers should be added.

And I'll add enough comments to serve as documentation, since the existing documentation seems to be insufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants