I want to know the exact time consumed by a certain function running on iPad. For some reason I can't connect the iPad to the macbook while running the application (the USB is occupied by other device).
I had tried using clock(), like this
clock_t start = clock();
/* Do something here */
double executionTime = (double)(clock()-start) / CLOCKS_PER_SEC;
I have no idea why the value of executionTime will be 0. The difference of start time and end time is something like 1,000,000,000 (Calculated by myself). However I can't get the correct CLOCKS_PER_SEC(it changes every time), so I have no idea what the meaning of that number.
I read the post "ctime on iOS device not measuring time properly", but it does not help. Is there any way to fix the CLOCKS_PER_SEC? Or there's other way to measure the time.
Thank you
The value of CLK_TCK is 1,000,000. The whole program finishes with 5 seconds.