<s>
Tcov	B-Application
is	O
a	O
source	B-Application
code	I-Application
coverage	I-Application
analysis	O
and	O
statement-by-statement	O
profiling	O
tool	O
for	O
software	O
written	O
in	O
Fortran	B-Application
,	O
C	B-Language
and	O
C++	B-Language
.	O
</s>
<s>
Tcov	B-Application
generates	O
exact	O
counts	O
of	O
the	O
number	O
of	O
times	O
each	O
statement	O
in	O
a	O
program	B-Application
is	O
executed	O
and	O
annotates	O
source	O
code	O
to	O
add	O
instrumentation	O
.	O
</s>
<s>
It	O
is	O
a	O
standard	O
utility	O
,	O
provided	O
free	B-License
of	I-License
cost	I-License
with	O
Sun	B-Application
Studio	I-Application
software	O
.	O
</s>
<s>
The	O
tcov	B-Application
utility	O
gives	O
information	O
on	O
how	O
often	O
a	O
program	B-Application
executes	O
segments	O
of	O
code	O
.	O
</s>
<s>
The	O
code	O
can	O
be	O
annotated	O
at	O
the	O
basic	B-Application
block	I-Application
level	O
or	O
the	O
source	O
line	O
level	O
.	O
</s>
<s>
As	O
the	O
statements	O
in	O
a	O
basic	B-Application
block	I-Application
are	O
executed	O
the	O
same	O
number	O
of	O
times	O
,	O
a	O
count	O
of	O
basic	B-Application
block	I-Application
executions	O
equals	O
number	O
of	O
times	O
each	O
statement	O
in	O
the	O
block	O
is	O
executed	O
.	O
</s>
<s>
The	O
tcov	B-Application
utility	O
does	O
not	O
produce	O
any	O
time-based	O
data	O
.	O
</s>
<s>
tcov	B-Application
produces	O
a	O
test	O
coverage	O
analysis	O
of	O
a	O
compiled	B-Language
program	I-Language
.	O
</s>
<s>
tcov	B-Application
takes	O
source	O
files	O
as	O
arguments	O
and	O
produces	O
an	O
annotated	O
source	O
listing	O
.	O
</s>
<s>
Each	O
basic	B-Application
block	I-Application
of	O
code	O
(	O
or	O
each	O
line	O
if	O
the	O
particular	O
option	O
to	O
tcov	B-Application
is	O
specified	O
)	O
is	O
prefixed	O
with	O
the	O
number	O
of	O
times	O
it	O
has	O
been	O
executed	O
;	O
lines	O
that	O
have	O
not	O
been	O
executed	O
are	O
prefixed	O
with	O
"	O
#####	O
"	O
.	O
</s>
<s>
The	O
tcov	B-Application
utility	O
also	O
places	O
a	O
summary	O
at	O
the	O
end	O
of	O
the	O
annotated	O
program	B-Application
listing	O
.	O
</s>
<s>
The	O
statistics	O
for	O
the	O
most	O
frequently	O
executed	O
basic	B-Application
blocks	I-Application
are	O
listed	O
in	O
order	O
of	O
execution	O
frequency	O
.	O
</s>
<s>
There	O
are	O
two	O
implementations	O
of	O
tcov	B-Application
:	O
</s>
<s>
Old	O
Style	O
coverage	O
analysis	O
:	O
In	O
this	O
implementation	O
,	O
also	O
known	O
as	O
tcov	B-Application
original	O
,	O
the	O
compiler	B-Language
creates	O
a	O
coverage	O
data	O
file	O
with	O
the	O
suffix	O
.d	O
for	O
each	O
object	O
file	O
.	O
</s>
<s>
When	O
program	B-Application
completes	O
,	O
the	O
coverage	O
data	O
files	O
are	O
updated	O
.	O
</s>
<s>
New	O
Style	O
coverage	O
analysis	O
:	O
In	O
this	O
implementation	O
,	O
also	O
known	O
as	O
tcov	B-Application
enhanced	O
,	O
no	O
additional	O
files	O
are	O
created	O
at	O
compile	B-Language
time	O
.	O
</s>
<s>
Provides	O
more	O
complete	O
support	O
for	O
C++	B-Language
.	O
</s>
<s>
More	O
efficient	O
runtime	O
than	O
the	O
original	O
tcov	B-Application
runtime	O
.	O
</s>
<s>
Supported	O
for	O
all	O
the	O
platforms	O
that	O
the	O
compilers	B-Language
support	O
.	O
</s>
<s>
Data	O
for	O
each	O
object	O
file	O
is	O
zeroed	O
out	O
the	O
first	O
time	O
the	O
program	B-Application
is	O
executed	O
after	O
recompilation	O
.	O
</s>
<s>
Data	O
for	O
the	O
entire	O
program	B-Application
is	O
zeroed	O
by	O
removing	O
the	O
tcovd	O
file	O
.	O
</s>
<s>
The	O
above	O
steps	O
are	O
explained	O
for	O
both	O
original	O
and	O
enhanced	O
tcov	B-Application
below	O
:	O
</s>
<s>
Source	O
code	O
is	O
compiled	B-Language
with	O
-xa	O
option	O
for	O
C	B-Language
program	I-Language
and	O
-a	O
option	O
for	O
Fortran	B-Application
and	O
C++	B-Language
programs	I-Language
.	O
</s>
<s>
The	O
compiler	B-Language
creates	O
a	O
coverage	O
data	O
file	O
with	O
the	O
suffix	O
.d	O
for	O
each	O
object	O
file	O
.	O
</s>
<s>
The	O
above	O
instrumented	O
build	O
is	O
run	O
and	O
at	O
program	B-Application
completion	O
,	O
the	O
.d	O
files	O
are	O
updated	O
.	O
</s>
<s>
Finally	O
,	O
tcov	B-Application
command	O
is	O
run	O
to	O
generate	O
the	O
annotated	O
source	O
files	O
.	O
</s>
<s>
The	O
syntax	O
of	O
the	O
tcov	B-Application
command	O
is	O
as	O
follows	O
:	O
</s>
<s>
For	O
a	O
list	O
of	O
options	O
,	O
The	O
default	O
output	O
of	O
tcov	B-Application
is	O
a	O
set	O
of	O
files	O
,	O
each	O
with	O
the	O
suffix	O
.tcov	O
,	O
which	O
can	O
be	O
changed	O
with	O
the	O
-o	O
filename	O
option	O
.	O
</s>
<s>
A	O
program	B-Application
compiled	B-Language
for	O
code	B-Application
coverage	I-Application
analysis	O
can	O
be	O
run	O
multiple	O
times	O
(	O
with	O
potentially	O
varying	O
input	O
)	O
;	O
tcov	B-Application
can	O
be	O
used	O
on	O
the	O
program	B-Application
after	O
each	O
run	O
to	O
compare	O
behavior	O
.	O
</s>
<s>
Source	O
code	O
is	O
compiled	B-Language
with	O
-xprofile	O
=	O
tcov	B-Application
option	O
.	O
</s>
<s>
Unlike	O
original	O
mode	O
,	O
enhanced	O
tcov	B-Application
does	O
n't	O
generate	O
any	O
files	O
at	O
compile	B-Language
time	O
.	O
</s>
<s>
The	O
above	O
instrumented	O
build	O
is	O
run	O
and	O
at	O
program	B-Application
completion	O
,	O
a	O
directory	O
is	O
created	O
to	O
store	O
the	O
profile	O
data	O
,	O
and	O
a	O
single	O
coverage	O
data	O
file	O
called	O
tcovd	O
is	O
created	O
in	O
that	O
directory	O
.	O
</s>
<s>
By	O
default	O
,	O
the	O
directory	O
is	O
created	O
in	O
the	O
location	O
where	O
program	B-Application
is	O
run	O
,	O
and	O
it	O
is	O
named	O
after	O
executable	B-Application
and	O
suffixed	O
by	O
.profile	O
.	O
</s>
<s>
Finally	O
,	O
tcov	B-Application
command	O
is	O
run	O
to	O
generate	O
the	O
annotated	O
source	O
files	O
.	O
</s>
<s>
The	O
syntax	O
of	O
the	O
tcov	B-Application
command	O
is	O
same	O
as	O
for	O
original	O
command	O
,	O
except	O
for	O
the	O
mandatory	O
-x	O
option	O
.	O
</s>
<s>
The	O
only	O
difference	O
in	O
command	O
from	O
original	O
tcov	B-Application
is	O
the	O
mandatory	O
addition	O
is	O
of	O
-x	O
dir	O
option	O
to	O
denote	O
enhanced	O
tcov	B-Application
.	O
</s>
<s>
The	O
following	O
program	B-Application
,	O
written	O
in	O
C	B-Language
programming	I-Language
language	I-Language
,	O
loops	B-General_Concept
overs	O
the	O
integers	O
1	O
to	O
9	O
and	O
tests	O
their	O
divisibility	O
with	O
the	O
modulus	O
( %	O
)	O
operator	O
.	O
</s>
<s>
To	O
enable	O
coverage	B-Application
testing	I-Application
the	O
program	B-Application
must	O
be	O
compiled	B-Language
with	O
the	O
following	O
options	O
:	O
</s>
<s>
for	O
old	O
style	O
code	B-Application
coverage	I-Application
,	O
</s>
<s>
and	O
for	O
new	O
style	O
code	B-Application
coverage	I-Application
,	O
</s>
<s>
where	O
cov.c	O
is	O
the	O
name	O
of	O
the	O
program	B-Application
file	I-Application
.	O
</s>
<s>
This	O
creates	O
an	O
instrumented	O
executable	B-Application
which	O
contains	O
additional	O
instructions	O
that	O
record	O
the	O
number	O
of	O
times	O
each	O
line	O
of	O
the	O
program	B-Application
is	O
executed	O
.	O
</s>
<s>
-o	O
option	O
is	O
used	O
to	O
set	O
the	O
name	O
of	O
the	O
executable	B-Application
.	O
</s>
<s>
The	O
executable	B-Application
must	O
then	O
be	O
run	O
to	O
create	O
the	O
coverage	O
data	O
.	O
</s>
<s>
In	O
old	O
style	O
analysis	O
,	O
this	O
file	O
with	O
extension	O
.d	O
,	O
created	O
after	O
compilation	B-Language
,	O
either	O
in	O
TCOVDIR	O
directory	O
or	O
current	O
one	O
,	O
is	O
updated	O
with	O
coverage	O
data	O
.	O
</s>
<s>
In	O
new	O
style	O
analysis	O
,	O
coverage	O
data	O
file	O
,	O
with	O
name	O
tcovd	O
,	O
is	O
created	O
in	O
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1.profile	O
directory	O
.	O
</s>
<s>
This	O
data	O
can	O
be	O
analyzed	O
using	O
the	O
tcov	B-Application
command	O
and	O
the	O
name	O
of	O
a	O
source	O
file	O
:	O
</s>
<s>
for	O
old	O
style	O
code	B-Application
coverage	I-Application
,	O
</s>
<s>
and	O
for	O
new	O
style	O
code	B-Application
coverage	I-Application
,	O
</s>
<s>
The	O
tcov	B-Application
command	O
produces	O
an	O
annotated	O
version	O
of	O
the	O
original	O
source	O
file	O
,	O
with	O
the	O
file	O
extension	O
‘	O
.tcov	O
’	O
,	O
containing	O
counts	O
of	O
the	O
number	O
of	O
times	O
each	O
line	O
was	O
executed	O
:	O
</s>
<s>
The	O
tcov	B-Application
utility	O
also	O
places	O
a	O
summary	O
at	O
the	O
end	O
of	O
the	O
annotated	O
program	B-Application
listing	O
.	O
</s>
<s>
The	O
statistics	O
for	O
the	O
most	O
frequently	O
executed	O
basic	B-Application
blocks	I-Application
are	O
listed	O
in	O
order	O
of	O
execution	O
frequency	O
.	O
</s>
<s>
Tcov	B-Application
command	O
line	O
utility	O
supports	O
following	O
options	O
while	O
generating	O
annotated	O
files	O
from	O
profile	O
data	O
:	O
</s>
<s>
-o	O
filename	O
:	O
Direct	O
the	O
output	O
to	O
filename	O
instead	O
of	O
file.tcov	O
.	O
</s>
<s>
If	O
this	O
option	O
is	O
not	O
specified	O
,	O
old	O
style	O
tcov	B-Application
coverage	O
is	O
assumed	O
.	O
</s>
