Find the number of times some functions are called in C++?
<p>I'm trying to find the number of times some functions are called in my code. Here's a big overview:</p>

<pre><code>void entryFunction(){
    bool use64bit = true
    ...some calculation to determine how many bits to use
    if (use64bit){
        countThisFunction64();
    }
    else{
        countThisFunction256();
    }
}
</code></pre>

<p>In the above example, I want to count the number of times "countThisFunction64()" and "countThisFunction256()" are called. "EntryFunction()" itself is called from another source file, so using static globals are not my first preference. I'll make changes to use static call counters only as my last option.</p>

<p>I'm more interested in knowing if there is an elegant way to do this? I have only cursory knowledge of how profilers and debuggers work, certainly not enough to hack/implement one without help. I'm using VS with the MSVC++ compiler, so my executable can be built with debugging symbols. I'm wondering if I can run my executable as usual, attach a debugger or run a profiling tool or something else to get the call counts alone out. I know profiling tools report how many times a function was called, so it's certainly possible to do it. Can somebody tell me the easiest way for me to do this? Maybe Visual Studio itself has some tools I don't know about? </p>