diff options
Diffstat (limited to 'src/util/profile/prof_file.c')
-rw-r--r-- | src/util/profile/prof_file.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c index f47e540..0282537 100644 --- a/src/util/profile/prof_file.c +++ b/src/util/profile/prof_file.c @@ -66,6 +66,8 @@ void profile_library_finalizer(void) static void profile_free_file_data(prf_data_t); +#if 0 + #define scan_shared_trees_locked() \ { \ prf_data_t d; \ @@ -89,6 +91,13 @@ static void profile_free_file_data(prf_data_t); k5_mutex_unlock(&g_shared_trees_mutex); \ } +#else + +#define scan_shared_trees_locked() { ; } +#define scan_shared_trees_unlocked() { ; } + +#endif + static int rw_access(const_profile_filespec_t filespec) { #ifdef HAVE_ACCESS @@ -295,6 +304,9 @@ errcode_t profile_update_file_data(prf_data_t data) errcode_t retval; #ifdef HAVE_STAT struct stat st; +#ifdef STAT_ONCE_PER_SECOND + time_t now; +#endif #endif FILE *f; @@ -303,11 +315,21 @@ errcode_t profile_update_file_data(prf_data_t data) return retval; #ifdef HAVE_STAT +#ifdef STAT_ONCE_PER_SECOND + now = time(0); + if (now == data->last_stat) { + k5_mutex_unlock(&data->lock); + return 0; + } +#endif if (stat(data->filespec, &st)) { retval = errno; k5_mutex_unlock(&data->lock); return retval; } +#ifdef STAT_ONCE_PER_SECOND + data->last_stat = now; +#endif if (st.st_mtime == data->timestamp) { k5_mutex_unlock(&data->lock); return 0; |