Commit dc4f8845ee2ca39fe054a2d911729ffd269b4b66
Committed by
Steven Rostedt
1 parent
7e53bd42d1
Exists in
master
and in
4 other branches
tracing: optimize recordmcount.pl for offsets-handling
- move check for open file in front of the writing loop - use perl-constructs to access the array Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> LKML-Reference: <1262716072-14414-2-git-send-email-w.sang@pengutronix.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Showing 1 changed file with 9 additions and 9 deletions Side-by-side Diff
scripts/recordmcount.pl
... | ... | @@ -432,15 +432,15 @@ |
432 | 432 | |
433 | 433 | # Loop through all the mcount caller offsets and print a reference |
434 | 434 | # to the caller based from the ref_func. |
435 | - for (my $i=0; $i <= $#offsets; $i++) { | |
436 | - if (!$opened) { | |
437 | - open(FILE, ">$mcount_s") || die "can't create $mcount_s\n"; | |
438 | - $opened = 1; | |
439 | - print FILE "\t.section $mcount_section,\"a\",$section_type\n"; | |
440 | - print FILE "\t.align $alignment\n" if (defined($alignment)); | |
441 | - } | |
442 | - printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset; | |
435 | + if (!$opened) { | |
436 | + open(FILE, ">$mcount_s") || die "can't create $mcount_s\n"; | |
437 | + $opened = 1; | |
438 | + print FILE "\t.section $mcount_section,\"a\",$section_type\n"; | |
439 | + print FILE "\t.align $alignment\n" if (defined($alignment)); | |
443 | 440 | } |
441 | + foreach my $cur_offset (@offsets) { | |
442 | + printf FILE "\t%s %s + %d\n", $type, $ref_func, $cur_offset - $offset; | |
443 | + } | |
444 | 444 | } |
445 | 445 | |
446 | 446 | # |
... | ... | @@ -514,7 +514,7 @@ |
514 | 514 | } |
515 | 515 | # is this a call site to mcount? If so, record it to print later |
516 | 516 | if ($text_found && /$mcount_regex/) { |
517 | - $offsets[$#offsets + 1] = hex $1; | |
517 | + push(@offsets, hex $1); | |
518 | 518 | } |
519 | 519 | } |
520 | 520 |