lkml.org 
[lkml]   [2010]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 09/11] tracing: optimize recordmcount.pl for offsets-handling
    From: Wolfram Sang <w.sang@pengutronix.de>

    - 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>
    ---
    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);
    }
    }

    --
    1.6.5



    \
     
     \ /
      Last update: 2010-01-07 00:21    [W:0.023 / U:0.400 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site