History

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

Wolfram Sang committed 16 years ago

Commit dc4f8841 parent 7e53bd41 file · +9 −9Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/recordmcount.pl+9−9
@@ -432,14 +432,14 @@ sub update_funcs · 431 unmodified lines
432 432
433 # Loop through all the mcount caller offsets and print a reference433 # Loop through all the mcount caller offsets and print a reference
434 # to the caller based from the ref_func.434 # to the caller based from the ref_func.
435 for (my $i=0; $i <= $#offsets; $i++) {435 if (!$opened) {
436 if (!$opened) {436 open(FILE, ">$mcount_s") || die "can't create $mcount_s\n";
437 open(FILE, ">$mcount_s") || die "can't create $mcount_s\n";437 $opened = 1;
438 $opened = 1;438 print FILE "\t.section $mcount_section,\"a\",$section_type\n";
439 print FILE "\t.section $mcount_section,\"a\",$section_type\n";439 print FILE "\t.align $alignment\n" if (defined($alignment));
440 print FILE "\t.align $alignment\n" if (defined($alignment));440 }
441 }441 foreach my $cur_offset (@offsets) {
442 printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset;442 printf FILE "\t%s %s + %d\n", $type, $ref_func, $cur_offset - $offset;
443 }443 }
444}444}
445 445
@@ -514,7 +514,7 @@ while (<IN>) { · 68 unmodified lines
514 }514 }
515 # is this a call site to mcount? If so, record it to print later515 # is this a call site to mcount? If so, record it to print later
516 if ($text_found && /$mcount_regex/) {516 if ($text_found && /$mcount_regex/) {
517 $offsets[$#offsets + 1] = hex $1;517 push(@offsets, hex $1);
518 }518 }
519}519}
520 520

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t