Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add --encoding option to flamegraph.pl #26

Merged
merged 1 commit into from

2 participants

@agentzh

The SVG output did not take an encoding attribute which could
make the displayer fail to load the XML file when the input
backtrace data contains special byte sequences.

@agentzh agentzh Add --encoding option to flamegraph.pl
The SVG output did not take an encoding attribute which could
make the displayer fail to load the XML file when the input
backtrace data contains special byte sequences.
eb471ab
@brendangregg
Owner

thanks!

@brendangregg brendangregg merged commit 354cdc8 into brendangregg:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 31, 2013
  1. @agentzh

    Add --encoding option to flamegraph.pl

    agentzh authored
    The SVG output did not take an encoding attribute which could
    make the displayer fail to load the XML file when the input
    backtrace data contains special byte sequences.
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +7 −1 flamegraph.pl
View
8 flamegraph.pl
@@ -70,6 +70,7 @@
use Getopt::Long;
# tunables
+my $encoding;
my $fonttype = "Verdana";
my $imagewidth = 1200; # max width, pixels
my $frameheight = 16; # max height is dynamic
@@ -94,6 +95,7 @@
'fonttype=s' => \$fonttype,
'width=i' => \$imagewidth,
'height=i' => \$frameheight,
+ 'encoding=s' => \$encoding,
'fontsize=f' => \$fontsize,
'fontwidth=f' => \$fontwidth,
'minwidth=f' => \$minwidth,
@@ -158,8 +160,12 @@
sub header {
my ($self, $w, $h) = @_;
+ my $enc_attr = '';
+ if (defined $encoding) {
+ $enc_attr = qq{ encoding="$encoding"};
+ }
$self->{svg} .= <<SVG;
-<?xml version="1.0" standalone="no"?>
+<?xml version="1.0"$enc_attr standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" width="$w" height="$h" onload="init(evt)" viewBox="0 0 $w $h" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
SVG
Something went wrong with that request. Please try again.