* blurbs.c: New file, created from gprof.flat and gprof.callg by
authorJohn Gilmore <gnu@cygnus>
Mon, 13 Jul 1992 02:24:24 +0000 (02:24 +0000)
committerJohn Gilmore <gnu@cygnus>
Mon, 13 Jul 1992 02:24:24 +0000 (02:24 +0000)
* make-c-prog.awk:  which processes text files into C programs.
* printgprof.c (flatprofheader, gprofheader):  Call new functions
to print blurbs.
(printblurb):  Remove.
* Makefile.in:  Infrastructure to build blurbs.
* pathnames.h:  has been removed.  Gprof now has no filename
dependencies in it.
* gprof.c:  Lint.

Sat Jul 11 18:07:21 1992  david d `zoo' zuhn  (zoo at cirdan.cygnus.com)

* Makefile.in: define man1dir and install the man page

Fri Jul 10 21:14:08 1992  david d `zoo' zuhn (zoo@cygnus.com)

* Makefile.in: added dummy info and install-info targets

gprof/Makefile.in
gprof/blurbs.c [new file with mode: 0644]
gprof/gprof.c
gprof/make-c-prog.awk [new file with mode: 0644]
gprof/printgprof.c

index c02f34bfe6b8b114fa01c98dd8947f0d1cdb8fc4..8c6a127c3fd47ba8c01347ca735b3ce0c75828ba 100644 (file)
@@ -1,20 +1,22 @@
 #      @(#)Makefile    5.17 (Berkeley) 5/11/90
 
-srcdir = .
+srcdir         = .
 
-prefix = /usr/local
+prefix         = /usr/local
 
-program_prefix =
-exec_prefix = $(prefix)
-bindir = $(exec_prefix)/bin
-libdir = $(exec_prefix)/lib
+program_prefix         =
+exec_prefix    = $(prefix)
+bindir         = $(exec_prefix)/bin
+libdir         = $(exec_prefix)/lib
 tooldir = $(libdir)
+mandir         = $(prefix)/man
+man1dir = $(mandir)/man1
 
 datadir = $(prefix)/lib
 
-INSTALL = install -c
+INSTALL        = install -c
 INSTALL_PROGRAM = $(INSTALL)
-INSTALL_DATA = $(INSTALL)
+INSTALL_DATA   = $(INSTALL)
 
 #### host and target dependent Makefile fragments come in here.
 ###
@@ -24,7 +26,7 @@ SRCS= gprof.c arcs.c dfn.c lookup.c ${MACHINE}.c hertz.c \
        printgprof.c printlist.c
 LIBS = ../bfd/libbfd.a ../libiberty/libiberty.a
 
-OBJS=  gprof.o arcs.o dfn.o lookup.o ${MACHINE}.o hertz.o \
+OBJS=  blurbs.o gprof.o arcs.o dfn.o lookup.o ${MACHINE}.o hertz.o \
        printgprof.o printlist.o
 
 CFLAGS=        
@@ -33,19 +35,33 @@ CFLAGS=
 
 all:   ${PROG}
 
-.PHONY: check
+.PHONY: check info install-info
 check:
+info:
+install-info:
 
 install: all
        $(INSTALL_DATA) ${srcdir}/gprof.flat ${DESTDIR}$(datadir)
        $(INSTALL_DATA) ${srcdir}/gprof.callg ${DESTDIR}$(datadir)
+#      $(INSTALL_DATA) $(srcdir)/gprof.1 $(man1dir)/gprof.1
        $(INSTALL_PROGRAM) $(PROG) ${DESTDIR}$(bindir)
 
 $(PROG):       $(OBJS)
        $(CC) $(CFLAGS) $(OBJS) -o $(PROG) $(LIBS)
 
+# Make blurbs.c from gprof.callg and gprof.flat
+blurbs.c: ${srcdir}/gprof.callg ${srcdir}/gprof.flat ${srcdir}/make-c-prog.awk
+       awk -f ${srcdir}/make-c-prog.awk > ./blurbs.c \
+               FUNCTION=flat_blurb  ${srcdir}/gprof.flat \
+               FUNCTION=callg_blurb ${srcdir}/gprof.callg \
+
 clean:
        -rm -f $(OBJS) core gprof nohup.out
