Tue Feb 3 14:25:25 1998 Brent Baccala <baccala@freesoft.org>
authorIan Lance Taylor <ian@airs.com>
Wed, 4 Feb 1998 00:45:10 +0000 (00:45 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 4 Feb 1998 00:45:10 +0000 (00:45 +0000)
* bbconv.pl: New file.
* Makefile.am (EXTRA_DIST): Add bbconv.pl.
* Makefile.in: Rebuild.

gprof/.Sanitize
gprof/ChangeLog
gprof/Makefile.am
gprof/Makefile.in
gprof/bbconv.pl [new file with mode: 0755]

index ea68878fa993d22e88505454eb984b611ae1588a..e98540e63ec83c2b8e3111ad9df4a5aa1f328b62 100644 (file)
@@ -37,6 +37,7 @@ aclocal.m4
 alpha.c
 basic_blocks.c
 basic_blocks.h
+bbconv.pl
 bsd_callg_bl.m
 call_graph.c
 call_graph.h
index 18a5396a7319d66f481076e65ba2af1946b596dd..c3aee1f6185b7923dab30462a57064fa08c4b666 100644 (file)
@@ -1,5 +1,9 @@
 Tue Feb  3 14:25:25 1998  Brent Baccala  <baccala@freesoft.org>
 
+       * bbconv.pl: New file.
+       * Makefile.am (EXTRA_DIST): Add bbconv.pl.
+       * Makefile.in: Rebuild.
+
        * gprof.texi: Extensive additions to document all arguments and
        output formats.
 
index a9768b637803b339968e684582f58b05c13eb5ab..5dc7ae775d2d6067ada7714b8bf1d139d3bb64f0 100644 (file)
@@ -21,7 +21,7 @@ noinst_HEADERS = \
        core.h gmon.h gmon_io.h gmon_out.h gprof.h hertz.h hist.h \
        search_list.h source.h sym_ids.h symtab.h utils.h
 
-EXTRA_DIST = flat_bl.c bsd_callg_bl.c fsf_callg_bl.c
+EXTRA_DIST = flat_bl.c bsd_callg_bl.c fsf_callg_bl.c bbconv.pl
 
 BUILT_SOURCES = flat_bl.c bsd_callg_bl.c fsf_callg_bl.c
 
index 3df926017d5bd9e793e6a64bdb8a631bf7256931..1c60801052fb2138809ad713e9b39f9f762a598c 100644 (file)
@@ -87,7 +87,7 @@ noinst_HEADERS = \
        core.h gmon.h gmon_io.h gmon_out.h gprof.h hertz.h hist.h \
        search_list.h source.h sym_ids.h symtab.h utils.h
 
-EXTRA_DIST = flat_bl.c bsd_callg_bl.c fsf_callg_bl.c
+EXTRA_DIST = flat_bl.c bsd_callg_bl.c fsf_callg_bl.c bbconv.pl
 
 BUILT_SOURCES = flat_bl.c bsd_callg_bl.c fsf_callg_bl.c
 
diff --git a/gprof/bbconv.pl b/gprof/bbconv.pl
new file mode 100755 (executable)
index 0000000..7312f51
--- /dev/null
@@ -0,0 +1,36 @@
+#! /usr/bin/perl
+
+# This script converts a "bb.out" file into a format
+# suitable for processing by gprof
+
+# Write a new-style gmon header
+
+print pack("A4Ix12", "gmon", 1);
+
+
+# The input file format contains header lines and data lines.
+# Header lines contain a count of how many data lines follow before
+# the next header line.  $blockcount is set to the count that
+# appears in each header line, then decremented at each data line.
+# $blockcount should always be zero at the start of a header line,
+# and should never be zero at the start of a data line.
+
+$blockcount=0;
+
+while (<>) {
+    if (/^File .*, ([0-9]+) basic blocks/) {
+       print STDERR "Miscount: line $.\n" if ($blockcount != 0);
+       $blockcount = $1;
+
+       print pack("cI", 2, $blockcount);
+    }
+    if (/Block.*executed([ 0-9]+) time.* address= 0x([0-9a-fA-F]*)/) {
+       print STDERR "Miscount: line $.\n" if ($blockcount == 0);
+       $blockcount-- if ($blockcount > 0);
+
+       $count = $1;
+       $addr = hex $2;
+
+       print pack("II",$addr,$count);
+    }
+}
This page took 0.028637 seconds and 4 git commands to generate.