3 # This script converts a "bb.out" file into a format
4 # suitable for processing by gprof
6 # Copyright 2001, 2007 Free Software Foundation, Inc.
8 # This file is part of GNU Binutils.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 3 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
25 # Write a new-style gmon header
27 print pack("A4Ix12", "gmon", 1);
30 # The input file format contains header lines and data lines.
31 # Header lines contain a count of how many data lines follow before
32 # the next header line. $blockcount is set to the count that
33 # appears in each header line, then decremented at each data line.
34 # $blockcount should always be zero at the start of a header line,
35 # and should never be zero at the start of a data line.
40 if (/^File .*, ([0-9]+) basic blocks/) {
41 print STDERR
"Miscount: line $.\n" if ($blockcount != 0);
44 print pack("cI", 2, $blockcount);
46 if (/Block.*executed([ 0-9]+) time.* address= 0x([0-9a-fA-F]*)/) {
47 print STDERR
"Miscount: line $.\n" if ($blockcount == 0);
48 $blockcount-- if ($blockcount > 0);
53 print pack("II",$addr,$count);
This page took 0.031353 seconds and 4 git commands to generate.