Skip to content

Commit

Permalink
Support stack traces from AsyncProfiler (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnderEnder authored Jun 29, 2020
1 parent 1aa64a2 commit 432d653
Show file tree
Hide file tree
Showing 5 changed files with 1,295 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Support kernel annotations for versioned vmlinux and kernel modules in collapse-perf. [#182](https://github.com/jonhoo/inferno/pull/182)
- Support of AsyncProfiler generated stack trace in java palette. [#183](https://github.com/jonhoo/inferno/pull/183)

### Changed

Expand Down
52 changes: 39 additions & 13 deletions src/flamegraph/color/palettes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,18 @@ pub(super) mod java {
name
};

if java_prefix.starts_with("java/")
|| java_prefix.starts_with("javax/")
|| java_prefix.starts_with("jdk/")
|| java_prefix.starts_with("net/")
|| java_prefix.starts_with("org/")
|| java_prefix.starts_with("com/")
|| java_prefix.starts_with("io/")
|| java_prefix.starts_with("sun/")
if name.contains("::") || name.starts_with("-[") || name.starts_with("+[") {
// C++ or Objective C
BasicPalette::Yellow
} else if java_prefix.contains("/")
|| (java_prefix.contains(".") && !java_prefix.starts_with("["))
|| match java_prefix.chars().next() {
Some(c) => c.is_ascii_uppercase(),
_ => false,
}
{
// Java
BasicPalette::Green
} else if name.contains("::") {
// C++
BasicPalette::Yellow
} else {
// system
BasicPalette::Red
Expand Down Expand Up @@ -269,11 +267,11 @@ mod tests {
},
TestData {
input: String::from("jdk/::[ki]"),
output: BasicPalette::Green,
output: BasicPalette::Yellow,
},
TestData {
input: String::from("Ajdk/_[ki]"),
output: BasicPalette::Red,
output: BasicPalette::Green,
},
TestData {
input: String::from("Ajdk/::[ki]"),
Expand Down Expand Up @@ -319,6 +317,34 @@ mod tests {
input: String::from("some:thing"),
output: BasicPalette::Red,
},
TestData {
input: String::from("scala.tools.nsc.Global$Run.compile"),
output: BasicPalette::Green,
},
TestData {
input: String::from("sbt.execute.work"),
output: BasicPalette::Green,
},
TestData {
input: String::from("org.scalatest.Suit.run"),
output: BasicPalette::Green,
},
TestData {
input: String::from("Compile"),
output: BasicPalette::Green,
},
TestData {
input: String::from("-[test]"),
output: BasicPalette::Yellow,
},
TestData {
input: String::from("+[test]"),
output: BasicPalette::Yellow,
},
TestData {
input: String::from("[test.event]"),
output: BasicPalette::Red,
},
];

for item in test_names.iter() {
Expand Down
Loading

0 comments on commit 432d653

Please sign in to comment.