-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support vtune profiling of trampolines too (#3687)
* Provide helpers for demangling function names * Profile trampolines in vtune too * get rid of mapping * avoid code duplication with jitdump_linux * maintain previous default display name for wasm functions * no dash, grrr * Remove unused profiling error type
- Loading branch information
Showing
13 changed files
with
191 additions
and
141 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! Helpers for demangling function names. | ||
/// Demangles a single function name into a user-readable form. | ||
/// | ||
/// Currently supported: Rust/C/C++ function names. | ||
pub fn demangle_function_name(writer: &mut impl std::fmt::Write, name: &str) -> std::fmt::Result { | ||
if let Ok(demangled) = rustc_demangle::try_demangle(name) { | ||
write!(writer, "{}", demangled) | ||
} else if let Ok(demangled) = cpp_demangle::Symbol::new(name) { | ||
write!(writer, "{}", demangled) | ||
} else { | ||
write!(writer, "{}", name) | ||
} | ||
} | ||
|
||
/// Demangles a function name if it's provided, or returns a unified representation based on the | ||
/// function index otherwise. | ||
pub fn demangle_function_name_or_index( | ||
writer: &mut impl std::fmt::Write, | ||
name: Option<&str>, | ||
func_id: usize, | ||
) -> std::fmt::Result { | ||
match name { | ||
Some(name) => demangle_function_name(writer, name), | ||
None => write!(writer, "<wasm function {}>", func_id), | ||
} | ||
} |
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Oops, something went wrong.