-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
Add docs for windows performance analyzer #3149
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,47 @@ | ||||||
# Profiling Boa With Windows Performance Analyzer | ||||||
|
||||||
Windows has a performance analyzing tool that creates graphs and data tables of Event Tracing for Windows (ETW) events. You can analyze your whole system but also individual binaries too. | ||||||
This can be used for performance tracing with Rust programs like Boa. | ||||||
|
||||||
For this to work you will need to have your code running in native windows and not WSL. | ||||||
|
||||||
- First off, install [UI For ETW](https://github.com/google/UIforETW). You can grab the latest version from the releases page. | ||||||
- Then install Windows Performance Toolkit, you can grab it from [here](https://learn.microsoft.com/en-us/windows-hardware/get-started/adk-install) | ||||||
- [Optional] - Follow [Improved Symbol Setup](#improved-symbol-setup) to improve symbol loading. So that its ready once you open up WPA. This points WPA to your pdb files inside your target directory so you can see the function names instead of just addresses. | ||||||
- Open up `UI for ETW`, click on the `Start Tracing` button and then run Boa in dev mode (hopefully a script long enough for it to record something meaningful). | ||||||
- When the program has finished running, click `Save Trace Buffers` to create the trace. | ||||||
- Right click on the your newly created trace and open it with WPA | ||||||
|
||||||
You should have something like this: | ||||||
![WPA](./img/opening_wpa.png) | ||||||
|
||||||
This is broken up into 4 sections: | ||||||
- **Generic Events** (Keyboard, mouse, user-input events), these can be useful to help track when something happened. | ||||||
- **Windows In Focus** (What windows were in focus at the time) | ||||||
- **CPU Usage (Sampled)** Periodically sampling the CPU usage at predefined intervals. We will be using this view mainly | ||||||
- **CPU Usage (Precise)** Offers more detailed and accurate information about CPU usage by using precise event-based tracing. By default Wait Analysis is enabled, which is useful for debugging deadlocks and other issues. However we will not be using this view. | ||||||
|
||||||
|
||||||
Windows Performance Analyzer is analzying everything on your system (which is useful in cases where we may not anticipate outside factors affecting our program). | ||||||
|
||||||
However we only care about the boa process, so we should filter out everything else. We can do this by right clicking boa.exe and filtering down to just this. | ||||||
![filter](./img/filter_to_boa.png) | ||||||
|
||||||
Once completed, navigate to the `CPU Usage (Sampled)` section underneath and click the `Display Graph and Table` header icon, which is the first symbol in the upper right hand corner. | ||||||
|
||||||
Then on the dropdown (same tab) select `Flame By Process, Stack`. If followed correctly you should have something which looks like this: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
![cpu](./img/cpu_usage.png) | ||||||
|
||||||
Almost there.. | ||||||
Symbols are not showing, WPA doesn't scan symbols by default. You need to click Trace at the top and then `Load Symbols`. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
![symbols_working](./img/symbolsWorking.gif) | ||||||
|
||||||
|
||||||
|
||||||
## Improved Symbol Setup | ||||||
You can use an environment variable to tell WPA where your symbols live: I have set: `_NT_SYMBOL_PATH=SRV*C:\symbols*https://msdl.microsoft.com/download/symbols;C:\Users\[you]\[workspace]\boa\target\debug` instead which WPA should pick up automatically. | ||||||
|
||||||
You can read more about `_NT_SYMBOL_PATH` [here](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/symbol-path). | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is WSL ubiquitous enough? Maybe in the interest of clarity it should be fully spelled out.