I am running cygwin on windows and using latest version of gprof for profiling my code. My problem is that the flat profile shows zero sec for each of the functions in my code, I even tried to loop the functions(tried a for loop for a million) but gprof is unable to accumulate any time .Please help . Here is one of my sample function.
bool is_adjacent(const char* a ,const char* b)
{
for(long long iter=0;iter<=1000000;iter++){
string line1="qwertyuiop";
string line2="asdfghjkl";
string line3="zxcvbnm";
string line4="1234567890";
int pos=line1.find(*a);
if(pos!=string::npos){
if ((line1[pos++]==*b)||((pos!=0)&&(line1[pos--]==*b)))
return true;
else return false;}
pos=line2.find(*a);
if(pos!=string::npos){
if ((line2[pos++]==*b)||((pos!=0)&&(line2[pos--]==*b)))
return true;
else return false;}
pos=line3.find(*a);
if(pos!=string::npos){
if ((line3[pos++]==*b)||((pos!=0)&&(line3[pos--]==*b)))
return true;
else return false;}
pos=line4.find(*a);
if(pos!=string::npos){
if ((line4[pos++]==*b)||((pos!=0)&&(line4[pos--]==*b)))
return true;
else return false;}
}
}