mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Merge #3202
3202: Fix RA_PROF and replace ra_cli mentions r=matklad a=lnicola Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
commit
9053003e3b
4 changed files with 15 additions and 19 deletions
|
@ -74,7 +74,7 @@ impl Args {
|
||||||
ra-cli-parse
|
ra-cli-parse
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
ra_cli parse [FLAGS]
|
ra_lsp_server parse [FLAGS]
|
||||||
|
|
||||||
FLAGS:
|
FLAGS:
|
||||||
-h, --help Prints help inforamtion
|
-h, --help Prints help inforamtion
|
||||||
|
@ -94,7 +94,7 @@ FLAGS:
|
||||||
ra-cli-symbols
|
ra-cli-symbols
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
ra_cli highlight [FLAGS]
|
ra_lsp_server highlight [FLAGS]
|
||||||
|
|
||||||
FLAGS:
|
FLAGS:
|
||||||
-h, --help Prints help inforamtion"
|
-h, --help Prints help inforamtion"
|
||||||
|
@ -113,7 +113,7 @@ FLAGS:
|
||||||
ra-cli-highlight
|
ra-cli-highlight
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
ra_cli highlight [FLAGS]
|
ra_lsp_server highlight [FLAGS]
|
||||||
|
|
||||||
FLAGS:
|
FLAGS:
|
||||||
-h, --help Prints help information
|
-h, --help Prints help information
|
||||||
|
@ -133,7 +133,7 @@ FLAGS:
|
||||||
ra-cli-analysis-stats
|
ra-cli-analysis-stats
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
ra_cli analysis-stats [FLAGS] [OPTIONS] [PATH]
|
ra_lsp_server analysis-stats [FLAGS] [OPTIONS] [PATH]
|
||||||
|
|
||||||
FLAGS:
|
FLAGS:
|
||||||
-h, --help Prints help information
|
-h, --help Prints help information
|
||||||
|
@ -168,10 +168,10 @@ ARGS:
|
||||||
if matches.contains(["-h", "--help"]) {
|
if matches.contains(["-h", "--help"]) {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"\
|
"\
|
||||||
ra_cli-analysis-bench
|
ra_lsp_server-analysis-bench
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
ra_cli analysis-bench [FLAGS] [OPTIONS] [PATH]
|
ra_lsp_server analysis-bench [FLAGS] [OPTIONS] [PATH]
|
||||||
|
|
||||||
FLAGS:
|
FLAGS:
|
||||||
-h, --help Prints help information
|
-h, --help Prints help information
|
||||||
|
@ -207,7 +207,7 @@ ARGS:
|
||||||
ra-cli
|
ra-cli
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
ra_cli <SUBCOMMAND>
|
ra_lsp_server <SUBCOMMAND>
|
||||||
|
|
||||||
FLAGS:
|
FLAGS:
|
||||||
-h, --help Prints help information
|
-h, --help Prints help information
|
||||||
|
|
|
@ -351,13 +351,13 @@ impl Drop for Scope {
|
||||||
/// 2. Build with `cpu_profiler` feature.
|
/// 2. Build with `cpu_profiler` feature.
|
||||||
/// 3. Tun the code, the *raw* output would be in the `./out.profile` file.
|
/// 3. Tun the code, the *raw* output would be in the `./out.profile` file.
|
||||||
/// 4. Install pprof for visualization (https://github.com/google/pprof).
|
/// 4. Install pprof for visualization (https://github.com/google/pprof).
|
||||||
/// 5. Use something like `pprof -svg target/release/ra_cli ./out.profile` to see the results.
|
/// 5. Use something like `pprof -svg target/release/ra_lsp_server ./out.profile` to see the results.
|
||||||
///
|
///
|
||||||
/// For example, here's how I run profiling on NixOS:
|
/// For example, here's how I run profiling on NixOS:
|
||||||
///
|
///
|
||||||
/// ```bash
|
/// ```bash
|
||||||
/// $ nix-shell -p gperftools --run \
|
/// $ nix-shell -p gperftools --run \
|
||||||
/// 'cargo run --release -p ra_cli -- parse < ~/projects/rustbench/parser.rs > /dev/null'
|
/// 'cargo run --release -p ra_lsp_server -- parse < ~/projects/rustbench/parser.rs > /dev/null'
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct CpuProfiler {
|
pub struct CpuProfiler {
|
||||||
|
|
|
@ -113,7 +113,7 @@ communication, and `print!` would break it.
|
||||||
If I need to fix something simultaneously in the server and in the client, I
|
If I need to fix something simultaneously in the server and in the client, I
|
||||||
feel even more sad. I don't have a specific workflow for this case.
|
feel even more sad. I don't have a specific workflow for this case.
|
||||||
|
|
||||||
Additionally, I use `cargo run --release -p ra_cli -- analysis-stats
|
Additionally, I use `cargo run --release -p ra_lsp_server -- analysis-stats
|
||||||
path/to/some/rust/crate` to run a batch analysis. This is primarily useful for
|
path/to/some/rust/crate` to run a batch analysis. This is primarily useful for
|
||||||
performance optimizations, or for bug minimization.
|
performance optimizations, or for bug minimization.
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ There's also two VS Code commands which might be of interest:
|
||||||
|
|
||||||
# Profiling
|
# Profiling
|
||||||
|
|
||||||
We have a built-in hierarchical profiler, you can enable it by using `RA_PROF` env-var:
|
We have a built-in hierarchical profiler, you can enable it by using `RA_PROFILE` env-var:
|
||||||
|
|
||||||
```
|
```
|
||||||
RA_PROFILE=* // dump everything
|
RA_PROFILE=* // dump everything
|
||||||
|
@ -165,17 +165,17 @@ RA_PROFILE=foo|bar|baz // enabled only selected entries
|
||||||
RA_PROFILE=*@3>10 // dump everything, up to depth 3, if it takes more than 10 ms
|
RA_PROFILE=*@3>10 // dump everything, up to depth 3, if it takes more than 10 ms
|
||||||
```
|
```
|
||||||
|
|
||||||
In particular, I have `export RA_PROFILE='*>10' in my shell profile.
|
In particular, I have `export RA_PROFILE='*>10'` in my shell profile.
|
||||||
|
|
||||||
To measure time for from-scratch analysis, use something like this:
|
To measure time for from-scratch analysis, use something like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cargo run --release -p ra_cli -- analysis-stats ../chalk/
|
$ cargo run --release -p ra_lsp_server -- analysis-stats ../chalk/
|
||||||
```
|
```
|
||||||
|
|
||||||
For measuring time of incremental analysis, use either of these:
|
For measuring time of incremental analysis, use either of these:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cargo run --release -p ra_cli -- analysis-bench ../chalk/ --highlight ../chalk/chalk-engine/src/logic.rs
|
$ cargo run --release -p ra_lsp_server -- analysis-bench ../chalk/ --highlight ../chalk/chalk-engine/src/logic.rs
|
||||||
$ cargo run --release -p ra_cli -- analysis-bench ../chalk/ --complete ../chalk/chalk-engine/src/logic.rs:94:0
|
$ cargo run --release -p ra_lsp_server -- analysis-bench ../chalk/ --complete ../chalk/chalk-engine/src/logic.rs:94:0
|
||||||
```
|
```
|
||||||
|
|
|
@ -147,10 +147,6 @@ different from data on disk. This is more or less the single really
|
||||||
platform-dependent component, so it lives in a separate repository and has an
|
platform-dependent component, so it lives in a separate repository and has an
|
||||||
extensive cross-platform CI testing.
|
extensive cross-platform CI testing.
|
||||||
|
|
||||||
### `crates/ra_cli`
|
|
||||||
|
|
||||||
A CLI interface to rust-analyzer, mainly for testing.
|
|
||||||
|
|
||||||
## Testing Infrastructure
|
## Testing Infrastructure
|
||||||
|
|
||||||
Rust Analyzer has three interesting [systems
|
Rust Analyzer has three interesting [systems
|
||||||
|
|
Loading…
Reference in a new issue