void rw_lock_print( /*==========*/ rw_lock_t* lock) /* in: rw-lock */ { rw_lock_debug_t* info; fprintf(stderr, "-------------\n" "RW-LATCH INFO\n" "RW-LATCH: %p ", (void*) lock); if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED) || (rw_lock_get_reader_count(lock) != 0) || (rw_lock_get_waiters(lock) != 0)) { if (rw_lock_get_waiters(lock)) { fputs(" Waiters for the lock exist\n", stderr); } else { putc('\n', stderr); } info = UT_LIST_GET_FIRST(lock->debug_list); while (info != NULL) { rw_lock_debug_print(info); info = UT_LIST_GET_NEXT(list, info); } } }
void rw_lock_print( /*==========*/ rw_lock_t* lock) /* in: rw-lock */ { #ifndef UNIV_SYNC_DEBUG printf( "Sorry, cannot give rw-lock info in non-debug version!\n"); #else ulint count = 0; rw_lock_debug_t* info; printf("-------------\n"); printf("RW-LATCH INFO\n"); printf("RW-LATCH: %lx ", (ulint)lock); if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED) || (rw_lock_get_reader_count(lock) != 0) || (rw_lock_get_waiters(lock) != 0)) { if (rw_lock_get_waiters(lock)) { printf(" Waiters for the lock exist\n"); } else { printf("\n"); } info = UT_LIST_GET_FIRST(lock->debug_list); while (info != NULL) { rw_lock_debug_print(info); info = UT_LIST_GET_NEXT(list, info); } } #endif }
/***************************************************************//** Prints debug info of currently locked rw-locks. */ UNIV_INTERN void rw_lock_list_print_info( /*====================*/ FILE* file) /*!< in: file where to print */ { rw_lock_t* lock; ulint count = 0; rw_lock_debug_t* info; mutex_enter(&rw_lock_list_mutex); fputs("-------------\n" "RW-LATCH INFO\n" "-------------\n", file); lock = UT_LIST_GET_FIRST(rw_lock_list); while (lock != NULL) { count++; #ifndef INNODB_RW_LOCKS_USE_ATOMICS mutex_enter(&(lock->mutex)); #endif if (lock->lock_word != X_LOCK_DECR) { fprintf(file, "RW-LOCK: %p ", (void*) lock); if (rw_lock_get_waiters(lock)) { fputs(" Waiters for the lock exist\n", file); } else { putc('\n', file); } rw_lock_debug_mutex_enter(); info = UT_LIST_GET_FIRST(lock->debug_list); while (info != NULL) { rw_lock_debug_print(file, info); info = UT_LIST_GET_NEXT(list, info); } rw_lock_debug_mutex_exit(); } #ifndef INNODB_RW_LOCKS_USE_ATOMICS mutex_exit(&(lock->mutex)); #endif lock = UT_LIST_GET_NEXT(list, lock); } fprintf(file, "Total number of rw-locks %ld\n", count); mutex_exit(&rw_lock_list_mutex); }
void rw_lock_list_print_info(void) /*=========================*/ { #ifndef UNIV_SYNC_DEBUG #else rw_lock_t* lock; ulint count = 0; rw_lock_debug_t* info; mutex_enter(&rw_lock_list_mutex); printf("-------------\n"); printf("RW-LATCH INFO\n"); printf("-------------\n"); lock = UT_LIST_GET_FIRST(rw_lock_list); while (lock != NULL) { count++; mutex_enter(&(lock->mutex)); if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED) || (rw_lock_get_reader_count(lock) != 0) || (rw_lock_get_waiters(lock) != 0)) { printf("RW-LOCK: %lx ", (ulint)lock); if (rw_lock_get_waiters(lock)) { printf(" Waiters for the lock exist\n"); } else { printf("\n"); } info = UT_LIST_GET_FIRST(lock->debug_list); while (info != NULL) { rw_lock_debug_print(info); info = UT_LIST_GET_NEXT(list, info); } } mutex_exit(&(lock->mutex)); lock = UT_LIST_GET_NEXT(list, lock); } printf("Total number of rw-locks %ld\n", count); mutex_exit(&rw_lock_list_mutex); #endif }
void rw_lock_list_print_info( /*====================*/ FILE* file) /* in: file where to print */ { rw_lock_t* lock; ulint count = 0; rw_lock_debug_t* info; mutex_enter(&rw_lock_list_mutex); fputs("-------------\n" "RW-LATCH INFO\n" "-------------\n", file); lock = UT_LIST_GET_FIRST(rw_lock_list); while (lock != NULL) { count++; mutex_enter(&(lock->mutex)); if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED) || (rw_lock_get_reader_count(lock) != 0) || (rw_lock_get_waiters(lock) != 0)) { fprintf(file, "RW-LOCK: %p ", (void*) lock); if (rw_lock_get_waiters(lock)) { fputs(" Waiters for the lock exist\n", file); } else { putc('\n', file); } info = UT_LIST_GET_FIRST(lock->debug_list); while (info != NULL) { rw_lock_debug_print(info); info = UT_LIST_GET_NEXT(list, info); } } mutex_exit(&(lock->mutex)); lock = UT_LIST_GET_NEXT(list, lock); } fprintf(file, "Total number of rw-locks %ld\n", count); mutex_exit(&rw_lock_list_mutex); }
/***************************************************************//** Prints debug info of an rw-lock. */ UNIV_INTERN void rw_lock_print( /*==========*/ rw_lock_t* lock) /*!< in: rw-lock */ { rw_lock_debug_t* info; fprintf(stderr, "-------------\n" "RW-LATCH INFO\n" "RW-LATCH: %p ", (void*) lock); #ifndef INNODB_RW_LOCKS_USE_ATOMICS /* We used to acquire lock->mutex here, but it would cause a recursive call to sync_thread_add_level() if UNIV_SYNC_DEBUG is defined. Since this function is only invoked from sync_thread_levels_g(), let us choose the smaller evil: performing dirty reads instead of causing bogus deadlocks or assertion failures. */ #endif if (lock->lock_word != X_LOCK_DECR) { if (rw_lock_get_waiters(lock)) { fputs(" Waiters for the lock exist\n", stderr); } else { putc('\n', stderr); } rw_lock_debug_mutex_enter(); info = UT_LIST_GET_FIRST(lock->debug_list); while (info != NULL) { rw_lock_debug_print(stderr, info); info = UT_LIST_GET_NEXT(list, info); } rw_lock_debug_mutex_exit(); } }