Showing the changes to scripts (3 of 371 files). Show all
Unified · Split
| @@ -198,10 +198,16 @@ cmd_modversions = \ · 197 unmodified lines | ||
| 198 | 198 | fi; |
| 199 | 199 | endif |
| 200 | 200 | |
| 201 | +ifdef CONFIG_64BIT | |
| 202 | +arch_bits = 64 | |
| 203 | +else | |
| 204 | +arch_bits = 32 | |
| 205 | +endif | |
| 206 | + | |
| 201 | 207 | ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| 202 | 208 | cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl \ |
| 203 | − "$(ARCH)" "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" \ | |
| 204 | − "$(MV)" "$(@)"; | |
| 209 | + "$(ARCH)" "$(arch_bits)" "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" \ | |
| 210 | + "$(NM)" "$(RM)" "$(MV)" "$(@)"; | |
| 205 | 211 | endif |
| 206 | 212 | |
| 207 | 213 | define rule_cc_o_c |
| @@ -37,7 +37,10 @@ · 36 unmodified lines | ||
| 37 | 37 | # dmesg | perl scripts/bootgraph.pl > output.svg |
| 38 | 38 | # |
| 39 | 39 | |
| 40 | −my %start, %end; | |
| 40 | +use strict; | |
| 41 | + | |
| 42 | +my %start; | |
| 43 | +my %end; | |
| 41 | 44 | my $done = 0; |
| 42 | 45 | my $maxtime = 0; |
| 43 | 46 | my $firsttime = 100; |
| @@ -105,18 +108,20 @@ my $threshold = ($maxtime - $firsttime) / 60.0; · 61 unmodified lines | ||
| 105 | 108 | my $stylecounter = 0; |
| 106 | 109 | my %rows; |
| 107 | 110 | my $rowscount = 1; |
| 108 | −while (($key,$value) = each %start) { | |
| 111 | +my @initcalls = sort { $start{$a} <=> $start{$b} } keys(%start); | |
| 112 | +my $key; | |
| 113 | +foreach $key (@initcalls) { | |
| 109 | 114 | my $duration = $end{$key} - $start{$key}; |
| 110 | 115 | |
| 111 | 116 | if ($duration >= $threshold) { |
| 112 | − my $s, $s2, $e, $y; | |
| 113 | − $pid = $pids{$key}; | |
| 117 | + my ($s, $s2, $e, $w, $y, $y2, $style); | |
| 118 | + my $pid = $pids{$key}; | |
| 114 | 119 | |
| 115 | 120 | if (!defined($rows{$pid})) { |
| 116 | 121 | $rows{$pid} = $rowscount; |
| 117 | 122 | $rowscount = $rowscount + 1; |
| 118 | 123 | } |
| 119 | − $s = ($value - $firsttime) * $mult; | |
| 124 | + $s = ($start{$key} - $firsttime) * $mult; | |
| 120 | 125 | $s2 = $s + 6; |
| 121 | 126 | $e = ($end{$key} - $firsttime) * $mult; |
| 122 | 127 | $w = $e - $s; |
| @@ -140,9 +145,9 @@ while (($key,$value) = each %start) { · 17 unmodified lines | ||
| 140 | 145 | my $time = $firsttime; |
| 141 | 146 | my $step = ($maxtime - $firsttime) / 15; |
| 142 | 147 | while ($time < $maxtime) { |
| 143 | − my $s2 = ($time - $firsttime) * $mult; | |
| 148 | + my $s3 = ($time - $firsttime) * $mult; | |
| 144 | 149 | my $tm = int($time * 100) / 100.0; |
| 145 | − print "<text transform=\"translate($s2,89) rotate(90)\">$tm</text>\n"; | |
| 150 | + print "<text transform=\"translate($s3,89) rotate(90)\">$tm</text>\n"; | |
| 146 | 151 | $time = $time + $step; |
| 147 | 152 | } |
| 148 | 153 | |
| @@ -106,7 +106,13 @@ if ($#ARGV < 6) { · 105 unmodified lines | ||
| 106 | 106 | exit(1); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | −my ($arch, $objdump, $objcopy, $cc, $ld, $nm, $rm, $mv, $inputfile) = @ARGV; | |
| 109 | +my ($arch, $bits, $objdump, $objcopy, $cc, | |
| 110 | + $ld, $nm, $rm, $mv, $inputfile) = @ARGV; | |
| 111 | + | |
| 112 | +# Acceptable sections to record. | |
| 113 | +my %text_sections = ( | |
| 114 | + ".text" => 1, | |
| 115 | +); | |
| 110 | 116 | |
| 111 | 117 | $objdump = "objdump" if ((length $objdump) == 0); |
| 112 | 118 | $objcopy = "objcopy" if ((length $objcopy) == 0); |
| @@ -129,8 +135,16 @@ my $function_regex; # Find the name of a function · 16 unmodified lines | ||
| 129 | 135 | # (return offset and func name) |
| 130 | 136 | my $mcount_regex; # Find the call site to mcount (return offset) |
| 131 | 137 | |
| 138 | +if ($arch eq "x86") { | |
| 139 | + if ($bits == 64) { | |
| 140 | + $arch = "x86_64"; | |
| 141 | + } else { | |
| 142 | + $arch = "i386"; | |
| 143 | + } | |
| 144 | +} | |
| 145 | + | |
| 132 | 146 | if ($arch eq "x86_64") { |
| 133 | − $section_regex = "Disassembly of section"; | |
| 147 | + $section_regex = "Disassembly of section\\s+(\\S+):"; | |
| 134 | 148 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
| 135 | 149 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; |
| 136 | 150 | $type = ".quad"; |
| @@ -142,7 +156,7 @@ if ($arch eq "x86_64") { · 5 unmodified lines | ||
| 142 | 156 | $cc .= " -m64"; |
| 143 | 157 | |
| 144 | 158 | } elsif ($arch eq "i386") { |
| 145 | − $section_regex = "Disassembly of section"; | |
| 159 | + $section_regex = "Disassembly of section\\s+(\\S+):"; | |
| 146 | 160 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
| 147 | 161 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; |
| 148 | 162 | $type = ".long"; |
| @@ -289,7 +303,13 @@ my $text; · 140 unmodified lines | ||
| 289 | 303 | while (<IN>) { |
| 290 | 304 | # is it a section? |
| 291 | 305 | if (/$section_regex/) { |
| 292 | − $read_function = 1; | |
| 306 | + | |
| 307 | + # Only record text sections that we know are safe | |
| 308 | + if (defined($text_sections{$1})) { | |
| 309 | + $read_function = 1; | |
| 310 | + } else { | |
| 311 | + $read_function = 0; | |
| 312 | + } | |
| 293 | 313 | # print out any recorded offsets |
| 294 | 314 | update_funcs() if ($text_found); |
| 295 | 315 | |