diff -ruN a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c --- a/innobase/buf/buf0buf.c 2008-11-12 09:25:58.000000000 +0900 +++ b/innobase/buf/buf0buf.c 2008-11-12 09:27:52.000000000 +0900 @@ -2472,13 +2472,15 @@ (ulong) UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped)); } fprintf(file, - "Buffer pool size %lu\n" - "Free buffers %lu\n" - "Database pages %lu\n" - "Modified db pages %lu\n" + "Buffer pool size %lu\n" + "Buffer pool size, bytes %lu\n" + "Free buffers %lu\n" + "Database pages %lu\n" + "Modified db pages %lu\n" "Pending reads %lu\n" "Pending writes: LRU %lu, flush list %lu, single page %lu\n", (ulong) size, + (ulong) size * UNIV_PAGE_SIZE, (ulong) UT_LIST_GET_LEN(buf_pool->free), (ulong) UT_LIST_GET_LEN(buf_pool->LRU), (ulong) UT_LIST_GET_LEN(buf_pool->flush_list), diff -ruN a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c --- a/innobase/fil/fil0fil.c 2008-11-12 09:26:07.000000000 +0900 +++ b/innobase/fil/fil0fil.c 2008-11-12 09:27:52.000000000 +0900 @@ -4472,3 +4472,30 @@ return(mach_read_from_2(page + FIL_PAGE_TYPE)); } + +/************************************************************************* +Return local hash table informations. */ + +ulint +fil_system_hash_cells(void) +/*=======================*/ +{ + if (fil_system) { + return (fil_system->spaces->n_cells + + fil_system->name_hash->n_cells); + } else { + return 0; + } +} + +ulint +fil_system_hash_nodes(void) +/*=======================*/ +{ + if (fil_system) { + return (UT_LIST_GET_LEN(fil_system->space_list) + * (sizeof(fil_space_t) + MEM_BLOCK_HEADER_SIZE)); + } else { + return 0; + } +} diff -ruN a/innobase/include/fil0fil.h b/innobase/include/fil0fil.h --- a/innobase/include/fil0fil.h 2008-11-12 09:26:07.000000000 +0900 +++ b/innobase/include/fil0fil.h 2008-11-12 09:27:52.000000000 +0900 @@ -701,6 +701,16 @@ written to page, the return value not defined */ byte* page); /* in: file page */ +/************************************************************************* +Return local hash table informations. */ + +ulint +fil_system_hash_cells(void); +/*========================*/ + +ulint +fil_system_hash_nodes(void); +/*========================*/ typedef struct fil_space_struct fil_space_t; diff -ruN a/innobase/include/thr0loc.h b/innobase/include/thr0loc.h --- a/innobase/include/thr0loc.h 2008-11-12 09:24:58.000000000 +0900 +++ b/innobase/include/thr0loc.h 2008-11-12 09:27:52.000000000 +0900 @@ -60,6 +60,17 @@ /*=============================*/ /* out: pointer to the in_ibuf field */ +/************************************************************************* +Return local hash table informations. */ + +ulint +thr_local_hash_cells(void); +/*=======================*/ + +ulint +thr_local_hash_nodes(void); +/*=======================*/ + #ifndef UNIV_NONINL #include "thr0loc.ic" #endif diff -ruN a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c --- a/innobase/srv/srv0srv.c 2008-11-12 09:26:07.000000000 +0900 +++ b/innobase/srv/srv0srv.c 2008-11-12 09:54:19.000000000 +0900 @@ -1675,6 +1675,14 @@ time_t current_time; ulint n_reserved; + ulint btr_search_sys_subtotal; + ulint lock_sys_subtotal; + ulint recv_sys_subtotal; + ulint io_counter_subtotal; + + ulint i; + trx_t* trx; + mutex_enter(&srv_innodb_monitor_mutex); current_time = time(NULL); @@ -1759,6 +1767,91 @@ ut_total_allocated_memory, mem_pool_get_reserved(mem_comm_pool)); + /* Calcurate reserved memories */ + if (btr_search_sys && btr_search_sys->hash_index->heap) { + btr_search_sys_subtotal = mem_heap_get_size(btr_search_sys->hash_index->heap); + } else { + btr_search_sys_subtotal = 0; + for (i=0; i < btr_search_sys->hash_index->n_mutexes; i++) { + btr_search_sys_subtotal += mem_heap_get_size(btr_search_sys->hash_index->heaps[i]); + } + } + + lock_sys_subtotal = 0; + if (trx_sys) { + mutex_enter(&kernel_mutex); + trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list); + while (trx) { + lock_sys_subtotal += ((trx->lock_heap) ? mem_heap_get_size(trx->lock_heap) : 0); + trx = UT_LIST_GET_NEXT(mysql_trx_list, trx); + } + mutex_exit(&kernel_mutex); + } + + recv_sys_subtotal = ((recv_sys && recv_sys->addr_hash) + ? mem_heap_get_size(recv_sys->heap) : 0); + + io_counter_subtotal = ((buf_pool->io_counter_heap) + ? mem_heap_get_size(buf_pool->io_counter_heap) : 0); + + fprintf(file, + "Internal hash tables (constant factor + variable factor)\n" + " Adaptive hash index %lu \t(%lu + %lu)\n" + " Page hash %lu\n" + " Dictionary cache %lu \t(%lu + %lu)\n" + " File system %lu \t(%lu + %lu)\n" + " Lock system %lu \t(%lu + %lu)\n" + " Recovery system %lu \t(%lu + %lu)\n" + " Threads %lu \t(%lu + %lu)\n" + " innodb_io_pattern %lu \t(%lu + %lu)\n", + + (ulong) (btr_search_sys + ? (btr_search_sys->hash_index->n_cells * sizeof(hash_cell_t)) : 0) + + btr_search_sys_subtotal, + (ulong) (btr_search_sys + ? (btr_search_sys->hash_index->n_cells * sizeof(hash_cell_t)) : 0), + (ulong) btr_search_sys_subtotal, + + (ulong) (buf_pool->page_hash->n_cells * sizeof(hash_cell_t)), + + (ulong) (dict_sys ? ((dict_sys->table_hash->n_cells + + dict_sys->table_id_hash->n_cells + + dict_sys->col_hash->n_cells) * sizeof(hash_cell_t) + + dict_sys->size) : 0), + (ulong) (dict_sys ? ((dict_sys->table_hash->n_cells + + dict_sys->table_id_hash->n_cells + + dict_sys->col_hash->n_cells) * sizeof(hash_cell_t)) : 0), + (ulong) (dict_sys ? (dict_sys->size) : 0), + + (ulong) (fil_system_hash_cells() * sizeof(hash_cell_t) + + fil_system_hash_nodes()), + (ulong) (fil_system_hash_cells() * sizeof(hash_cell_t)), + (ulong) fil_system_hash_nodes(), + + (ulong) ((lock_sys ? (lock_sys->rec_hash->n_cells * sizeof(hash_cell_t)) : 0) + + lock_sys_subtotal), + (ulong) (lock_sys ? (lock_sys->rec_hash->n_cells * sizeof(hash_cell_t)) : 0), + (ulong) lock_sys_subtotal, + + (ulong) (((recv_sys && recv_sys->addr_hash) + ? (recv_sys->addr_hash->n_cells * sizeof(hash_cell_t)) : 0) + + recv_sys_subtotal), + (ulong) ((recv_sys && recv_sys->addr_hash) + ? (recv_sys->addr_hash->n_cells * sizeof(hash_cell_t)) : 0), + (ulong) recv_sys_subtotal, + + (ulong) (thr_local_hash_cells() * sizeof(hash_cell_t) + + thr_local_hash_nodes()), + (ulong) (thr_local_hash_cells() * sizeof(hash_cell_t)), + (ulong) thr_local_hash_nodes(), + + (ulong) (((buf_pool->io_counter_hash) /* needs &(buf_pool->mutex) ? */ + ? (buf_pool->io_counter_hash->n_cells * sizeof(hash_cell_t)) : 0) + + io_counter_subtotal), + (ulong) ((buf_pool->io_counter_hash) /* needs &(buf_pool->mutex) ? */ + ? (buf_pool->io_counter_hash->n_cells * sizeof(hash_cell_t)) : 0), + (ulong) io_counter_subtotal); + if (srv_use_awe) { fprintf(file, "In addition to that %lu MB of AWE memory allocated\n", diff -ruN a/innobase/thr/thr0loc.c b/innobase/thr/thr0loc.c --- a/innobase/thr/thr0loc.c 2008-11-12 09:24:58.000000000 +0900 +++ b/innobase/thr/thr0loc.c 2008-11-12 09:27:52.000000000 +0900 @@ -32,6 +32,7 @@ /* The hash table. The module is not yet initialized when it is NULL. */ hash_table_t* thr_local_hash = NULL; +ulint thr_local_hash_n_nodes = 0; /* The private data for each thread should be put to the structure below and the accessor functions written @@ -178,6 +179,7 @@ HASH_INSERT(thr_local_t, hash, thr_local_hash, os_thread_pf(os_thread_get_curr_id()), local); + thr_local_hash_n_nodes++; mutex_exit(&thr_local_mutex); } @@ -206,6 +208,7 @@ HASH_DELETE(thr_local_t, hash, thr_local_hash, os_thread_pf(id), local); + thr_local_hash_n_nodes--; mutex_exit(&thr_local_mutex); @@ -229,3 +232,29 @@ mutex_create(&thr_local_mutex); mutex_set_level(&thr_local_mutex, SYNC_THR_LOCAL); } + +/************************************************************************* +Return local hash table informations. */ + +ulint +thr_local_hash_cells(void) +/*======================*/ +{ + if (thr_local_hash) { + return (thr_local_hash->n_cells); + } else { + return 0; + } +} + +ulint +thr_local_hash_nodes(void) +/*======================*/ +{ + if (thr_local_hash) { + return (thr_local_hash_n_nodes + * (sizeof(thr_local_t) + MEM_BLOCK_HEADER_SIZE)); + } else { + return 0; + } +} diff -ruN /dev/null b/patch_info/innodb_show_hashed_memory.info --- /dev/null 1970-01-01 09:00:00.000000000 +0900 +++ b/patch_info/innodb_show_hashed_memory.info 2008-11-12 09:27:52.000000000 +0900 @@ -0,0 +1,6 @@ +File=innodb_show_hashed_memory.patch +Name=Adds additional information of InnoDB internal hash table memories in SHOW INNODB STATUS +Version=1.0 +Author=Percona +License=GPL +Comment=