commit df6c5c31d9daf3102289caeeccd3be9c595c1a5d
parent bf11320bbafbf41ca0328552f44cc4bd4ae44075
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date: Thu, 4 Dec 2014 16:29:38 -0800
color=js for JavaScript
Diffstat:
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/flamegraph.pl b/flamegraph.pl
@@ -133,7 +133,7 @@ USAGE: $0 [options] infile > outfile.svg\n
--countname # count type label (default "samples")
--nametype # name type label (default "Function:")
--colors # set color palette. choices are: hot (default), mem, io,
- # java, red, green, blue, yellow, purple, orange
+ # java, js, red, green, blue, yellow, purple, orange
--hash # colors are keyed by function name hash
--cp # use consistent palette (palette.map)
--reverse # generate stack-reversed flame graph
@@ -326,6 +326,20 @@ sub color {
}
# fall-through to color palettes
}
+ if (defined $type and $type eq "js") {
+ if ($name =~ /::/) { # C++
+ $type = "yellow";
+ } elsif ($name =~ m:/:) { # JavaScript (match "/" in path)
+ $type = "green"
+ } elsif ($name =~ m/:/) { # JavaScript (match ":" in builtin)
+ $type = "aqua"
+ } elsif ($name =~ m/^ *$/) { # Missing symbol
+ $type = "green"
+ } else { # system
+ $type = "red";
+ }
+ # fall-through to color palettes
+ }
# color palettes
if (defined $type and $type eq "red") {
@@ -353,6 +367,12 @@ sub color {
my $g = 80 + int(60 * $v1);
return "rgb($x,$g,$x)";
}
+ if (defined $type and $type eq "aqua") {
+ my $r = 50 + int(60 * $v1);
+ my $g = 165 + int(55 * $v1);
+ my $b = 165 + int(55 * $v1);
+ return "rgb($r,$g,$b)";
+ }
if (defined $type and $type eq "orange") {
my $r = 190 + int(65 * $v1);
my $g = 90 + int(65 * $v1);