diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-30 19:38:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-30 19:38:21 -0400 |
commit | e1e302d8a9ab06ba8d7d5ec503d8996e6cf0eca4 (patch) | |
tree | 6a6c805fdfd6a2f6433956cbee348b2c3a277784 /scripts | |
parent | 944ac4259e39801c843a915c3da8194ac9af0440 (diff) | |
parent | 7f82f000ed030d1108b4de47d9e2d556092980c6 (diff) |
Merge branch 'linus' into tracing/ftrace
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.build | 10 | ||||
-rw-r--r-- | scripts/bootgraph.pl | 19 | ||||
-rwxr-xr-x | scripts/recordmcount.pl | 28 |
3 files changed, 44 insertions, 13 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 5ed4cbf1e0e1..468fbc9016c7 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -198,10 +198,16 @@ cmd_modversions = \ | |||
198 | fi; | 198 | fi; |
199 | endif | 199 | endif |
200 | 200 | ||
201 | ifdef CONFIG_64BIT | ||
202 | arch_bits = 64 | ||
203 | else | ||
204 | arch_bits = 32 | ||
205 | endif | ||
206 | |||
201 | ifdef CONFIG_FTRACE_MCOUNT_RECORD | 207 | ifdef CONFIG_FTRACE_MCOUNT_RECORD |
202 | cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl \ | 208 | cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl \ |
203 | "$(ARCH)" "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" \ | 209 | "$(ARCH)" "$(arch_bits)" "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" \ |
204 | "$(MV)" "$(@)"; | 210 | "$(NM)" "$(RM)" "$(MV)" "$(@)"; |
205 | endif | 211 | endif |
206 | 212 | ||
207 | define rule_cc_o_c | 213 | define rule_cc_o_c |
diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl index 5e7316e5aa39..d2c61efc216f 100644 --- a/scripts/bootgraph.pl +++ b/scripts/bootgraph.pl | |||
@@ -37,7 +37,10 @@ | |||
37 | # dmesg | perl scripts/bootgraph.pl > output.svg | 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 | my $done = 0; | 44 | my $done = 0; |
42 | my $maxtime = 0; | 45 | my $maxtime = 0; |
43 | my $firsttime = 100; | 46 | my $firsttime = 100; |
@@ -105,18 +108,20 @@ my $threshold = ($maxtime - $firsttime) / 60.0; | |||
105 | my $stylecounter = 0; | 108 | my $stylecounter = 0; |
106 | my %rows; | 109 | my %rows; |
107 | my $rowscount = 1; | 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 | my $duration = $end{$key} - $start{$key}; | 114 | my $duration = $end{$key} - $start{$key}; |
110 | 115 | ||
111 | if ($duration >= $threshold) { | 116 | if ($duration >= $threshold) { |
112 | my $s, $s2, $e, $y; | 117 | my ($s, $s2, $e, $w, $y, $y2, $style); |
113 | $pid = $pids{$key}; | 118 | my $pid = $pids{$key}; |
114 | 119 | ||
115 | if (!defined($rows{$pid})) { | 120 | if (!defined($rows{$pid})) { |
116 | $rows{$pid} = $rowscount; | 121 | $rows{$pid} = $rowscount; |
117 | $rowscount = $rowscount + 1; | 122 | $rowscount = $rowscount + 1; |
118 | } | 123 | } |
119 | $s = ($value - $firsttime) * $mult; | 124 | $s = ($start{$key} - $firsttime) * $mult; |
120 | $s2 = $s + 6; | 125 | $s2 = $s + 6; |
121 | $e = ($end{$key} - $firsttime) * $mult; | 126 | $e = ($end{$key} - $firsttime) * $mult; |
122 | $w = $e - $s; | 127 | $w = $e - $s; |
@@ -140,9 +145,9 @@ while (($key,$value) = each %start) { | |||
140 | my $time = $firsttime; | 145 | my $time = $firsttime; |
141 | my $step = ($maxtime - $firsttime) / 15; | 146 | my $step = ($maxtime - $firsttime) / 15; |
142 | while ($time < $maxtime) { | 147 | while ($time < $maxtime) { |
143 | my $s2 = ($time - $firsttime) * $mult; | 148 | my $s3 = ($time - $firsttime) * $mult; |
144 | my $tm = int($time * 100) / 100.0; | 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 | $time = $time + $step; | 151 | $time = $time + $step; |
147 | } | 152 | } |
148 | 153 | ||
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index f56d760bd589..6b9fe3eb8360 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -106,7 +106,13 @@ if ($#ARGV < 6) { | |||
106 | exit(1); | 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 | $objdump = "objdump" if ((length $objdump) == 0); | 117 | $objdump = "objdump" if ((length $objdump) == 0); |
112 | $objcopy = "objcopy" if ((length $objcopy) == 0); | 118 | $objcopy = "objcopy" if ((length $objcopy) == 0); |
@@ -129,8 +135,16 @@ my $function_regex; # Find the name of a function | |||
129 | # (return offset and func name) | 135 | # (return offset and func name) |
130 | my $mcount_regex; # Find the call site to mcount (return offset) | 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 | if ($arch eq "x86_64") { | 146 | if ($arch eq "x86_64") { |
133 | $section_regex = "Disassembly of section"; | 147 | $section_regex = "Disassembly of section\\s+(\\S+):"; |
134 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; | 148 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
135 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; | 149 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; |
136 | $type = ".quad"; | 150 | $type = ".quad"; |
@@ -142,7 +156,7 @@ if ($arch eq "x86_64") { | |||
142 | $cc .= " -m64"; | 156 | $cc .= " -m64"; |
143 | 157 | ||
144 | } elsif ($arch eq "i386") { | 158 | } elsif ($arch eq "i386") { |
145 | $section_regex = "Disassembly of section"; | 159 | $section_regex = "Disassembly of section\\s+(\\S+):"; |
146 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; | 160 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
147 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; | 161 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; |
148 | $type = ".long"; | 162 | $type = ".long"; |
@@ -289,7 +303,13 @@ my $text; | |||
289 | while (<IN>) { | 303 | while (<IN>) { |
290 | # is it a section? | 304 | # is it a section? |
291 | if (/$section_regex/) { | 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 | # print out any recorded offsets | 313 | # print out any recorded offsets |
294 | update_funcs() if ($text_found); | 314 | update_funcs() if ($text_found); |
295 | 315 | ||