+
+Makefile : Makefile.in
+       sh config.status
+
+
 # These get around a bug in Sun Make in SunOS 4.1.1 and Solaris 2
 gprof.o: gprof.c
 arcs.o: arcs.c
@@ -55,3 +71,4 @@ ${MACHINE}.o: ${MACHINE}.c
 hertz.o: hertz.c
 printgprof.o: printgprof.c
 printlist.o: printlist.c
+blurbs.o: blurbs.c
diff --git a/gprof/blurbs.c b/gprof/blurbs.c
new file mode 100644 (file)
index 0000000..1a2d3a9
--- /dev/null
@@ -0,0 +1,156 @@
+/* ==> Do not modify this file!!  It is created automatically
+   by make-c-prog.awk; modify make-c-prog.awk instead.  <== */
+
+#include <stdio.h>
+
+void
+flat_blurb (file)
+     FILE *file;
+{
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("flat profile:\n", file);
+  fputs ("\n", file);
+  fputs (" %         the percentage of the total running time of the\n", file);
+  fputs ("time       program used by this function.\n", file);
+  fputs ("\n", file);
+  fputs ("cumulative a running sum of the number of seconds accounted\n", file);
+  fputs (" seconds   for by this function and those listed above it.\n", file);
+  fputs ("\n", file);
+  fputs (" self      the number of seconds accounted for by this\n", file);
+  fputs ("seconds    function alone.  This is the major sort for this\n", file);
+  fputs ("           listing.\n", file);
+  fputs ("\n", file);
+  fputs ("calls      the number of times this function was invoked, if\n", file);
+  fputs ("           this function is profiled, else blank.\n", file);
+  fputs (" \n", file);
+  fputs (" self      the average number of milliseconds spent in this\n", file);
+  fputs ("ms/call    function per call, if this function is profiled,\n", file);
+  fputs ("        else blank.\n", file);
+  fputs ("\n", file);
+  fputs (" total     the average number of milliseconds spent in this\n", file);
+  fputs ("ms/call    function and its descendents per call, if this \n", file);
+  fputs ("        function is profiled, else blank.\n", file);
+  fputs ("\n", file);
+  fputs ("name       the name of the function.  This is the minor sort\n", file);
+  fputs ("           for this listing. The index shows the location of\n", file);
+  fputs ("        the function in the gprof listing. If the index is\n", file);
+  fputs ("        in parenthesis it shows where it would appear in\n", file);
+  fputs ("        the gprof listing if it were to be printed.\n", file);
+  fputs ("\f\n", file);
+}
+
+void
+callg_blurb (file)
+     FILE *file;
+{
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("call graph profile:\n", file);
+  fputs ("          The sum of self and descendents is the major sort\n", file);
+  fputs ("          for this listing.\n", file);
+  fputs ("\n", file);
+  fputs ("          function entries:\n", file);
+  fputs ("\n", file);
+  fputs ("index     the index of the function in the call graph\n", file);
+  fputs ("          listing, as an aid to locating it (see below).\n", file);
+  fputs ("\n", file);
+  fputs ("%time     the percentage of the total time of the program\n", file);
+  fputs ("          accounted for by this function and its\n", file);
+  fputs ("          descendents.\n", file);
+  fputs ("\n", file);
+  fputs ("self      the number of seconds spent in this function\n", file);
+  fputs ("          itself.\n", file);
+  fputs ("\n", file);
+  fputs ("descendents\n", file);
+  fputs ("          the number of seconds spent in the descendents of\n", file);
+  fputs ("          this function on behalf of this function.\n", file);
+  fputs ("\n", file);
+  fputs ("called    the number of times this function is called (other\n", file);
+  fputs ("          than recursive calls).\n", file);
+  fputs ("\n", file);
+  fputs ("self      the number of times this function calls itself\n", file);
+  fputs ("          recursively.\n", file);
+  fputs ("\n", file);
+  fputs ("name      the name of the function, with an indication of\n", file);
+  fputs ("          its membership in a cycle, if any.\n", file);
+  fputs ("\n", file);
+  fputs ("index     the index of the function in the call graph\n", file);
+  fputs ("          listing, as an aid to locating it.\n", file);
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("          parent listings:\n", file);
+  fputs ("\n", file);
+  fputs ("self*     the number of seconds of this function's self time\n", file);
+  fputs ("          which is due to calls from this parent.\n", file);
+  fputs ("\n", file);
+  fputs ("descendents*\n", file);
+  fputs ("          the number of seconds of this function's\n", file);
+  fputs ("          descendent time which is due to calls from this\n", file);
+  fputs ("          parent.\n", file);
+  fputs ("\n", file);
+  fputs ("called**  the number of times this function is called by\n", file);
+  fputs ("          this parent.  This is the numerator of the\n", file);
+  fputs ("          fraction which divides up the function's time to\n", file);
+  fputs ("          its parents.\n", file);
+  fputs ("\n", file);
+  fputs ("total*    the number of times this function was called by\n", file);
+  fputs ("          all of its parents.  This is the denominator of\n", file);
+  fputs ("          the propagation fraction.\n", file);
+  fputs ("\n", file);
+  fputs ("parents   the name of this parent, with an indication of the\n", file);
+  fputs ("          parent's membership in a cycle, if any.\n", file);
+  fputs ("\n", file);
+  fputs ("index     the index of this parent in the call graph\n", file);
+  fputs ("          listing, as an aid in locating it.\n", file);
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("          children listings:\n", file);
+  fputs ("\n", file);
+  fputs ("self*     the number of seconds of this child's self time\n", file);
+  fputs ("          which is due to being called by this function.\n", file);
+  fputs ("\n", file);
+  fputs ("descendent*\n", file);
+  fputs ("          the number of seconds of this child's descendent's\n", file);
+  fputs ("          time which is due to being called by this\n", file);
+  fputs ("          function.\n", file);
+  fputs ("\n", file);
+  fputs ("called**  the number of times this child is called by this\n", file);
+  fputs ("          function.  This is the numerator of the\n", file);
+  fputs ("          propagation fraction for this child.\n", file);
+  fputs ("\n", file);
+  fputs ("total*    the number of times this child is called by all\n", file);
+  fputs ("          functions.  This is the denominator of the\n", file);
+  fputs ("          propagation fraction.\n", file);
+  fputs ("\n", file);
+  fputs ("children  the name of this child, and an indication of its\n", file);
+  fputs ("          membership in a cycle, if any.\n", file);
+  fputs ("\n", file);
+  fputs ("index     the index of this child in the call graph listing,\n", file);
+  fputs ("          as an aid to locating it.\n", file);
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("          * these fields are omitted for parents (or\n", file);
+  fputs ("          children) in the same cycle as the function.  If\n", file);
+  fputs ("          the function (or child) is a member of a cycle,\n", file);
+  fputs ("          the propagated times and propagation denominator\n", file);
+  fputs ("          represent the self time and descendent time of the\n", file);
+  fputs ("          cycle as a whole.\n", file);
+  fputs ("\n", file);
+  fputs ("          ** static-only parents and children are indicated\n", file);
+  fputs ("          by a call count of 0.\n", file);
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("\n", file);
+  fputs ("          cycle listings:\n", file);
+  fputs ("          the cycle as a whole is listed with the same\n", file);
+  fputs ("          fields as a function entry.  Below it are listed\n", file);
+  fputs ("          the members of the cycle, and their contributions\n", file);
+  fputs ("          to the time and call counts of the cycle.\n", file);
+  fputs ("\f\n", file);
+}
index 32e297fad1e87367fd945bac22d5f707fb0aa2a6..2102e93cfaa8304ce1d79666d5c12492c82c9c93 100644 (file)
@@ -330,9 +330,9 @@ getpfile(filename)
         *      a bunch of <from,self,count> tuples.
         */
     while ( fread( &arc , sizeof arc , 1 , pfile ) == 1 ) {
-      arc.raw_frompc = bfd_get_32 (abfd, &arc.raw_frompc);
-      arc.raw_selfpc = bfd_get_32 (abfd, &arc.raw_selfpc);
-      arc.raw_count = bfd_get_32 (abfd, &arc.raw_count);
+      arc.raw_frompc = bfd_get_32 (abfd, (bfd_byte *) &arc.raw_frompc);
+      arc.raw_selfpc = bfd_get_32 (abfd, (bfd_byte *) &arc.raw_selfpc);
+      arc.raw_count  = bfd_get_32 (abfd, (bfd_byte *) &arc.raw_count);
 #      ifdef DEBUG
            if ( debug & SAMPLEDEBUG ) {
                printf( "[getpfile] frompc 0x%x selfpc 0x%x count %d\n" ,
@@ -359,9 +359,9 @@ openpfile(filename)
        done();
     }
     fread(&tmp, sizeof(struct hdr), 1, pfile);
-    tmp.lowpc = (char*)bfd_get_32 (abfd, &tmp.lowpc);
-    tmp.highpc = (char*)bfd_get_32 (abfd, &tmp.highpc);
-    tmp.ncnt = bfd_get_32 (abfd, &tmp.ncnt);
+    tmp.lowpc  = (UNIT *)bfd_get_32 (abfd, (bfd_byte *) &tmp.lowpc);
+    tmp.highpc = (UNIT *)bfd_get_32 (abfd, (bfd_byte *) &tmp.highpc);
+    tmp.ncnt   =         bfd_get_32 (abfd, (bfd_byte *) &tmp.ncnt);
 
     if ( s_highpc != 0 && ( tmp.lowpc != h.lowpc ||
         tmp.highpc != h.highpc || tmp.ncnt != h.ncnt ) ) {
@@ -494,7 +494,7 @@ readsamples(pfile)
     }
     for (i = 0; i < nsamples; i++) {
        fread(&sample, sizeof (UNIT), 1, pfile);
-       sample = bfd_get_16 (abfd, &sample);
+       sample = bfd_get_16 (abfd, (bfd_byte *) &sample);
        if (feof(pfile))
                break;
        samples[i] += sample;
diff --git a/gprof/make-c-prog.awk b/gprof/make-c-prog.awk
new file mode 100644 (file)
index 0000000..a0a49de
--- /dev/null
@@ -0,0 +1,29 @@
+BEGIN  {
+         FS="\"";
+         print "/* ==> Do not modify this file!!  It is created automatically"
+         print "   by make-c-prog.awk; modify make-c-prog.awk instead.  <== */"
+         print ""
+         print "#include <stdio.h>"
+       }
+
+       {
+         if (curfun != FUNCTION)
+           {
+             if (curfun)
+               print "}"
+             curfun = FUNCTION
+             print ""
+             print "void";
+             printf "%s (file)\n", FUNCTION
+             print "     FILE *file;";
+             print "{";
+           }
+         printf "  fputs (\"";
+         for (i = 1; i < NF; i++)
+           printf "%s\\\"", $i;
+         printf "%s\\n\", file);\n", $NF;
+       }
+
+END    {
+         print "}"
+       }
index ce788522bd96514b328fb5ea32b90c77af691f35..5ef0c87b8cddd428f30f55ec5a7543fed1f03df7 100644 (file)
@@ -22,7 +22,6 @@ static char sccsid[] = "@(#)printgprof.c      5.7 (Berkeley) 6/1/90";
 #endif /* not lint */
 
 #include "gprof.h"
-#include "pathnames.h"
 
 printprof()
 {
@@ -78,7 +77,7 @@ flatprofheader()
 {
     
     if ( bflag ) {
-       printblurb( _PATH_FLAT_BLURB );
+       flat_blurb(stdout);
     }
     printf( "\ngranularity: each sample hit covers %d byte(s)" ,
            (long) scale * sizeof(UNIT) );
@@ -88,7 +87,7 @@ flatprofheader()
     } else {
        printf( " no time accumulated\n\n" );
            /*
-            *  this doesn't hurt sinc eall the numerators will be zero.
+            *  this doesn't hurt sincall the numerators will be zero.
             */
        totime = 1.0;
     }
@@ -124,7 +123,7 @@ gprofheader()
 {
 
     if ( bflag ) {
-       printblurb( _PATH_CALLG_BLURB );
+       callg_blurb(stdout);
     }
     printf( "\ngranularity: each sample hit covers %d byte(s)" ,
            (long) scale * sizeof(UNIT) );
@@ -632,23 +631,6 @@ arccmp( thisp , thatp )
     }
 }
 
-printblurb( blurbname )
-    char       *blurbname;
-{
-    FILE       *blurbfile;
-    int                input;
-
-    blurbfile = fopen( blurbname , "r" );
-    if ( blurbfile == NULL ) {
-       perror( blurbname );
-       return;
-    }
-    while ( ( input = getc( blurbfile ) ) != EOF ) {
-       putchar( input );
-    }
-    fclose( blurbfile );
-}
-
 int
 namecmp( npp1 , npp2 )
     nltype **npp1, **npp2;
This page took 0.033476 seconds and 4 git commands to generate.