mirror of
https://github.com/lbonn/rofi
synced 2024-11-26 05:40:23 +00:00
[Timings] Move into new debug system. (#961)
* [Timings] Move into new debug system. * [Timings] Remove newlines.
This commit is contained in:
parent
871ea42785
commit
eb0e132bcc
6 changed files with 7 additions and 29 deletions
|
@ -85,11 +85,6 @@ dnl ---------------------------------------------------------------------
|
||||||
AC_ARG_ENABLE([windowmode], AS_HELP_STRING([--disable-windowmode],[Disable window mode]))
|
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])])
|
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 ---------------------------------------------------------------------
|
||||||
dnl Check for C functions.
|
dnl Check for C functions.
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
* @ingroup HELPERS
|
* @ingroup HELPERS
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifdef TIMINGS
|
|
||||||
/**
|
/**
|
||||||
* Init the timestamping mechanism .
|
* Init the timestamping mechanism .
|
||||||
* implementation.
|
* implementation.
|
||||||
|
@ -93,6 +92,5 @@ void rofi_timings_quit ( void );
|
||||||
*/
|
*/
|
||||||
#define TICK_N( a )
|
#define TICK_N( a )
|
||||||
|
|
||||||
#endif // TIMINGS
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
#endif // ROFI_TIMINGS_H
|
#endif // ROFI_TIMINGS_H
|
||||||
|
|
|
@ -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('ENABLE_DRUN', get_option('drun'))
|
||||||
header_conf.set('WINDOW_MODE', get_option('window'))
|
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('MANPAGE_PATH', join_paths(get_option('prefix'), get_option('mandir')))
|
||||||
header_conf.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir')))
|
header_conf.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir')))
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
option('drun', type: 'boolean', value: true, description: 'Desktop file mode')
|
option('drun', type: 'boolean', value: true, description: 'Desktop file mode')
|
||||||
option('window', type: 'boolean', value: true, description: 'Window switcher 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')
|
option('check', type: 'feature', description: 'Build and run libcheck-based tests')
|
||||||
|
|
|
@ -312,11 +312,6 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
|
||||||
#else
|
#else
|
||||||
printf ( "\t* drun %sdisabled%s\n", is_term ? color_red : "", is_term ? color_reset : "" );
|
printf ( "\t* drun %sdisabled%s\n", is_term ? color_red : "", is_term ? color_reset : "" );
|
||||||
#endif
|
#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
|
#ifdef ENABLE_GCOV
|
||||||
printf ( "\t* gcov %senabled%s\n", is_term ? color_green : "", is_term ? color_reset : "" );
|
printf ( "\t* gcov %senabled%s\n", is_term ? color_green : "", is_term ? color_reset : "" );
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -25,42 +25,34 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define G_LOG_DOMAIN "Timings"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
#include "timings.h"
|
#include "timings.h"
|
||||||
#ifdef TIMINGS
|
|
||||||
GTimer *global_timer = NULL;
|
GTimer *global_timer = NULL;
|
||||||
double global_timer_last = 0.0;
|
double global_timer_last = 0.0;
|
||||||
FILE *timing_log = NULL;
|
|
||||||
|
|
||||||
void rofi_timings_init ( void )
|
void rofi_timings_init ( void )
|
||||||
{
|
{
|
||||||
timing_log = fopen ( "rofi-timing.log", "w" );
|
global_timer = g_timer_new ();
|
||||||
if ( timing_log != NULL ) {
|
double now = g_timer_elapsed ( global_timer, NULL );
|
||||||
global_timer = g_timer_new ();
|
g_debug ( "%4.6f (%2.6f): Started", now, 0.0 );
|
||||||
double now = g_timer_elapsed ( global_timer, NULL );
|
|
||||||
fprintf ( timing_log, "%4.6f (%2.6f): Started\n", now, 0.0 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rofi_timings_tick ( const char *file, char const *str, int line, char const *msg )
|
void rofi_timings_tick ( const char *file, char const *str, int line, char const *msg )
|
||||||
{
|
{
|
||||||
double now = g_timer_elapsed ( global_timer, NULL );
|
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;
|
global_timer_last = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rofi_timings_quit ( void )
|
void rofi_timings_quit ( void )
|
||||||
{
|
{
|
||||||
if ( timing_log ) {
|
|
||||||
double now = g_timer_elapsed ( global_timer, NULL );
|
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 );
|
g_timer_destroy ( global_timer );
|
||||||
fclose ( timing_log );
|
|
||||||
timing_log = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in a new issue