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

Feature request: flag for starting vcperf regardless of previous trace #50

Open
zsd4yr opened this issue Nov 22, 2024 · 2 comments
Open

Comments

@zsd4yr
Copy link

zsd4yr commented Nov 22, 2024

If there is already a vcperf trace running, you cannot start a new one. This is problematic for scenarios where the trace itself can be interrruputed, like during a scheduled restart. The output shows a way to shut down the last session, but I would love to avoid jumping through the hoops to find the windows sdk install dir, find the latest version, find tracelog.exe, call it, grep the output to find the name of the previous session, and finally call vcperf /stop and wait for the trace to save to a file, even if you don't care about it at all. The last session is completely useless to me.

Current:

vcperf /start SessionName
Microsoft (R) Visual C++ (R) Performance Analyzer 2.2.22080401
Starting tracing session AllZoe...
Failed to start trace.
A trace that is currently being collected on your system is preventing vcperf from starting a new one. This can occur if you forgot to stop a vcperf trace prior to running the start command, or if processes other than vcperf have started ETW traces of their own. Please try running the vcperf /stop or /stopnoanalyze commands on your previously started trace. If you do not remember the session name that was used for starting a previous vcperf trace, or if you don't recall starting one at all, you can use the 'tracelog -l' command from an elevated command prompt to list all ongoing tracing sessions on your system. Your currently ongoing vcperf trace will show up as MSVC_BUILD_INSIGHTS_SESSION_<session name that was passed to vcperf /start>. You can then issue a vcperf /stop or /stopnoanalyze command with the identified session name (the part between the angle brackets). If no MSVC_BUILD_INSIGHTS_SESSION_ is found, it could mean a kernel ETW trace is currently being collected. This trace will show up as 'NT Kernel Logger' in your tracelog output, and will also prevent you from starting a new trace. You can stop the 'NT Kernel Logger' session by running 'xperf -stop' from an elevated command prompt.

I'd like a flag I can pair with vcperf /start to throw away whatever state vcperf might already have and whatever session is currently being tracked immediately.

Desired:

vcperf /start SessionName /force
Microsoft (R) Visual C++ (R) Performance Analyzer 2.2.22080401
Found previous session PreviousSessionName. Force option will throw away this trace. If you want to avoid this behavior, remove the force flag.
Starting tracing session SessionName...
Tracing session started successfully!

@zsd4yr
Copy link
Author

zsd4yr commented Nov 22, 2024

Probably this would involving adding this flag to TRACING_SESSION_OPTIONS struct

@zsd4yr
Copy link
Author

zsd4yr commented Nov 22, 2024

Just making notes incase anyone comes here later -- in powershell, using Stop-EtwTraceSession "MSVC_BUILD_INSIGHTS_SESSION_*" from https://learn.microsoft.com/en-us/powershell/module/eventtracingmanagement/stop-etwtracesession is waaaaaaay easier

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

1 participant