Maybe at the beginning of the function put "time (&start);" (if You use recursion put it before function) and after function put "time (&end);" (where time_t start,end;). Then use difftime.
Example here:
http://www.cplusplus.com/reference/clibrary/ctime/difftime
I didn't know this function. I knew that I needed sth connected with time so I went to cplusplus.com, found time.h library and after reading few functions' description I finally found what I was looking for. You also would be able to do that. 