Skip to content

Commit

Permalink
tracing: optimize recordmcount.pl for offsets-handling
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
Wolfram Sang authored and Steven Rostedt committed Jan 6, 2010
1 parent 7e53bd4 commit dc4f884
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions scripts/recordmcount.pl
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,14 @@ sub update_funcs

# Loop through all the mcount caller offsets and print a reference
# to the caller based from the ref_func.
for (my $i=0; $i <= $#offsets; $i++) {
if (!$opened) {
open(FILE, ">$mcount_s") || die "can't create $mcount_s\n";
$opened = 1;
print FILE "\t.section $mcount_section,\"a\",$section_type\n";
print FILE "\t.align $alignment\n" if (defined($alignment));
}
printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset;
if (!$opened) {
open(FILE, ">$mcount_s") || die "can't create $mcount_s\n";
$opened = 1;
print FILE "\t.section $mcount_section,\"a\",$section_type\n";
print FILE "\t.align $alignment\n" if (defined($alignment));
}
foreach my $cur_offset (@offsets) {
printf FILE "\t%s %s + %d\n", $type, $ref_func, $cur_offset - $offset;
}
}

Expand Down Expand Up @@ -514,7 +514,7 @@ sub update_funcs
}
# is this a call site to mcount? If so, record it to print later
if ($text_found && /$mcount_regex/) {
$offsets[$#offsets + 1] = hex $1;
push(@offsets, hex $1);
}
}

Expand Down

0 comments on commit dc4f884

Please sign in to comment.