Line Coverage

How Do IDetails

Feature Only in Professional and Enterprise Editions   Profiling is supported only in Visual C++ Professional and Enterprise Editions. For more information, see .

The Line Coverage option in the Profile dialog box profiles the current project, recording whether a line was executed.

Line coverage profiling is useful for determining which sections of your code are not being executed. The profiler lists all profiled lines, with an asterisk (*) marking those that were executed. The profiling overhead for line coverage is lower than for line counting, because the profiler needs to stop at a line only once. Here is a sample line coverage report:

  Line Covered  Source
-----------------------------------------------------
    1:          // waste.c
    2:         
    3:          #include <windows.h>
    4:         
    5:          void WasteTime(HANDLE hInstance, HWND hWnd)
    6:    *     {
    7:              LONG lCount, lX;
    8:              HCURSOR hOldCursor;
    9:    *         hOldCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
   10:    *         for(lCount = 0; lCount < 1000L; lCount++) {
   11:    *             lX = 57L;
   12:    *         }
   13:    *         if(lCount == 0) {
   14:    .             lCount = 1; // should never execute
   15:              }
   16:    *         SetCursor(hOldCursor);
   17:    *     }

Note   All included source lines are printed, even if they are not executed.

Line coverage profiling is much faster than line counting profiling because the profiler can remove the inserted breakpoints when those lines are first executed.