Hey,
I want to take some measures of performance, and I have issues to check the time taken between two steps.
This is the code I'm testing:
I get weird results... what am I doing wrong?
I want to take some measures of performance, and I have issues to check the time taken between two steps.
This is the code I'm testing:
Code:
#include <stdio.h>
#include <time.h>
void waitforkey(void)
{
while(1)
if (getchar())
break;
}
main()
{
clock_t t, tt;
t = clock();
printf("Press enter...");
waitforkey();
tt = clock();
printf("Starting time: %d\n", t);
printf("End time: %d\n", tt);
printf("It took %d cycles\n", tt - t);
return 0;
}
I get weird results... what am I doing wrong?