TCOV(1)

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

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

AVAILABILITY

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

DESCRIPTION

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 accumulated 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).

OPTIONS

-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 code.

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

EXAMPLES

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

FILES
file.c
    input C program file
file.f
    input FORTRAN program file
file.d
    input test coverage data file
file.tcov
    output test coverage analysis listing file
/usr/lib/bb_link.o
    entry and exit routines for test coverage analysis

SEE ALSO
cc(1V), gprof(1), prof(1), exit(2V)

DIAGNOSTICS
premature end of file
    Issued for routines containing no statements.

BUGS
The analyzed program must call exit(2V) or return normally for the coverage information to be saved in the .d file.