Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 1198218

Browse files
[wperf] Update usage docs for wperf CLI (#69)
* wperf: update usage and comments for --pe_file, --image_name and --annotate Added small clarification in the code for image name, PE and PDB file name deduction. * wperf: udpate usage in README
1 parent 7871e75 commit 1198218

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

wperf/README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,17 @@ OPTIONS:
112112
Number of consecutive counts in timeline mode (disabled by default).
113113
114114
--annotate
115-
Enable translating addresses taken from samples in sample/record mode into source code line numbers.
115+
Enable translating addresses taken from samples in sample/record mode
116+
into source code line numbers.
116117
117118
--disassemble
118119
Enable disassemble output on sampling mode. Implies 'annotate'.
119120
120121
--image_name
121-
Specify the image name you want to sample.
122+
Specify the image (base) name of a module to sample.
122123
123124
--pe_file
124-
Specify the PE filename (and path).
125+
Specify the PE filename (and path) to sample.
125126
126127
--pdb_file
127128
Specify the PDB filename (and path), PDB file should directly
@@ -133,7 +134,7 @@ OPTIONS:
133134
--sample-display-row
134135
Set how many samples you want to see in the summary (50 by default).
135136
136-
-s, --symbol
137+
--symbol
137138
Filter results for specific symbols (for use with 'record' and 'sample' commands).
138139
139140
--record_spawn_delay
@@ -183,6 +184,8 @@ OPTIONS aliases:
183184
184185
sleep
185186
Alias of `--timeout`.
187+
-s
188+
Alias of `--symbol`.
186189
187190
EXAMPLES:
188191
@@ -212,6 +215,11 @@ EXAMPLES:
212215
with frequency `100000` on core #1 for 30 seconds.
213216
Hint: add `--annotate` or `--disassemble` to `wperf record` command line
214217
parameters to increase sampling "resolution".
218+
219+
> wperf record -e arm_spe_0/ld=1/ -c 8 --cpython\PCbuild\arm64\python_d.exe -c 10**10**100
220+
Launch `python_d.exe -c 10**10**100` process on core no. 8 and start SPE sampling, enable
221+
collection of load sampled operations, including atomic operations that return a value to a register.
222+
Hint: add `--annotate` or `--disassemble` to `wperf record` command.
215223
```
216224

217225
## Important Note: Use of curly braces in command line

wperf/user_request.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,17 @@ void user_request::print_help_usage()
138138
Number of consecutive counts in timeline mode (disabled by default).
139139
140140
--annotate
141-
Enable translating addresses taken from samples in sample/record mode into source code line numbers.
141+
Enable translating addresses taken from samples in sample/record mode
142+
into source code line numbers.
142143
143144
--disassemble
144145
Enable disassemble output on sampling mode. Implies 'annotate'.
145146
146147
--image_name
147-
Specify the image name you want to sample.
148+
Specify the image (base) name of a module to sample.
148149
149150
--pe_file
150-
Specify the PE filename (and path).
151+
Specify the PE filename (and path) to sample.
151152
152153
--pdb_file
153154
Specify the PDB filename (and path), PDB file should directly
@@ -336,13 +337,26 @@ void user_request::init(wstr_vec& raw_args, const struct pmu_device_cfg& pmu_cfg
336337
// Deduce image name and PDB file name from PE file name
337338
if (sample_pe_file.size())
338339
{
340+
/*
341+
* if `image_name` is not provided by user with `--image_name` we can
342+
* deduce image / base module name based on PE file name provided with
343+
* `--pe_file`. In most cases these are the same. In case image name is
344+
* different than PE name users should provide `image_name` to remove
345+
* ambiguity.
346+
*/
339347
if (sample_image_name.empty())
340348
{
341349
sample_image_name = sample_pe_file;
342350
if (do_verbose)
343351
m_out.GetOutputStream() << L"deduced image name '" << sample_image_name << L"'" << std::endl;
344352
}
345353

354+
/*
355+
* We can also deduce PE file's corresponding PDB file (with debug information)
356+
* based on PE file name (and path). Assumptions is that PDB files and PE files
357+
* are located in the same directory and have the same name (excluding extension).
358+
* E.g. `c:\path\to\image.exe` ->`c:\path\to\image.pdb`.
359+
*/
346360
if (sample_pdb_file.empty())
347361
{
348362
sample_pdb_file = ReplaceFileExtension(sample_pe_file, L"pdb");

0 commit comments

Comments
 (0)