Changeset 4587
- Timestamp:
- 11/05/08 15:36:57 (2 months ago)
- Files:
-
- trunk/configure.in (modified) (2 diffs)
- trunk/src/libstrongswan/Makefile.am (modified) (1 diff)
- trunk/src/libstrongswan/utils/mutex.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/configure.in
r4469 r4587 375 375 [if test x$enableval = xyes; then 376 376 leak_detective=true 377 fi] 378 ) 379 380 AC_ARG_ENABLE( 381 [lock-profiler], 382 AS_HELP_STRING([--enable-lock-profiling],[enable lock/mutex profiling code (default is NO).]), 383 [if test x$enableval = xyes; then 384 lock_profiler=true 377 385 fi] 378 386 ) … … 900 908 AM_CONDITIONAL(USE_CISCO_QUIRKS, test x$cisco_quirks = xtrue) 901 909 AM_CONDITIONAL(USE_LEAK_DETECTIVE, test x$leak_detective = xtrue) 910 AM_CONDITIONAL(USE_LOCK_PROFILER, test x$lock_profiler = xtrue) 902 911 AM_CONDITIONAL(USE_NAT_TRANSPORT, test x$nat_transport = xtrue) 903 912 AM_CONDITIONAL(USE_VENDORID, test x$vendor_id = xtrue) trunk/src/libstrongswan/Makefile.am
r4585 r4587 63 63 AM_CFLAGS += -DLEAK_DETECTIVE 64 64 libstrongswan_la_SOURCES += utils/leak_detective.c utils/leak_detective.h 65 endif 66 67 if USE_LOCK_PROFILER 68 AM_CFLAGS += -DLOCK_PROFILER 65 69 endif 66 70 trunk/src/libstrongswan/utils/mutex.c
r4585 r4587 28 28 #include <errno.h> 29 29 30 /** 31 * Do not report mutexes with an overall waiting time smaller than this (in us) 32 */ 33 #define PROFILE_TRESHHOLD 1000 30 34 31 35 typedef struct private_mutex_t private_mutex_t; … … 104 108 105 109 #ifdef LOCK_PROFILER 106 107 #include <execinfo.h>108 109 110 /** 110 111 * Print and cleanup mutex profiler … … 112 113 static void profiler_cleanup(private_mutex_t *this) 113 114 { 114 fprintf(stderr, "waited %d.%06ds in mutex, created at:", 115 this->waited.tv_sec, this->waited.tv_usec); 116 this->backtrace->log(this->backtrace, stderr); 115 if (this->waited.tv_sec > 0 || 116 this->waited.tv_usec > PROFILE_TRESHHOLD) 117 { 118 fprintf(stderr, "waited %d.%06ds in mutex, created at:", 119 this->waited.tv_sec, this->waited.tv_usec); 120 this->backtrace->log(this->backtrace, stderr); 121 } 117 122 this->backtrace->destroy(this->backtrace); 118 123 }
