/fastcap - Enable fastcap profiling (Windows CE 5.0)

Windows CE 5.0
Send Feedback

This option causes the compiler to insert calls to profiling hooks around each function call. This form of profiling provides more detail than the /callcap -Enable callcap profiling form of profiling but introduces more overhead.

Note   The fastcap switch is not supported on x86 microprocessors.

Note that you must compile profiling hook functions without the fastcap switch. If you compile the profiling hooks with the fastcap switch, the functions will perform infinite recursive calls to themselves.

The following code example, fastcap.c, shows a profiling hook function, _CAP_Start_Profiling, for compilation without fastcap. The compiler inserts calls to this profiling hook when you compile the subsequent routine, main.c, with the fastcap switch.

#include <stdio.h>
void _stdcall _CAP_Start_Profiling(void *CurrentProcAddr, void *TargetProcAddr)
    printf("Calling %s (at address %p) at tick %d\n", 
        TargetProcAddr == printf? "printf":"function", TargetProcAddr, 

void _stdcall _CAP_End_Profiling(void *CurrentProcAddr)
    printf("Left function at tick %d\n", GetTickCount());

The next example shows how the compiler inserts calls to the profiling hooks from main.c. Compile main with the fastcap switch, and link with fastcap.obj that you compiled without the fastcap switch in the preceding example.

#include <stdio.h>
int main()
    char str[] = "\nA very, very, very, very, very long Hello World string";

    // The profiling hook, _CAP_Start_Profiling function,
    // is called here, instead of inside the printf function.
    // This makes it possible to profile a precompiled library function.

    printf("%s %s %s %s %s \n\n", str, str, str, str, str);

    // The profiling hook, _CAP_End_Profiling function, is called here,
    // after the function printf returns.

    return 0;

The fastcap switch inserts calls to profiling hooks before calling the function and after the call return. In contrast, callcap inserts calls to profiling hooks after entering the function and again before leaving it.

If you use the fastcap option when compiling for the SH4 processor, the compiler adds a call to fastcap for every function call in every inline assembly statement and __asm call that you have in your code. This causes the compiler to terminate with the message "Unresolved external symbol _asm."

You can avoid this by moving the inline assembly code into a separate module and recompiling the module without fastcap.

See Also

Compiler Options | /callcap -Enable callcap profiling

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.