OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [gprof/] [bbconv.pl] - Blame information for rev 255

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 khays
#! /usr/bin/perl
2
 
3
# This script converts a "bb.out" file into a format
4
# suitable for processing by gprof
5
#
6
# Copyright 2001, 2007 Free Software Foundation, Inc.
7
#
8
#   This file is part of GNU Binutils.
9
#
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.
14
#
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.
19
#
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
23
#   02110-1301, USA.
24
 
25
# Write a new-style gmon header
26
 
27
print pack("A4Ix12", "gmon", 1);
28
 
29
 
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.
36
 
37
$blockcount=0;
38
 
39
while (<>) {
40
    if (/^File .*, ([0-9]+) basic blocks/) {
41
        print STDERR "Miscount: line $.\n" if ($blockcount != 0);
42
        $blockcount = $1;
43
 
44
        print pack("cI", 2, $blockcount);
45
    }
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);
49
 
50
        $count = $1;
51
        $addr = hex $2;
52
 
53
        print pack("II",$addr,$count);
54
    }
55
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.