1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
diff -ruN mysql-5.0.67_highperf/innobase/buf/buf0buf.c mysql-5.0.67_highperf_tmp/innobase/buf/buf0buf.c
--- mysql-5.0.67_highperf/innobase/buf/buf0buf.c 2008-11-12 09:25:58.000000000 +0900
+++ mysql-5.0.67_highperf_tmp/innobase/buf/buf0buf.c 2008-11-12 09:27:52.000000000 +0900
@@ -2454,13 +2454,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 mysql-5.0.67_highperf/innobase/fil/fil0fil.c mysql-5.0.67_highperf_tmp/innobase/fil/fil0fil.c
--- mysql-5.0.67_highperf/innobase/fil/fil0fil.c 2008-11-12 09:26:07.000000000 +0900
+++ mysql-5.0.67_highperf_tmp/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 mysql-5.0.67_highperf/innobase/include/fil0fil.h mysql-5.0.67_highperf_tmp/innobase/include/fil0fil.h
--- mysql-5.0.67_highperf/innobase/include/fil0fil.h 2008-11-12 09:26:07.000000000 +0900
+++ mysql-5.0.67_highperf_tmp/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 mysql-5.0.67_highperf/innobase/include/thr0loc.h mysql-5.0.67_highperf_tmp/innobase/include/thr0loc.h
--- mysql-5.0.67_highperf/innobase/include/thr0loc.h 2008-11-12 09:24:58.000000000 +0900
+++ mysql-5.0.67_highperf_tmp/innobase/include/thr0loc.h 2008-11-12 09:27:52.000000000 +0900
@@ -77,6 +77,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 mysql-5.0.67_highperf/innobase/srv/srv0srv.c mysql-5.0.67_highperf_tmp/innobase/srv/srv0srv.c
--- mysql-5.0.67_highperf/innobase/srv/srv0srv.c 2008-11-12 09:26:07.000000000 +0900
+++ mysql-5.0.67_highperf_tmp/innobase/srv/srv0srv.c 2008-11-12 09:54:19.000000000 +0900
@@ -1645,6 +1645,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);
@@ -1747,6 +1755,80 @@
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);
+
+ 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",
+
+ (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());
+
if (srv_use_awe) {
fprintf(file,
"In addition to that %lu MB of AWE memory allocated\n",
diff -ruN mysql-5.0.67_highperf/innobase/thr/thr0loc.c mysql-5.0.67_highperf_tmp/innobase/thr/thr0loc.c
--- mysql-5.0.67_highperf/innobase/thr/thr0loc.c 2008-11-12 09:24:58.000000000 +0900
+++ mysql-5.0.67_highperf_tmp/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
@@ -223,6 +224,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);
}
@@ -251,6 +253,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);
@@ -274,3 +277,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 mysql-5.0.67_highperf/patch_info/innodb_show_hashed_memory.info mysql-5.0.67_highperf_tmp/patch_info/innodb_show_hashed_memory.info
--- /dev/null 1970-01-01 09:00:00.000000000 +0900
+++ mysql-5.0.67_highperf_tmp/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 <info@percona.com>
+License=GPL
+Comment=
|