From eb0e132bcc393e7672ff4188fcebef28a4821f35 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sat, 11 May 2019 20:57:18 +0200 Subject: [PATCH] [Timings] Move into new debug system. (#961) * [Timings] Move into new debug system. * [Timings] Remove newlines. --- configure.ac | 5 ----- include/timings.h | 2 -- meson.build | 1 - meson_options.txt | 1 - source/rofi.c | 5 ----- source/timings.c | 22 +++++++--------------- 6 files changed, 7 insertions(+), 29 deletions(-) diff --git a/configure.ac b/configure.ac index 01d2b494..155d65dc 100644 --- a/configure.ac +++ b/configure.ac @@ -85,11 +85,6 @@ dnl --------------------------------------------------------------------- AC_ARG_ENABLE([windowmode], AS_HELP_STRING([--disable-windowmode],[Disable window mode])) AS_IF([ test "x$enable_windowmode" != "xno"], [AC_DEFINE([WINDOW_MODE],[1],[Enable the window mode])]) -dnl --------------------------------------------------------------------- -dnl Output timing information -dnl --------------------------------------------------------------------- -AC_ARG_ENABLE([timings], AS_HELP_STRING([--enable-timings],[Enable timing output])) -AS_IF( [ test "x$enable_timings" = "xyes"], [AC_DEFINE([TIMINGS],[1], [Enable timings output])]) dnl --------------------------------------------------------------------- dnl Check for C functions. diff --git a/include/timings.h b/include/timings.h index c57f4e9b..055bb8f2 100644 --- a/include/timings.h +++ b/include/timings.h @@ -34,7 +34,6 @@ * @ingroup HELPERS * @{ */ -#ifdef TIMINGS /** * Init the timestamping mechanism . * implementation. @@ -93,6 +92,5 @@ void rofi_timings_quit ( void ); */ #define TICK_N( a ) -#endif // TIMINGS /*@}*/ #endif // ROFI_TIMINGS_H diff --git a/meson.build b/meson.build index cb350729..4364084a 100644 --- a/meson.build +++ b/meson.build @@ -85,7 +85,6 @@ header_conf.set('GLIB_VERSION_MAX_ALLOWED', '(G_ENCODE_VERSION(@0@,@1@))'.format header_conf.set('ENABLE_DRUN', get_option('drun')) header_conf.set('WINDOW_MODE', get_option('window')) -header_conf.set('TIMINGS', get_option('timings')) header_conf.set_quoted('MANPAGE_PATH', join_paths(get_option('prefix'), get_option('mandir'))) header_conf.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir'))) diff --git a/meson_options.txt b/meson_options.txt index a26d912b..08fb0de0 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,3 @@ option('drun', type: 'boolean', value: true, description: 'Desktop file mode') option('window', type: 'boolean', value: true, description: 'Window switcher mode') -option('timings', type: 'boolean', value: false, description: 'Timings output') option('check', type: 'feature', description: 'Build and run libcheck-based tests') diff --git a/source/rofi.c b/source/rofi.c index a05a9a73..650e788d 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -312,11 +312,6 @@ static void help ( G_GNUC_UNUSED int argc, char **argv ) #else printf ( "\t* drun %sdisabled%s\n", is_term ? color_red : "", is_term ? color_reset : "" ); #endif -#ifdef TIMINGS - printf ( "\t* timings %senabled%s\n", is_term ? color_green : "", is_term ? color_reset : "" ); -#else - printf ( "\t* timings %sdisabled%s\n", is_term ? color_red : "", is_term ? color_reset : "" ); -#endif #ifdef ENABLE_GCOV printf ( "\t* gcov %senabled%s\n", is_term ? color_green : "", is_term ? color_reset : "" ); #else diff --git a/source/timings.c b/source/timings.c index 4ad1c44e..4e4ba508 100644 --- a/source/timings.c +++ b/source/timings.c @@ -25,42 +25,34 @@ * */ +#define G_LOG_DOMAIN "Timings" + #include "config.h" #include #include "rofi.h" #include "timings.h" -#ifdef TIMINGS GTimer *global_timer = NULL; double global_timer_last = 0.0; -FILE *timing_log = NULL; void rofi_timings_init ( void ) { - timing_log = fopen ( "rofi-timing.log", "w" ); - if ( timing_log != NULL ) { - global_timer = g_timer_new (); - double now = g_timer_elapsed ( global_timer, NULL ); - fprintf ( timing_log, "%4.6f (%2.6f): Started\n", now, 0.0 ); - } + global_timer = g_timer_new (); + double now = g_timer_elapsed ( global_timer, NULL ); + g_debug ( "%4.6f (%2.6f): Started", now, 0.0 ); } void rofi_timings_tick ( const char *file, char const *str, int line, char const *msg ) { double now = g_timer_elapsed ( global_timer, NULL ); - fprintf ( timing_log, "%4.6f (%2.6f): %s:%s:%-3d %s\n", now, now - global_timer_last, file, str, line, msg ); + g_debug ( "%4.6f (%2.6f): %s:%s:%-3d %s", now, now - global_timer_last, file, str, line, msg ); global_timer_last = now; } void rofi_timings_quit ( void ) { - if ( timing_log ) { double now = g_timer_elapsed ( global_timer, NULL ); - fprintf ( timing_log, "%4.6f (%2.6f): Stopped\n", now, 0.0 ); + g_debug ( "%4.6f (%2.6f): Stopped", now, 0.0 ); g_timer_destroy ( global_timer ); - fclose ( timing_log ); - timing_log = NULL; - } } -#endif