aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_prof
Commit message (Collapse)AuthorAgeFilesLines
* Print errors when failing to create a perf counterAleksey Kladov2020-07-301-3/+10
|
* FixesAleksey Kladov2020-07-301-11/+1
|
* Fix non-linux compilationAleksey Kladov2020-07-302-6/+25
|
* Report instructions in addition to timeAleksey Kladov2020-07-303-0/+75
| | | | They hopefully will be more stable on CI
* fix castAleksey Kladov2020-07-301-1/+1
|
* Allow negative bytesAleksey Kladov2020-07-301-12/+20
| | | | Gotta be optimistic about those memory usage optimizations
* Drop resident from memory usageAleksey Kladov2020-07-301-4/+3
|
* Add rustc-perf to metricsAleksey Kladov2020-07-251-0/+6
|
* Setup global allocator in the correct crateAleksey Kladov2020-07-222-6/+0
| | | | It worked before, but was roundabout
* Remove support for jemallocAleksey Kladov2020-07-223-20/+2
| | | | | We only used it for measuring memory usage, but now we can use glibc's allocator for that just fine
* Allow gathering memory stats on non-jemalloc LinuxJonas Schievink2020-07-212-10/+17
|
* Merge #5354bors[bot]2020-07-152-0/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5354: Add opt-in mimalloc feature r=matklad a=ivan This adds a `mimalloc` feature to use [mimalloc](https://github.com/microsoft/mimalloc) via [mimalloc_rust](https://github.com/purpleprotocol/mimalloc_rust), and a corresponding `cargo xtask install --server --mimalloc`. In my tests on Linux, mimalloc seems to run consistently faster than jemalloc and uses only slightly more memory in `analysis-stats` on chalk. Also, builds with mimalloc produce a binary 3MB smaller than builds with jemalloc. A summary of `env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/` runs on NixOS master on an Intel 4790K in VMware Workstation: <table> <tr> <td></td><td>self-reported time</td><td>elapsed time</td><td>max RSS</td> </tr> <tr><td>glibc 2.30 run 1</td><td>225.1 sec</td><td>3:46.91</td><td>1075208</td></tr> <tr><td>glibc 2.30 run 2</td><td>228.4 sec</td><td>3:50.13</td><td>1074996</td></tr> <tr><td>jemalloc run 1</td><td>201.8 sec</td><td>3:23.03</td><td>1055960</td></tr> <tr><td>jemalloc run 2</td><td>199.2 sec</td><td>3:20.41</td><td>1065040</td></tr> <tr><td>mimalloc run 1</td><td>188.6 sec</td><td>3:09.77</td><td>1105584</td></tr> <tr><td>mimalloc run 2</td><td>185.0 sec</td><td>3:06.23</td><td>1108132</td></tr> <tr><td>mimalloc + lto run 1</td><td>160.7 sec</td><td>2:41.80</td><td>1106076</td></tr> <tr><td>mimalloc + lto run 2</td><td>162.2 sec</td><td>2:43.31</td><td>1104268</td></tr> </tr> </table> I included an `lto = true; codegen-units = 1` run out of curiosity, this PR doesn't enable it. <details> <summary>analysis-stats benchmark runs</summary> ## default ``` # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.10s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 333.880345ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 10.176299461s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 214.968806927s, 0b allocated 0b resident Total: 225.145114417s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 225.34 System time (seconds): 1.49 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:46.91 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1075208 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 6 Minor (reclaiming a frame) page faults: 294711 Voluntary context switches: 365 Involuntary context switches: 3273 Swaps: 0 File system inputs: 2904 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.10s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 332.711598ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 9.895020518s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 218.5001697s, 0b allocated 0b resident Total: 228.39519833s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 228.26 System time (seconds): 1.75 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:50.13 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1074996 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 9 Minor (reclaiming a frame) page faults: 294748 Voluntary context switches: 330 Involuntary context switches: 1561 Swaps: 0 File system inputs: 12608 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 ``` ## jemalloc ``` # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.11s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 356.090374ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 10.176550183s, 439mb allocated 465mb resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 191.607201827s, 993mb allocated 1036mb resident Total: 201.783937913s, 993mb allocated 1036mb resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 201.07 System time (seconds): 1.89 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:23.03 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1055960 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 357755 Voluntary context switches: 240 Involuntary context switches: 1889 Swaps: 0 File system inputs: 256 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.10s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 317.917622ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 9.902142185s, 439mb allocated 463mb resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 189.295317017s, 993mb allocated 1046mb resident Total: 199.197555943s, 993mb allocated 1046mb resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 198.64 System time (seconds): 1.67 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:20.41 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1065040 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 369013 Voluntary context switches: 243 Involuntary context switches: 2835 Swaps: 0 File system inputs: 0 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 ``` ## mimalloc ``` # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.12s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 332.116806ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 9.796643695s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 178.82132362s, 0b allocated 0b resident Total: 188.617975605s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 187.70 System time (seconds): 1.97 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:09.77 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1105584 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 296481 Voluntary context switches: 222 Involuntary context switches: 1868 Swaps: 0 File system inputs: 256 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.13s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 320.046776ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 9.287690124s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 175.710939697s, 0b allocated 0b resident Total: 184.998640033s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 184.38 System time (seconds): 1.81 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:06.23 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1108132 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 297055 Voluntary context switches: 374 Involuntary context switches: 2374 Swaps: 0 File system inputs: 0 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 ``` ## mimalloc + lto ``` # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.11s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 369.600196ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 7.572726834s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 153.090899101s, 0b allocated 0b resident Total: 160.663635235s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 160.01 System time (seconds): 1.70 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 2:41.80 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1106076 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 1 Minor (reclaiming a frame) page faults: 296610 Voluntary context switches: 209 Involuntary context switches: 2798 Swaps: 0 File system inputs: 8 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 # env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ Finished release [optimized] target(s) in 0.10s Running `target/release/rust-analyzer analysis-stats ../chalk/` [ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine [ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration [ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration Database loaded 334.630658ms Crates in this dir: 11 Total modules found: 159 Total declarations: 2631 Total functions: 1947 Item Collection: 7.71699197s, 0b allocated 0b resident Total expressions: 57094 Expressions of unknown type: 2938 (5%) Expressions of partially unknown type: 2427 (4%) Type mismatches: 232 Inference: 154.50351318s, 0b allocated 0b resident Total: 162.220513775s, 0b allocated 0b resident Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/" User time (seconds): 161.52 System time (seconds): 1.74 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 2:43.31 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1104268 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 296183 Voluntary context switches: 200 Involuntary context switches: 1666 Swaps: 0 File system inputs: 0 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 ``` </details> Co-authored-by: Ivan Kozik <[email protected]>
| * Add opt-in mimalloc featureIvan Kozik2020-07-142-0/+6
| |
* | Add a license field to all the cratesYuki Okushi2020-07-141-0/+1
|/
* disable profilingAleksey Kladov2020-07-111-1/+1
|
* Profiling exampleAleksey Kladov2020-07-112-2/+7
|
* Profiling tweaksAleksey Kladov2020-07-112-0/+7
|
* Simplify profiler impl (bubble up Option and shorten codeveetaha2020-04-251-24/+21
|
* Extract messy tree handling out of profiling codeAleksey Kladov2020-04-254-150/+115
|
* SimplifyAleksey Kladov2020-04-251-20/+17
|
* Simplify hprofAleksey Kladov2020-04-251-85/+64
|
* Move hprof to a separate fileAleksey Kladov2020-04-252-393/+398
|
* minor clenupAleksey Kladov2020-04-251-11/+14
|
* Move timeit to stdxAleksey Kladov2020-04-101-15/+0
|
* Fix race in the testsAleksey Kladov2020-03-301-0/+8
|
* Allow specifying additional info on call to profileAleksey Kladov2020-03-061-19/+38
|
* Remove unused dependenciesShotaro Yamada2020-02-271-1/+0
|
* Make backtrace optionalAleksey Kladov2020-02-192-1/+2
|
* Update versionsKirill Bulatov2020-02-181-4/+4
|
* Run cargo +nightly fix --clippy -Z unstable-optionsKirill Bulatov2020-02-181-1/+1
|
* Rename the binary to rust-analyzerAleksey Kladov2020-02-181-2/+2
|
* Replace ra_cli mentionsLaurențiu Nicola2020-02-171-2/+2
|
* Enable profiling for benchAleksey Kladov2020-02-161-0/+7
|
* Avoid premature pessimizationAleksey Kladov2020-02-021-32/+32
| | | | | | The extra allocation for message should not matter here at all, but using a static string is just as ergonomic, if not more, and there's no reason to write deliberately slow code
* Merge #2895bors[bot]2020-01-291-46/+71
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2895: Rewrite ra_prof's profile printing r=michalt a=michalt This changes the way we print things to first construct a mapping from events to the children and uses that mapping to actually print things. It should not change the actual output that we produce. The new approach two benefits: * It avoids a potential quadratic behavior of the previous approach. For instance, for a vector of N elements: ``` [Message{level: (N - 1)}, ..., Message{level: 1}, Message{level: 0}] ``` we would first do a linear scan to find entry with level 0, then another scan to find one with level 1, etc. * It makes it much easier to improve the output in the future, because we now pre-compute the children for each entry and can easily take that into account when printing. Signed-off-by: Michal Terepeta <[email protected]> Co-authored-by: Michal Terepeta <[email protected]>
| * A couple of small improvements to ra_prof printingMichal Terepeta2020-01-291-3/+3
| | | | | | | | | | | | Based on suggestions from @matklad. Signed-off-by: Michal Terepeta <[email protected]>
| * Rewrite ra_prof's profile printingMichal Terepeta2020-01-221-46/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the way we print things to first construct a mapping from events to the children and uses that mapping to actually print things. It should not change the actual output that we produce. The new approach two benefits: * It avoids a potential quadratic behavior of the previous approach. For instance, for a vector of N elements: ``` [Message{level: (N - 1)}, ..., Message{level: 1}, Message{level: 0}] ``` we would first do a linear scan to find entry with level 0, then another scan to find one with level 1, etc. * It makes it much easier to improve the output in the future, because we now pre-compute the children for each entry and can easily take that into account when printing. Signed-off-by: Michal Terepeta <[email protected]>
* | Add print_time helperAleksey Kladov2020-01-251-0/+15
|/
* Fix a corner case when printing unaccounted timeMichal Terepeta2020-01-191-4/+52
| | | | | | | | | | | | | | | | | | | | | | Previously `ra_prof` wouldn't actually print the unaccounted time in some cases. We would print, for instance, this: ``` 5ms - foo 2ms - bar ``` instead of: ``` 5ms - foo 2ms - bar 3ms - ??? ``` The fix is to properly handle the case when an entry has 0 children instead of using the `last` variable. Signed-off-by: Michal Terepeta <[email protected]>
* Improve profiling output when duration filter is specifiedMichal Terepeta2020-01-021-4/+25
| | | | | | | | | | | | | | | In particular: - Use strict inequality for comparisons, since that's what the filter syntax supports. - Convert to millis for comparisons, since that's the unit used both for the filter and when printing. Now something like `RA_PROFILE='*>0'` will only print things that took at least 1ms (when rounded to millis). Signed-off-by: Michal Terepeta <[email protected]>
* More compact profiling displayAleksey Kladov2019-12-221-4/+4
|
* Disable doctestsAleksey Kladov2019-11-171-0/+3
|
* Renormalize line endingskjeremy2019-11-151-19/+19
|
* Even if jemalloc feature is used do not use it on msvckjeremy2019-11-143-20/+22
| | | | Fixes #2233
* show unaccounted for time in profilingAleksey Kladov2019-10-241-3/+20
|
* Added test for check doc strings in crates.Alexander Andreev2019-09-302-0/+4
| | | | #1856
* :arrow_up: once_cellAleksey Kladov2019-09-011-1/+1
|
* Remove cpuprofile dependenciesAleksey Kladov2019-08-173-12/+62
|
* jemallocator 0.3Jeremy A. Kolb2019-07-172-5/+5
|
* Added extract path attribute for current moduleAlexander Andreev2019-07-061-1/+1
| | | | #1211