32 GTimer *global_timer = NULL;
33 double global_timer_last = 0.0;
34 FILE *timing_log = NULL;
36 void rofi_timings_init (
void )
38 timing_log = fopen (
"rofi-timing.log",
"w" );
39 if ( timing_log != NULL ) {
40 global_timer = g_timer_new ();
41 double now = g_timer_elapsed ( global_timer, NULL );
42 fprintf ( timing_log,
"%4.6f (%2.6f): Started\n", now, 0.0 );
46 void rofi_timings_tick (
const char *file,
char const *str,
int line,
char const *msg )
48 double now = g_timer_elapsed ( global_timer, NULL );
50 fprintf ( timing_log,
"%4.6f (%2.6f): %s:%s:%-3d %s\n", now, now - global_timer_last, file, str, line, msg );
51 global_timer_last = now;
54 void rofi_timings_quit (
void )
57 double now = g_timer_elapsed ( global_timer, NULL );
58 fprintf ( timing_log,
"%4.6f (%2.6f): Stopped\n", now, 0.0 );
59 g_timer_destroy ( global_timer );
60 fclose ( timing_log );