Skip to content

Instantly share code, notes, and snippets.

@bricef
Created June 17, 2011 21:39
Show Gist options
  • Save bricef/1032415 to your computer and use it in GitHub Desktop.
Save bricef/1032415 to your computer and use it in GitHub Desktop.
Timing C Code with Glib
#include <glib.h>
// ...
{
GTimer* timeit = g_timer_new();
int i;
g_timer_start(timeit);
for ( i = 0 ; i < 10000 ; i++ ){
my_time_critical_function();
}
g_timer_stop(timeit);
printf("It took %f seconds\n", g_timer_elapsed(timeit, NULL));
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment