diff options
| author | Mason Reed <mason@vector35.com> | 2024-10-23 20:47:31 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2024-10-24 17:03:11 -0400 |
| commit | e151425087b6c0ee8c4d099bfc2d6d1268201db0 (patch) | |
| tree | 25160cf81aa6d650cf1497a078acc50f0062757c /rust/src | |
| parent | 0f53c21d6a7abbfd48fd59ec7c15586f02777b7e (diff) | |
Add WARP integration
https://github.com/Vector35/warp/
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/lib.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 068aa8c3..0c1022c0 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -173,6 +173,8 @@ pub mod types; pub mod update; pub mod workflow; +use std::collections::HashMap; +use std::ffi::CStr; use std::path::PathBuf; use std::ptr; @@ -596,6 +598,21 @@ pub fn path_relative_to_user_directory<S: string::BnStrCompatible>(path: S) -> R )) } +pub fn memory_info() -> HashMap<String, u64> { + let mut count = 0; + let mut usage = HashMap::new(); + unsafe { + let info_ptr = binaryninjacore_sys::BNGetMemoryUsageInfo(&mut count); + let info_list = std::slice::from_raw_parts(info_ptr, count); + for info in info_list { + let info_name = CStr::from_ptr(info.name).to_str().unwrap().to_string(); + usage.insert(info_name, info.value); + } + binaryninjacore_sys::BNFreeMemoryUsageInfo(info_ptr, count); + } + usage +} + pub fn version() -> string::BnString { unsafe { string::BnString::from_raw(binaryninjacore_sys::BNGetVersionString()) } } |
