Use exclude directives to exclude from instrumentation libraries, directories, and individual files. This reduces the volume of coverage data and improves run-time performance.
PureCoverage reads exclude directives at build time from the .purecov and .purecov.<platform> files. PureCoverage looks for these files in:
The current directory
Your home directory
The <purecovhome> directory
The .purecov and <purecov.platform> files, as shipped by Rational Software, contain a set of default exclude directives. Add or remove directives, then re-link your application to apply the changes.
Each directive begins with exclude followed by the name of a library, directory, or file. For example:
exclude /usr/lib
This directive disables instrumentation for files whose pathname begins /usr/lib, such as /usr/lib/libc.a.
Use canonical names in exclude directives, not symbolic link names. (During instrumentation, PureCoverage expands all symbolic links and creates canonical versions of all pathnames. This prevents the coverage data from listing the same file under multiple names. Names in the exclude directives must therefore match the canonical names.)
This is especially an issue when your program obtains site-wide libraries from a remote file system via a generic pathname that is a symbolic link to a specific installation directory. To handle this problem:
Find
the real name
of the library you know as, for example, /usr/site/lib/libdrivers.a by examining previously collected coverage data where
the library was not excluded, and use that full name:
exclude /nfs/u46/site/releases/3.0/lib/libdrivers.a
Or use wildcards (* or ?) in the
exclude
directive for the root part of the pathname.
exclude */lib/libdrivers*
Or
omit the entire leading pathname and use unqualified names (containing no "/")
to exclude object files and libraries; for example:
exclude libdrivers*
Notes:
Excluding a file or library in your program does not remove previously collected data from any .pcv files. To eliminate the old data, remove the .pcv files.
PureCoverage instruments libraries even when they are excluded, but the instrumentation is only a partial instrumentation, required to maintain the necessary registers. The overhead for partial instrumentation is minimal.
For information about how PureCoverage normally instruments libraries, click
You
can exclude files by source
name, but this is not recommended, because there is no way for PureCoverage
to know which object files to update when source name exclude directives
are changed.
If you change exclude directives that use source names, you must manually remove
the instrumented versions of all object files that may contain contributions
from those source files. For example a C++ header file can easily generate
code every time it is included, affecting code in hundreds of object files.
Or you can rebuild your program once with the -force-rebuild option to force all files and libraries to be re-instrumented.
You cannot exclude libraries after you build your executable because exclude directives are read at build time. You need to re-link your program for the new directives to take effect.
For information about using adjustments to exclude specific lines from the coverage statistics, click