How to get the exact number of times that a function is executed in C++?
<pre><code>#include&lt;iostream&gt;
using namespace std;

void callMe()
{
    int count=0;
    cout&lt;&lt;"I am called "&lt;&lt;++count&lt;&lt;" times!\n";
}

int main()
{
    callMe();
    callMe();
    callMe();
    callMe();
    return 0;
}
</code></pre>

<p>In this case, the output will be</p>

<pre>
I am called 1 times!
I am called 1 times!
I am called 1 times!
I am called 1 times!
</pre>

<p>Instead, I want the output printed as</p>

<pre>
I am called 1 times!
I am called 2 times!
I am called 3 times!
I am called 4 times!
</pre>
