Skip to content

Commit

Permalink
scripts/bootgraph.pl: Add graphic header
Browse files Browse the repository at this point in the history
Adding -header + help function like other .pl in /scripts.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Michal Marek <mmarek@suse.cz>
  • Loading branch information
Fabian Frederick authored and Michal Marek committed Apr 8, 2014
1 parent 79192ca commit 67554fa
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions scripts/bootgraph.pl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,31 @@
#

use strict;
use Getopt::Long;
my $header = 0;

sub help {
my $text = << "EOM";
Usage:
1) dmesg | perl scripts/bootgraph.pl [OPTION] > output.svg
2) perl scripts/bootgraph.pl -h
Options:
-header Insert kernel version and date
EOM
my $std=shift;
if ($std == 1) {
print STDERR $text;
} else {
print $text;
}
exit;
}

GetOptions(
'h|help' =>\&help,
'header' =>\$header
);

my %start;
my %end;
Expand All @@ -49,6 +74,11 @@
my %pids;
my %pidctr;

my $headerstep = 20;
my $xheader = 15;
my $yheader = 25;
my $cyheader = 0;

while (<>) {
my $line = $_;
if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_\.]+)\+/) {
Expand Down Expand Up @@ -112,15 +142,23 @@
print STDERR <<END;
No data found in the dmesg. Make sure that 'printk.time=1' and
'initcall_debug' are passed on the kernel command line.
Usage:
dmesg | perl scripts/bootgraph.pl > output.svg
END
help(1);
exit 1;
}

print "<?xml version=\"1.0\" standalone=\"no\"?> \n";
print "<svg width=\"2000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n";


if ($header) {
my $version = `uname -a`;
my $date = `date`;
print "<text transform=\"translate($xheader,$yheader)\">Kernel version: $version</text>\n";
$cyheader = $yheader+$headerstep;
print "<text transform=\"translate($xheader,$cyheader)\">Date: $date</text>\n";
}

my @styles;

$styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
Expand Down

0 comments on commit 67554fa

Please sign in to comment.