@@ -7,7 +7,7 @@ This is a guide for how to profile rustc with [perf](https://perf.wiki.kernel.or
7
7
- Get a clean checkout of rust-lang/master, or whatever it is you want to profile.
8
8
- Set the following settings in your ` config.toml ` :
9
9
- ` debuginfo-lines = true `
10
- - ` use-jemalloc = false ` -- lets you do memory use profiling with valgrind
10
+ - ` use-jemalloc = false ` — lets you do memory use profiling with valgrind
11
11
- leave everything else the defaults
12
12
- Run ` ./x.py build ` to get a full build
13
13
- Make a rustup toolchain (let's call it ` rust-prof ` ) pointing to that result
@@ -117,7 +117,7 @@ the `cargo rustc` command, like so:
117
117
118
118
``` bash
119
119
touch src/lib.rs
120
- CARGO_INCREMENTAL=0 perf record -F99 --call-graph dwarf cargo rustc --profile check --lib -- -Zborrowck=mir
120
+ CARGO_INCREMENTAL=0 perf record -F99 --call-graph dwarf cargo rustc --profile check --lib — -Zborrowck=mir
121
121
```
122
122
123
123
[ pf ] : https://github.com/nikomatsakis/perf-focus
@@ -178,7 +178,7 @@ samples where `do_mir_borrowck` was on the stack: in this case, 29%.
178
178
currently executes ` perf script ` (perhaps there is a better
179
179
way...). I've sometimes found that ` perf script ` outputs C++ mangled
180
180
names. This is annoying. You can tell by running `perf script |
181
- head` yourself -- if you see names like ` 5rustc6middle` instead of
181
+ head` yourself — if you see names like ` 5rustc6middle` instead of
182
182
` rustc::middle ` , then you have the same problem. You can solve this
183
183
by doing:
184
184
@@ -191,7 +191,7 @@ should mostly convert those names into a more friendly format. The
191
191
` --from-stdin ` flag to ` perf focus ` tells it to get its data from
192
192
stdin, rather than executing ` perf focus ` . We should make this more
193
193
convenient (at worst, maybe add a ` c++filt ` option to ` perf focus ` , or
194
- just always use it -- it's pretty harmless).
194
+ just always use it — it's pretty harmless).
195
195
196
196
### Example: How much time does MIR borrowck spend solving traits?
197
197
@@ -209,7 +209,7 @@ Percentage : 0%
209
209
Here we used the ` .. ` operator to ask "how often do we have
210
210
` do_mir_borrowck ` on the stack and then, later, some fn whose name
211
211
begins with ` rusc::traits ` ?" (basically, code in that module). It
212
- turns out the answer is "almost never" -- only 12 samples fit that
212
+ turns out the answer is "almost never" — only 12 samples fit that
213
213
description (if you ever see * no* samples, that often indicates your
214
214
query is messed up).
215
215
@@ -264,7 +264,7 @@ function and not some callee of that function** (self). Usually
264
264
### Relative percentages
265
265
266
266
By default, all in perf-focus are relative to the ** total program
267
- execution** . This is useful to help you keep perspective -- often as
267
+ execution** . This is useful to help you keep perspective — often as
268
268
we drill down to find hot spots, we can lose sight of the fact that,
269
269
in terms of overall program execution, this "hot spot" is actually not
270
270
important. It also ensures that percentages between different queries
@@ -273,7 +273,8 @@ are easily compared against one another.
273
273
That said, sometimes it's useful to get relative percentages, so `perf
274
274
focus` offers a ` --relative` option. In this case, the percentages are
275
275
listed only for samples that match (vs all samples). So for example we
276
- could get our percentages relative to the borrowck itself like so:
276
+ could get our percentages relative to the borrowck itself
277
+ like so:
277
278
278
279
``` bash
279
280
> perf focus ' {do_mir_borrowck}' --tree-callees --relative --tree-max-depth 1 --tree-min-percent 5
290
291
: | rustc_mir::dataflow::do_dataflow (8% total, 1% self) [...]
291
292
```
292
293
293
- Here you see that `compute_regions` came up as "47% total" -- that
294
+ Here you see that `compute_regions` came up as "47% total" — that
294
295
means that 47% of `do_mir_borrowck` is spent in that function. Before,
295
- we saw 20% -- that' s because ` do_mir_borrowck` itself is only 43% of
296
+ we saw 20% — that' s because ` do_mir_borrowck` itself is only 43% of
296
297
the total time (and ` .47 * .43 = .20` ).
0 commit comments