Insure++ can be easily adapted to different environments and needs. This section describes some of the ways Insure++ can be customized. In this section:

Instrument Using Multiple Processes

If you are using a machine with a CPU that has multiple cores and/or hyperthreading, Insure++ can take advantage of this by instrumenting with multiple processes. Insure++ can create an instrumentation process for each available logical CPU. You can also specify the number of processes to create. Depending on the makeup of your project and the machine hardware, this can significantly reduce instrumentation time.

Visual Studio users who build using multiple processes with the /MP flag can take advantage of this without any additional changes. Insure++ will automatically recognize the flag and pass it along to the compiler once instrumentation has finished.

To enable instrumentation with multiple processes, use the /MP or -Zmp flag on your command line.

To specify number of processes, use /MPn or -Zmpn, where n is the number of desired processes. Insure++ will not create more processes than available logical CPUs. If you specify more processes than are available, Insure++ will still only use the maximum available. The following table describes the flags:

FlagEffect
/MP, -ZmpInsure++ will detect maximum number of logical CPUs and use all available for instrumentation.
/MPn, -ZmpnInsure++ will detect the maximm number of logical CPUs and instrument using n processes or the maximum number of processes if n is greater than the max.

Examples

For an Intel Core i7 quad-core CPU with Hyperthreading (8 logical CPUs):

  • /MP = 8 processes for instrumentation
  • -Zmp6 = 6 processes for instrumentation
  • -Zmp3 = 3 processes for instrumentation
  • /MP12 = 8 processes for instrumentation

Code Coverage Warnings

If your sources are on a network share and you use Insure++’s code coverage, multiple processes for instrumentation can cause problems when writing to the coverage file as a result of the inability to obtain a lock. If you experience coverage file corruption, you can either disable coverage, disable multiple processes, or use sources on a local drive.

If your sources are on a local drive and you still experience coverage file corruption, you can increase the number of retries for Insure++ to acquire a lock on the coverage file by using the uselockf configuration. See Configuration Options (psrc) for more information.

Precompiled Headers

Insure++ supports the use of precompiled headers. However, the nature of its support differs from Microsoft’s support. The most significant difference is that Insure++ requires that no tokens other than preprocessor directive tokens be placed before the header stop point in the primary source file. For example:

unsupported Stdafx.cpp: 
------------------------ 
int x;
#include "Stdafx.h" 
------------------------

To configure such a file to build with Insure++, move the int x declaration into the Stdafx.h header. Other conventions that Insure++ does not support include:

  • The /YX command line flag for automatic pch processing.
  • The use of #pragma hdrstop "filename".

Insure++ does support the use of #pragma hdrstop (without naming a pch file), as well as the naming of the header stop point using /Y[cu]<headername>.

If you want Insure++ to support your precompiled headers, we recommend that you have a single header contain everything to be precompiled. This header should be included at the top of every file that depends on the precompiled header.

If you want Insure++ to perform strict checking for the valid use of precompiled headers, use the psrc option pchcheck to enable this checking. By default, this strict checking is not performed.

Insure++ will alert you to unsupported pch configurations by reporting an error with the error code PCH_ERROR. If a project uses unsupported pch configurations, you will need to disable pch (to prevent the application from using pch) in order to build with Insure++. You can disable pch automatically with the psrc option pchdisable. However, some projects will not build–even without Insure++–if pch is disabled. In these cases, first fix the configurations to build without pch optimization. After they are fixed, try to build them with Insure++ again.

  • No labels