1
1
mirror of https://github.com/wez/wezterm.git synced 2025-01-03 11:11:43 +03:00

Add support for heap profiling using dhat

refs: https://github.com/wez/wezterm/issues/2626
This commit is contained in:
Wez Furlong 2022-11-14 13:26:02 -07:00
parent 831eda86b9
commit 173e27d2e8
No known key found for this signature in database
4 changed files with 54 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.DS_Store
dhat-heap.json
/docs/_site
/PKGBUILD
/WezTerm*.zip

43
Cargo.lock generated
View File

@ -1081,6 +1081,22 @@ dependencies = [
"syn",
]
[[package]]
name = "dhat"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f2aaf837aaf456f6706cb46386ba8dffd4013a757e36f4ea05c20dd46b209a3"
dependencies = [
"backtrace",
"lazy_static",
"mintex",
"parking_lot 0.12.1",
"rustc-hash",
"serde",
"serde_json",
"thousands",
]
[[package]]
name = "diff"
version = "0.1.13"
@ -2639,6 +2655,16 @@ dependencies = [
"adler",
]
[[package]]
name = "mintex"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd7c5ba1c3b5a23418d7bbf98c71c3d4946a0125002129231da8d6b723d559cb"
dependencies = [
"once_cell",
"sys-info",
]
[[package]]
name = "mio"
version = "0.8.5"
@ -4583,6 +4609,16 @@ dependencies = [
"yaml-rust",
]
[[package]]
name = "sys-info"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b3a0d0aba8bf96a0e1ddfdc352fc53b3df7f39318c71854910c3c4b024ae52c"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "tabout"
version = "0.3.0"
@ -4778,6 +4814,12 @@ dependencies = [
"syn",
]
[[package]]
name = "thousands"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820"
[[package]]
name = "thread_local"
version = "1.1.4"
@ -5576,6 +5618,7 @@ dependencies = [
"codec",
"colorgrad",
"config",
"dhat",
"dirs-next",
"downcast-rs",
"embed-resource",

View File

@ -22,6 +22,8 @@ vendored-fonts = [
"vendor-roboto-font",
"vendor-noto-emoji-font"
]
dhat-heap = ["dhat"] # if you are doing heap profiling
dhat-ad-hoc = ["dhat"] # if you are doing ad hoc profiling
[build-dependencies]
anyhow = "1.0"
@ -39,6 +41,7 @@ codec = { path = "../codec" }
colorgrad = "0.6"
config = { path = "../config" }
downcast-rs = "1.0"
dhat = {version="0.3", optional=true}
dirs-next = "2.0"
emojis = "0.5"
env-bootstrap = { path = "../env-bootstrap" }

View File

@ -51,6 +51,10 @@ mod uniforms;
mod update;
mod utilsprites;
#[cfg(feature = "dhat-heap")]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;
pub use selection::SelectionMode;
pub use termwindow::{set_window_class, set_window_position, TermWindow, ICON_DATA};
@ -755,6 +759,9 @@ fn terminate_with_error(err: anyhow::Error) -> ! {
}
fn main() {
#[cfg(feature = "dhat-heap")]
let _profiler = dhat::Profiler::new_heap();
config::designate_this_as_the_main_thread();
config::assign_error_callback(mux::connui::show_configuration_error_message);
notify_on_panic();