1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

add more details to timing log

This commit is contained in:
Dave Davenport 2016-10-31 08:07:02 +01:00
parent f5f4f52957
commit e3ab39ea6f
3 changed files with 9 additions and 5 deletions

View file

@ -20,7 +20,7 @@ void rofi_timings_init ( void );
* *
* Report a tick. * Report a tick.
*/ */
void rofi_timings_tick ( char const *str, int line, char const *msg ); void rofi_timings_tick ( const char *file, char const *str, int line, char const *msg );
/** /**
* Stop the timestamping mechanism * Stop the timestamping mechanism
*/ */
@ -34,12 +34,12 @@ void rofi_timings_quit ( void );
/** /**
* Report current time since TIMINGS_START * Report current time since TIMINGS_START
*/ */
#define TICK() rofi_timings_tick ( __func__, __LINE__, "" ) #define TICK() rofi_timings_tick ( __FILE__, __func__, __LINE__, "" )
/** /**
* @param a an string * @param a an string
* Report current time since TIMINGS_START * Report current time since TIMINGS_START
*/ */
#define TICK_N( a ) rofi_timings_tick ( __func__, __LINE__, a ) #define TICK_N( a ) rofi_timings_tick ( __FILE__, __func__, __LINE__, a )
/** /**
* Stop timestamping mechanism. * Stop timestamping mechanism.
*/ */

View file

@ -42,6 +42,7 @@
#include "rofi.h" #include "rofi.h"
#include "settings.h" #include "settings.h"
#include "helper.h" #include "helper.h"
#include "timings.h"
#include "widgets/textbox.h" #include "widgets/textbox.h"
#include "history.h" #include "history.h"
#include "dialogs/drun.h" #include "dialogs/drun.h"
@ -418,6 +419,7 @@ static void get_apps_history ( DRunModePrivateData *pd )
static void get_apps ( DRunModePrivateData *pd ) static void get_apps ( DRunModePrivateData *pd )
{ {
TICK_N("Get Desktop apps (start)");
get_apps_history ( pd ); get_apps_history ( pd );
gchar *dir; gchar *dir;
@ -425,6 +427,7 @@ static void get_apps ( DRunModePrivateData *pd )
dir = g_build_filename ( g_get_user_data_dir (), "applications", NULL ); dir = g_build_filename ( g_get_user_data_dir (), "applications", NULL );
walk_dir ( pd, dir, dir ); walk_dir ( pd, dir, dir );
g_free ( dir ); g_free ( dir );
TICK_N("Get Desktop apps (user dir)");
// Then read thee system data dirs. // Then read thee system data dirs.
const gchar * const * sys = g_get_system_data_dirs (); const gchar * const * sys = g_get_system_data_dirs ();
for (; *sys != NULL; ++sys ) { for (; *sys != NULL; ++sys ) {
@ -432,6 +435,7 @@ static void get_apps ( DRunModePrivateData *pd )
walk_dir ( pd, dir, dir ); walk_dir ( pd, dir, dir );
g_free ( dir ); g_free ( dir );
} }
TICK_N("Get Desktop apps (system dirs)");
} }
static int drun_mode_init ( Mode *sw ) static int drun_mode_init ( Mode *sw )

View file

@ -41,11 +41,11 @@ void rofi_timings_init ( void )
} }
} }
void rofi_timings_tick ( 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:%-3d %s\n", now, now - global_timer_last, str, line, msg ); fprintf ( timing_log, "%4.6f (%2.6f): %s:%s:%-3d %s\n", now, now - global_timer_last, file, str, line, msg );
global_timer_last = now; global_timer_last = now;
} }