Skip to content

Instantly share code, notes, and snippets.

@benwills
Created December 29, 2014 16:38
Show Gist options
  • Select an option

  • Save benwills/cf3034890cfbdb7ef9d7 to your computer and use it in GitHub Desktop.

Select an option

Save benwills/cf3034890cfbdb7ef9d7 to your computer and use it in GitHub Desktop.
Simple Timer in C
int i;
float tStart, tDiff;
uint32_t runs = 1000;
tStart = (float)clock()/CLOCKS_PER_SEC;
for ( i=0; i<runs; ++i ) {
func();
}
tDiff = (float)clock()/CLOCKS_PER_SEC - tStart;
printf( "Time: %f\n", tDiff );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment