All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Wolfram Sang <w.sang@pengutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	rostedt@goodmis.org, w.sang@pengutronix.de, tglx@linutronix.de
Subject: [tip:tracing/core] tracing: optimize recordmcount.pl for offsets-handling
Date: Wed, 13 Jan 2010 10:23:39 GMT	[thread overview]
Message-ID: <tip-dc4f8845ee2ca39fe054a2d911729ffd269b4b66@git.kernel.org> (raw)
In-Reply-To: <1262716072-14414-2-git-send-email-w.sang@pengutronix.de>

Commit-ID:  dc4f8845ee2ca39fe054a2d911729ffd269b4b66
Gitweb:     http://git.kernel.org/tip/dc4f8845ee2ca39fe054a2d911729ffd269b4b66
Author:     Wolfram Sang <w.sang@pengutronix.de>
AuthorDate: Tue, 5 Jan 2010 19:27:51 +0100
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Wed, 6 Jan 2010 13:32:39 -0500

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

      parent reply	other threads:[~2010-01-13 10:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05 18:27 Minor improvements to recordmount.pl Wolfram Sang
2010-01-05 18:27 ` [PATCH 1/2] tracing/recordmount.pl: optimize offsets-handling Wolfram Sang
2010-01-05 18:27   ` [PATCH 2/2] tracing/recordmount.pl: use apropriate perl-constructs Wolfram Sang
2010-01-05 18:37     ` Steven Rostedt
2010-01-05 19:13       ` Wolfram Sang
2010-01-05 19:24         ` Steven Rostedt
2010-01-05 20:41           ` [PATCH V2] " Wolfram Sang
2010-01-13 10:23             ` [tip:tracing/core] tracing: Use appropriate perl constructs in recordmcount.pl tip-bot for Wolfram Sang
2010-01-05 18:39   ` [PATCH 1/2] tracing/recordmount.pl: optimize offsets-handling Steven Rostedt
2010-01-13 10:23   ` tip-bot for Wolfram Sang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-dc4f8845ee2ca39fe054a2d911729ffd269b4b66@git.kernel.org \
    --to=w.sang@pengutronix.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.