From e3ab39ea6f57975bd67179ec957ff0e559d71165 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 31 Oct 2016 08:07:02 +0100 Subject: [PATCH] add more details to timing log --- include/timings.h | 6 +++--- source/dialogs/drun.c | 4 ++++ source/timings.c | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/timings.h b/include/timings.h index 040840d4..fa9aaff8 100644 --- a/include/timings.h +++ b/include/timings.h @@ -20,7 +20,7 @@ void rofi_timings_init ( void ); * * 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 */ @@ -34,12 +34,12 @@ void rofi_timings_quit ( void ); /** * 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 * 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. */ diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index da0c3c26..6ab253b6 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -42,6 +42,7 @@ #include "rofi.h" #include "settings.h" #include "helper.h" +#include "timings.h" #include "widgets/textbox.h" #include "history.h" #include "dialogs/drun.h" @@ -418,6 +419,7 @@ static void get_apps_history ( DRunModePrivateData *pd ) static void get_apps ( DRunModePrivateData *pd ) { + TICK_N("Get Desktop apps (start)"); get_apps_history ( pd ); gchar *dir; @@ -425,6 +427,7 @@ static void get_apps ( DRunModePrivateData *pd ) dir = g_build_filename ( g_get_user_data_dir (), "applications", NULL ); walk_dir ( pd, dir, dir ); g_free ( dir ); + TICK_N("Get Desktop apps (user dir)"); // Then read thee system data dirs. const gchar * const * sys = g_get_system_data_dirs (); for (; *sys != NULL; ++sys ) { @@ -432,6 +435,7 @@ static void get_apps ( DRunModePrivateData *pd ) walk_dir ( pd, dir, dir ); g_free ( dir ); } + TICK_N("Get Desktop apps (system dirs)"); } static int drun_mode_init ( Mode *sw ) diff --git a/source/timings.c b/source/timings.c index beff465d..07130583 100644 --- a/source/timings.c +++ b/source/timings.c @@ -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 ); - 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; }