-
-
Save tizoc/7f77f32ebf536aed181bcd6a0bc430cb to your computer and use it in GitHub Desktop.
Revisions
-
KodrAus revised this gist
May 26, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,8 @@ $ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.sv This requires you have [flamegraph](https://github.com/brendangregg/FlameGraph) available in your path. The [`rust-unmangle`](https://github.com/Yamakaky/rust-unmangle/blob/master/rust-unmangle) script is optional but nice. Also check out @dlaehnemann's more detailed walkthrough about generating flamegraphs [here](https://gist.github.com/dlaehnemann/df31787c41bd50c0fe223df07cf6eb89). # Profiling heap memory Using [valgrind (massif)](http://valgrind.org/docs/manual/ms-manual.html) and [massif-visualiser](https://github.com/KDE/massif-visualizer): -
KodrAus revised this gist
May 26, 2019 . 1 changed file with 2 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,8 @@ $ perf record -g binary $ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg ``` > NOTE: See [@GabrielMajeri's comments below](https://gist.github.com/KodrAus/97c92c07a90b1fdd6853654357fd557a#gistcomment-2694776) about the `-g` option. This requires you have [flamegraph](https://github.com/brendangregg/FlameGraph) available in your path. The [`rust-unmangle`](https://github.com/Yamakaky/rust-unmangle/blob/master/rust-unmangle) script is optional but nice. # Profiling heap memory @@ -23,21 +25,6 @@ Also check out [heaptrack](https://github.com/KDE/heaptrack), it's similar to `m $ heaptrack binary ``` # Debugging ``` -
KodrAus revised this gist
Jun 25, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,7 @@ $ heaptrack binary Note that you have to use the system allocator: ```rust #![feature(alloc_system)] extern crate alloc_system; -
KodrAus revised this gist
Oct 30, 2017 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,8 +26,14 @@ $ heaptrack binary Note that you have to use the system allocator: ```rust #![feature(alloc_system, global_allocator, allocator_api)] extern crate alloc_system; use alloc_system::System; #[global_allocator] static A: System = System; ``` If you don't use it you'll get totally inaccurate results that show no heap usage. -
KodrAus revised this gist
Jun 9, 2017 . 1 changed file with 11 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,28 @@ # Profiling performance Using [perf](https://perf.wiki.kernel.org/index.php/Main_Page): ``` $ perf record -g binary $ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg ``` This requires you have [flamegraph](https://github.com/brendangregg/FlameGraph) available in your path. The [`rust-unmangle`](https://github.com/Yamakaky/rust-unmangle/blob/master/rust-unmangle) script is optional but nice. # Profiling heap memory Using [valgrind (massif)](http://valgrind.org/docs/manual/ms-manual.html) and [massif-visualiser](https://github.com/KDE/massif-visualizer): ``` $ valgrind --tool=massif binary ``` Also check out [heaptrack](https://github.com/KDE/heaptrack), it's similar to `massif` but more useful out-of-the-box. It also has a nice gui experience: ``` $ heaptrack binary ``` Note that you have to use the system allocator: ```rust -
KodrAus renamed this gist
Mar 2, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ This requires you have [flamegraph](https://github.com/brendangregg/FlameGraph) $ valgrind --tool=massif binary ``` Note that you have to use the system allocator: ```rust #![feature(alloc_system)] @@ -28,7 +28,7 @@ If you don't use it you'll get totally inaccurate results that show no heap usag $ rust-gdb binary ``` Namespaces are prefixed by the crate name, which is probably also the name of the binary. You can do stuff like: - `break` to set breakpoints - `print` to print a variable -
KodrAus revised this gist
Feb 5, 2017 . 1 changed file with 15 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ This requires you have [flamegraph](https://github.com/brendangregg/FlameGraph) # Profiling heap memory ``` $ valgrind --tool=massif binary ``` Note that Rust/valgrind has previously had issues with the `jemalloc` allocator so you'd have to use the system allocator: @@ -22,9 +22,22 @@ extern crate alloc_system; If you don't use it you'll get totally inaccurate results that show no heap usage. # Debugging ``` $ rust-gdb binary ``` Namespaces are prefixed by the crate name, which is probably also the name of the binary. Yuo can do stuff like: - `break` to set breakpoints - `print` to print a variable - `step`,`next`,`finish` to step through calls # Links - http://blog.adamperry.me/rust/2016/07/24/profiling-rust-perf-flamegraph/ - https://llogiq.github.io/2015/07/15/profiling.html - https://www.linux-apps.com/content/show.php?content=122409 - https://github.com/brendangregg/FlameGraph - https://betterexplained.com/articles/debugging-with-gdb/ -
KodrAus revised this gist
Feb 5, 2017 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,4 +20,11 @@ Note that Rust/valgrind has previously had issues with the `jemalloc` allocator extern crate alloc_system; ``` If you don't use it you'll get totally inaccurate results that show no heap usage. # Links - http://blog.adamperry.me/rust/2016/07/24/profiling-rust-perf-flamegraph/ - https://llogiq.github.io/2015/07/15/profiling.html - https://www.linux-apps.com/content/show.php?content=122409 - https://github.com/brendangregg/FlameGraph -
KodrAus created this gist
Feb 4, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ # Profiling performance ``` $ perf record -g binary $ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg ``` This requires you have [flamegraph](https://github.com/brendangregg/FlameGraph) available in your path. The `rust-unmange` script is optional but nice. # Profiling heap memory ``` $ valgrind --tool=massif ``` Note that Rust/valgrind has previously had issues with the `jemalloc` allocator so you'd have to use the system allocator: ```rust #![feature(alloc_system)] extern crate alloc_system; ``` If you don't use it you'll get totally inaccurate results that show no heap usage.