[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1262716751.28171.1614.camel@gandalf.stny.rr.com>
Date: Tue, 05 Jan 2010 13:39:11 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Wolfram Sang <w.sang@...gutronix.de>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] tracing/recordmount.pl: optimize offsets-handling
On Tue, 2010-01-05 at 19:27 +0100, Wolfram Sang wrote:
> - 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@...gutronix.de>
> ---
> scripts/recordmcount.pl | 18 +++++++++---------
> 1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
> index 92f09fe..5de12c7 100755
> --- a/scripts/recordmcount.pl
> +++ b/scripts/recordmcount.pl
> @@ -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;
> }
> }
>
> @@ -514,7 +514,7 @@ while (<IN>) {
> }
> # 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);
> }
> }
>
OK, I like this patch. I'll pull it in.
Thanks!
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists