diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/bootgraph.pl | 46 | ||||
-rw-r--r-- | scripts/markup_oops.pl | 59 |
2 files changed, 92 insertions, 13 deletions
diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl index 0a498e33b30b..b0246307aac4 100644 --- a/scripts/bootgraph.pl +++ b/scripts/bootgraph.pl | |||
@@ -41,11 +41,13 @@ use strict; | |||
41 | 41 | ||
42 | my %start; | 42 | my %start; |
43 | my %end; | 43 | my %end; |
44 | my %type; | ||
44 | my $done = 0; | 45 | my $done = 0; |
45 | my $maxtime = 0; | 46 | my $maxtime = 0; |
46 | my $firsttime = 100; | 47 | my $firsttime = 100; |
47 | my $count = 0; | 48 | my $count = 0; |
48 | my %pids; | 49 | my %pids; |
50 | my %pidctr; | ||
49 | 51 | ||
50 | while (<>) { | 52 | while (<>) { |
51 | my $line = $_; | 53 | my $line = $_; |
@@ -53,6 +55,7 @@ while (<>) { | |||
53 | my $func = $2; | 55 | my $func = $2; |
54 | if ($done == 0) { | 56 | if ($done == 0) { |
55 | $start{$func} = $1; | 57 | $start{$func} = $1; |
58 | $type{$func} = 0; | ||
56 | if ($1 < $firsttime) { | 59 | if ($1 < $firsttime) { |
57 | $firsttime = $1; | 60 | $firsttime = $1; |
58 | } | 61 | } |
@@ -63,12 +66,40 @@ while (<>) { | |||
63 | $count = $count + 1; | 66 | $count = $count + 1; |
64 | } | 67 | } |
65 | 68 | ||
69 | if ($line =~ /([0-9\.]+)\] async_waiting @ ([0-9]+)/) { | ||
70 | my $pid = $2; | ||
71 | my $func; | ||
72 | if (!defined($pidctr{$pid})) { | ||
73 | $func = "wait_" . $pid . "_1"; | ||
74 | $pidctr{$pid} = 1; | ||
75 | } else { | ||
76 | $pidctr{$pid} = $pidctr{$pid} + 1; | ||
77 | $func = "wait_" . $pid . "_" . $pidctr{$pid}; | ||
78 | } | ||
79 | if ($done == 0) { | ||
80 | $start{$func} = $1; | ||
81 | $type{$func} = 1; | ||
82 | if ($1 < $firsttime) { | ||
83 | $firsttime = $1; | ||
84 | } | ||
85 | } | ||
86 | $pids{$func} = $pid; | ||
87 | $count = $count + 1; | ||
88 | } | ||
89 | |||
66 | if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_]+)\+.*returned/) { | 90 | if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_]+)\+.*returned/) { |
67 | if ($done == 0) { | 91 | if ($done == 0) { |
68 | $end{$2} = $1; | 92 | $end{$2} = $1; |
69 | $maxtime = $1; | 93 | $maxtime = $1; |
70 | } | 94 | } |
71 | } | 95 | } |
96 | |||
97 | if ($line =~ /([0-9\.]+)\] async_continuing @ ([0-9]+)/) { | ||
98 | my $pid = $2; | ||
99 | my $func = "wait_" . $pid . "_" . $pidctr{$pid}; | ||
100 | $end{$func} = $1; | ||
101 | $maxtime = $1; | ||
102 | } | ||
72 | if ($line =~ /Write protecting the/) { | 103 | if ($line =~ /Write protecting the/) { |
73 | $done = 1; | 104 | $done = 1; |
74 | } | 105 | } |
@@ -105,6 +136,8 @@ $styles[9] = "fill:rgb(255,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0 | |||
105 | $styles[10] = "fill:rgb(255,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | 136 | $styles[10] = "fill:rgb(255,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; |
106 | $styles[11] = "fill:rgb(128,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | 137 | $styles[11] = "fill:rgb(128,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; |
107 | 138 | ||
139 | my $style_wait = "fill:rgb(128,128,128);fill-opacity:0.5;stroke-width:0;stroke:rgb(0,0,0)"; | ||
140 | |||
108 | my $mult = 1950.0 / ($maxtime - $firsttime); | 141 | my $mult = 1950.0 / ($maxtime - $firsttime); |
109 | my $threshold2 = ($maxtime - $firsttime) / 120.0; | 142 | my $threshold2 = ($maxtime - $firsttime) / 120.0; |
110 | my $threshold = $threshold2/10; | 143 | my $threshold = $threshold2/10; |
@@ -139,11 +172,16 @@ foreach my $key (@initcalls) { | |||
139 | $stylecounter = 0; | 172 | $stylecounter = 0; |
140 | }; | 173 | }; |
141 | 174 | ||
142 | print "<rect x=\"$s\" width=\"$w\" y=\"$y\" height=\"145\" style=\"$style\"/>\n"; | 175 | if ($type{$key} == 1) { |
143 | if ($duration >= $threshold2) { | 176 | $y = $y + 15; |
144 | print "<text transform=\"translate($s2,$y2) rotate(90)\">$key</text>\n"; | 177 | print "<rect x=\"$s\" width=\"$w\" y=\"$y\" height=\"115\" style=\"$style_wait\"/>\n"; |
145 | } else { | 178 | } else { |
146 | print "<text transform=\"translate($s3,$y2) rotate(90)\" font-size=\"3pt\">$key</text>\n"; | 179 | print "<rect x=\"$s\" width=\"$w\" y=\"$y\" height=\"145\" style=\"$style\"/>\n"; |
180 | if ($duration >= $threshold2) { | ||
181 | print "<text transform=\"translate($s2,$y2) rotate(90)\">$key</text>\n"; | ||
182 | } else { | ||
183 | print "<text transform=\"translate($s3,$y2) rotate(90)\" font-size=\"3pt\">$key</text>\n"; | ||
184 | } | ||
147 | } | 185 | } |
148 | } | 186 | } |
149 | } | 187 | } |
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index 700a7a654a3f..d40449cafa84 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl | |||
@@ -1,5 +1,7 @@ | |||
1 | #!/usr/bin/perl -w | 1 | #!/usr/bin/perl -w |
2 | 2 | ||
3 | use File::Basename; | ||
4 | |||
3 | # Copyright 2008, Intel Corporation | 5 | # Copyright 2008, Intel Corporation |
4 | # | 6 | # |
5 | # This file is part of the Linux kernel | 7 | # This file is part of the Linux kernel |
@@ -13,23 +15,41 @@ | |||
13 | 15 | ||
14 | 16 | ||
15 | my $vmlinux_name = $ARGV[0]; | 17 | my $vmlinux_name = $ARGV[0]; |
16 | 18 | if (!defined($vmlinux_name)) { | |
19 | my $kerver = `uname -r`; | ||
20 | chomp($kerver); | ||
21 | $vmlinux_name = "/lib/modules/$kerver/build/vmlinux"; | ||
22 | print "No vmlinux specified, assuming $vmlinux_name\n"; | ||
23 | } | ||
24 | my $filename = $vmlinux_name; | ||
17 | # | 25 | # |
18 | # Step 1: Parse the oops to find the EIP value | 26 | # Step 1: Parse the oops to find the EIP value |
19 | # | 27 | # |
20 | 28 | ||
21 | my $target = "0"; | 29 | my $target = "0"; |
30 | my $function; | ||
31 | my $module = ""; | ||
32 | my $func_offset; | ||
33 | my $vmaoffset = 0; | ||
34 | |||
22 | while (<STDIN>) { | 35 | while (<STDIN>) { |
23 | if ($_ =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) { | 36 | my $line = $_; |
37 | if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) { | ||
24 | $target = $1; | 38 | $target = $1; |
25 | } | 39 | } |
26 | } | 40 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { |
41 | $function = $1; | ||
42 | $func_offset = $2; | ||
43 | } | ||
27 | 44 | ||
28 | if ($target =~ /^f8/) { | 45 | # check if it's a module |
29 | print "This script does not work on modules ... \n"; | 46 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { |
30 | exit; | 47 | $module = $3; |
48 | } | ||
31 | } | 49 | } |
32 | 50 | ||
51 | my $decodestart = hex($target) - hex($func_offset); | ||
52 | my $decodestop = $decodestart + 8192; | ||
33 | if ($target eq "0") { | 53 | if ($target eq "0") { |
34 | print "No oops found!\n"; | 54 | print "No oops found!\n"; |
35 | print "Usage: \n"; | 55 | print "Usage: \n"; |
@@ -37,6 +57,29 @@ if ($target eq "0") { | |||
37 | exit; | 57 | exit; |
38 | } | 58 | } |
39 | 59 | ||
60 | # if it's a module, we need to find the .ko file and calculate a load offset | ||
61 | if ($module ne "") { | ||
62 | my $dir = dirname($filename); | ||
63 | $dir = $dir . "/"; | ||
64 | my $mod = $module . ".ko"; | ||
65 | my $modulefile = `find $dir -name $mod | head -1`; | ||
66 | chomp($modulefile); | ||
67 | $filename = $modulefile; | ||
68 | if ($filename eq "") { | ||
69 | print "Module .ko file for $module not found. Aborting\n"; | ||
70 | exit; | ||
71 | } | ||
72 | # ok so we found the module, now we need to calculate the vma offset | ||
73 | open(FILE, "objdump -dS $filename |") || die "Cannot start objdump"; | ||
74 | while (<FILE>) { | ||
75 | if ($_ =~ /^([0-9a-f]+) \<$function\>\:/) { | ||
76 | my $fu = $1; | ||
77 | $vmaoffset = hex($target) - hex($fu) - hex($func_offset); | ||
78 | } | ||
79 | } | ||
80 | close(FILE); | ||
81 | } | ||
82 | |||
40 | my $counter = 0; | 83 | my $counter = 0; |
41 | my $state = 0; | 84 | my $state = 0; |
42 | my $center = 0; | 85 | my $center = 0; |
@@ -59,9 +102,7 @@ sub InRange { | |||
59 | # first, parse the input into the lines array, but to keep size down, | 102 | # first, parse the input into the lines array, but to keep size down, |
60 | # we only do this for 4Kb around the sweet spot | 103 | # we only do this for 4Kb around the sweet spot |
61 | 104 | ||
62 | my $filename; | 105 | open(FILE, "objdump -dS --adjust-vma=$vmaoffset --start-address=$decodestart --stop-address=$decodestop $filename |") || die "Cannot start objdump"; |
63 | |||
64 | open(FILE, "objdump -dS $vmlinux_name |") || die "Cannot start objdump"; | ||
65 | 106 | ||
66 | while (<FILE>) { | 107 | while (<FILE>) { |
67 | my $line = $_; | 108 | my $line = $_; |