[Timings] Move into new debug system. (#961)

* [Timings] Move into new debug system.

* [Timings] Remove newlines.
This commit is contained in:
Dave Davenport 2019-05-11 20:57:18 +02:00 committed by GitHub
parent 871ea42785
commit eb0e132bcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 29 deletions

View File

@ -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.

View File

@ -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

View File

@ -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')))

View File

@ -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')

View File

@ -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

View File

@ -25,42 +25,34 @@
*
*/
#define G_LOG_DOMAIN "Timings"
#include "config.h"
#include <stdio.h>
#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