Re: Determining instruction mix (Bob Roos)
Thu, 9 Feb 1995 11:42:21 GMT

          From comp.compilers

Related articles
Determining instruction mix (1995-02-06)
Re: Determining instruction mix (1995-02-07)
Re: Determining instruction mix (1995-02-07)
Re: Determining instruction mix (1995-02-08)
Re: Determining instruction mix (1995-02-09)
Re: Determining instruction mix (1995-02-09)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (Bob Roos)
Keywords: architecture,testing
Organization: Smith College, Northampton, MA, USA
References: 95-02-068
Date: Thu, 9 Feb 1995 11:42:21 GMT

Rikus Combrinck <> wrote:
>I'm looking for software that can determine the dynamic
>instructions mix of a programme, i.e. the number of times that
>certain instructions are executed during execution of the
>program. I'm am especially interested in a version that could
>do this on a multiprocessor machine (like the SUN SPARCStation 1000).
>[Somewhere I was a paper about a system that does this by instrumenting
>basic blocks so it makes one count per block rather than per instruction,
>then post-proccesses to get the instruction counts. -John]

I've been looking for profilers on our system to use for illustrating
"real" program behavior in my undergraduate algorithms class. I've settled
on "tcov", which sounds like the basic block program referred to above.
Sun Release 4.1 Last change: 18 February 1988 1


          tcov - construct test coverage analysis and statement-by-
          statement profile

          tcov [ -a ] [ -n ] srcfile...

          This command is available on Sun-3 and Sun-4 systems only.

          tcov produces a test coverage analysis and statement-by-
          statement profile of a C or FORTRAN program. When a program
          in a file named file.c or file.f is compiled with the -a
          option, a corresponding file.d file is created. Each time
          the program is executed, test coverage information is accu-
          mulated in file.d.

          tcov takes source files as arguments. It reads the
          corresponding file.d file and produces an annotated listing
          of the program with coverage data in file.tcov. Each
          straight-line segment of code (or each line if the -a option
          to tcov is specified) is prefixed with the number of times
          it has been executed; lines which have not been executed are
          prefixed with #####.

          Note: the profile produced includes only the number of times
          each statement was executed, not execution times; to obtain
          times for routines use gprof(1) or prof(1).

          -a Display an execution count for each statement; if -a is
                    not specified, an execution count is displayed only for
                    the first statement of each straight-line segment of

          -n Display table of the line numbers of the n most fre-
                    quently executed statements and their execution counts.

          The command:

                    example% cc -a -o prog prog.c

          compiles with the -a option - produces prog.d

          The command: example% prog

          executes the program `-' accumulates data in prog.d

          The command: example% tcov prog.c

          produces an annotated listing in file prog.tcov
Now MY question. I can't get this to work with Gnu C, only our old K&R
"cc". Has anyone successfully used the "-a" option with gcc?

Bob Roos

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.