about summary refs log tree commit diff
path: root/compiler/rustc_session
diff options
context:
space:
mode:
authorAman Arora <me@aman-arora.com>2021-05-05 15:57:08 -0400
committerAman Arora <me@aman-arora.com>2021-06-28 14:21:55 -0400
commitfc273e9bf2ab4594e8dcdb737b63bffb3f6b08c9 (patch)
tree5d4c81800d048385b8b3d24b8f70bad4ad03bdae /compiler/rustc_session
parent3e9d7ecf784e5ecaf7437d04be3992ad23fa7cb6 (diff)
downloadrust-fc273e9bf2ab4594e8dcdb737b63bffb3f6b08c9.tar.gz
rust-fc273e9bf2ab4594e8dcdb737b63bffb3f6b08c9.zip
Introduce -Zprofile-closures to evaluate the impact of 2229
This creates a CSV with name "closure_profile_XXXXX.csv", where the
variable part is the process id of the compiler.

To profile a cargo project you can run one of the following depending on
if you're compiling a library or a binary:

```
cargo +stage1 rustc --lib -- -Zprofile-closures
cargo +stage1 rustc --bin -- -Zprofile-closures
```
Diffstat (limited to 'compiler/rustc_session')
-rw-r--r--compiler/rustc_session/src/options.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index e144c8f168e..4c40d0c367e 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -1209,6 +1209,8 @@ options! {
          "show backtraces for panics during proc-macro execution (default: no)"),
     profile: bool = (false, parse_bool, [TRACKED],
         "insert profiling code (default: no)"),
+    profile_closures: bool = (false, parse_no_flag, [UNTRACKED],
+        "profile size of closures"),
     profile_emit: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
         "file path to emit profiling data at runtime when using 'profile' \
         (default based on relative source path)"),