aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2014-04-02 15:39:52 -0400
committerMichal Marek <mmarek@suse.cz>2014-04-08 11:15:15 -0400
commit67554faa7614b93722ed559fc3f914b86bf606ae (patch)
treed3c1e6fbea010f087ce5fa4fc105caf310bced34 /scripts
parent79192ca8ebd9a25c583aa46024a250fef1e7766f (diff)
scripts/bootgraph.pl: Add graphic header
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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/bootgraph.pl42
1 files changed, 40 insertions, 2 deletions
diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl
index b78fca994a15..9ca667bcaee9 100644
--- a/scripts/bootgraph.pl
+++ b/scripts/bootgraph.pl
@@ -38,6 +38,31 @@
38# 38#
39 39
40use strict; 40use strict;
41use Getopt::Long;
42my $header = 0;
43
44sub help {
45 my $text = << "EOM";
46Usage:
471) dmesg | perl scripts/bootgraph.pl [OPTION] > output.svg
482) perl scripts/bootgraph.pl -h
49
50Options:
51 -header Insert kernel version and date
52EOM
53 my $std=shift;
54 if ($std == 1) {
55 print STDERR $text;
56 } else {
57 print $text;
58 }
59 exit;
60}
61
62GetOptions(
63 'h|help' =>\&help,
64 'header' =>\$header
65);
41 66
42my %start; 67my %start;
43my %end; 68my %end;
@@ -49,6 +74,11 @@ my $count = 0;
49my %pids; 74my %pids;
50my %pidctr; 75my %pidctr;
51 76
77my $headerstep = 20;
78my $xheader = 15;
79my $yheader = 25;
80my $cyheader = 0;
81
52while (<>) { 82while (<>) {
53 my $line = $_; 83 my $line = $_;
54 if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_\.]+)\+/) { 84 if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_\.]+)\+/) {
@@ -112,15 +142,23 @@ if ($count == 0) {
112 print STDERR <<END; 142 print STDERR <<END;
113No data found in the dmesg. Make sure that 'printk.time=1' and 143No data found in the dmesg. Make sure that 'printk.time=1' and
114'initcall_debug' are passed on the kernel command line. 144'initcall_debug' are passed on the kernel command line.
115Usage:
116 dmesg | perl scripts/bootgraph.pl > output.svg
117END 145END
146 help(1);
118 exit 1; 147 exit 1;
119} 148}
120 149
121print "<?xml version=\"1.0\" standalone=\"no\"?> \n"; 150print "<?xml version=\"1.0\" standalone=\"no\"?> \n";
122print "<svg width=\"2000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n"; 151print "<svg width=\"2000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n";
123 152
153
154if ($header) {
155 my $version = `uname -a`;
156 my $date = `date`;
157 print "<text transform=\"translate($xheader,$yheader)\">Kernel version: $version</text>\n";
158 $cyheader = $yheader+$headerstep;
159 print "<text transform=\"translate($xheader,$cyheader)\">Date: $date</text>\n";
160}
161
124my @styles; 162my @styles;
125 163
126$styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; 164$styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";