]> git.pld-linux.org Git - packages/mysql.git/blob - mysql-innodb_show_hashed_memory.patch
- expire-logs-days sample
[packages/mysql.git] / mysql-innodb_show_hashed_memory.patch
1 diff -ruN mysql-5.0.67_highperf/innobase/buf/buf0buf.c mysql-5.0.67_highperf_tmp/innobase/buf/buf0buf.c
2 --- mysql-5.0.67_highperf/innobase/buf/buf0buf.c        2008-11-12 09:25:58.000000000 +0900
3 +++ mysql-5.0.67_highperf_tmp/innobase/buf/buf0buf.c    2008-11-12 09:27:52.000000000 +0900
4 @@ -2454,13 +2454,15 @@
5                                 (ulong) UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
6         }
7         fprintf(file,
8 -               "Buffer pool size   %lu\n"
9 -               "Free buffers       %lu\n"
10 -               "Database pages     %lu\n"
11 -               "Modified db pages  %lu\n"
12 +               "Buffer pool size        %lu\n"
13 +               "Buffer pool size, bytes %lu\n"
14 +               "Free buffers            %lu\n"
15 +               "Database pages          %lu\n"
16 +               "Modified db pages       %lu\n"
17                 "Pending reads %lu\n"
18                 "Pending writes: LRU %lu, flush list %lu, single page %lu\n",
19                 (ulong) size,
20 +               (ulong) size * UNIV_PAGE_SIZE,
21                 (ulong) UT_LIST_GET_LEN(buf_pool->free),
22                 (ulong) UT_LIST_GET_LEN(buf_pool->LRU),
23                 (ulong) UT_LIST_GET_LEN(buf_pool->flush_list),
24 diff -ruN mysql-5.0.67_highperf/innobase/fil/fil0fil.c mysql-5.0.67_highperf_tmp/innobase/fil/fil0fil.c
25 --- mysql-5.0.67_highperf/innobase/fil/fil0fil.c        2008-11-12 09:26:07.000000000 +0900
26 +++ mysql-5.0.67_highperf_tmp/innobase/fil/fil0fil.c    2008-11-12 09:27:52.000000000 +0900
27 @@ -4472,3 +4472,30 @@
28  
29         return(mach_read_from_2(page + FIL_PAGE_TYPE));
30  }
31 +
32 +/*************************************************************************
33 +Return local hash table informations. */
34 +
35 +ulint
36 +fil_system_hash_cells(void)
37 +/*=======================*/
38 +{
39 +       if (fil_system) {
40 +               return (fil_system->spaces->n_cells
41 +                       + fil_system->name_hash->n_cells);
42 +       } else {
43 +               return 0;
44 +       }
45 +}
46 +
47 +ulint
48 +fil_system_hash_nodes(void)
49 +/*=======================*/
50 +{
51 +       if (fil_system) {
52 +               return (UT_LIST_GET_LEN(fil_system->space_list)
53 +                       * (sizeof(fil_space_t) + MEM_BLOCK_HEADER_SIZE));
54 +       } else {
55 +               return 0;
56 +       }
57 +}
58 diff -ruN mysql-5.0.67_highperf/innobase/include/fil0fil.h mysql-5.0.67_highperf_tmp/innobase/include/fil0fil.h
59 --- mysql-5.0.67_highperf/innobase/include/fil0fil.h    2008-11-12 09:26:07.000000000 +0900
60 +++ mysql-5.0.67_highperf_tmp/innobase/include/fil0fil.h        2008-11-12 09:27:52.000000000 +0900
61 @@ -701,6 +701,16 @@
62                         written to page, the return value not defined */
63         byte*   page);  /* in: file page */
64  
65 +/*************************************************************************
66 +Return local hash table informations. */
67 +
68 +ulint
69 +fil_system_hash_cells(void);
70 +/*========================*/
71 +
72 +ulint
73 +fil_system_hash_nodes(void);
74 +/*========================*/
75  
76  typedef        struct fil_space_struct fil_space_t;
77  
78 diff -ruN mysql-5.0.67_highperf/innobase/include/thr0loc.h mysql-5.0.67_highperf_tmp/innobase/include/thr0loc.h
79 --- mysql-5.0.67_highperf/innobase/include/thr0loc.h    2008-11-12 09:24:58.000000000 +0900
80 +++ mysql-5.0.67_highperf_tmp/innobase/include/thr0loc.h        2008-11-12 09:27:52.000000000 +0900
81 @@ -77,6 +77,17 @@
82  /*=============================*/
83                         /* out: pointer to the in_ibuf field */
84  
85 +/*************************************************************************
86 +Return local hash table informations. */
87 +
88 +ulint
89 +thr_local_hash_cells(void);
90 +/*=======================*/
91 +
92 +ulint
93 +thr_local_hash_nodes(void);
94 +/*=======================*/
95 +
96  #ifndef UNIV_NONINL
97  #include "thr0loc.ic"
98  #endif
99 diff -ruN mysql-5.0.67_highperf/innobase/srv/srv0srv.c mysql-5.0.67_highperf_tmp/innobase/srv/srv0srv.c
100 --- mysql-5.0.67_highperf/innobase/srv/srv0srv.c        2008-11-12 09:26:07.000000000 +0900
101 +++ mysql-5.0.67_highperf_tmp/innobase/srv/srv0srv.c    2008-11-12 09:54:19.000000000 +0900
102 @@ -1645,6 +1645,14 @@
103         time_t  current_time;
104         ulint   n_reserved;
105  
106 +       ulint   btr_search_sys_subtotal;
107 +       ulint   lock_sys_subtotal;
108 +       ulint   recv_sys_subtotal;
109 +       ulint   io_counter_subtotal;
110 +
111 +       ulint   i;
112 +       trx_t*  trx;
113 +
114         mutex_enter(&srv_innodb_monitor_mutex);
115  
116         current_time = time(NULL);
117 @@ -1747,6 +1755,91 @@
118                                 ut_total_allocated_memory,
119                                 mem_pool_get_reserved(mem_comm_pool));
120  
121 +       /* Calcurate reserved memories */
122 +       if (btr_search_sys && btr_search_sys->hash_index->heap) {
123 +               btr_search_sys_subtotal = mem_heap_get_size(btr_search_sys->hash_index->heap);
124 +       } else {
125 +               btr_search_sys_subtotal = 0;
126 +               for (i=0; i < btr_search_sys->hash_index->n_mutexes; i++) {
127 +                       btr_search_sys_subtotal += mem_heap_get_size(btr_search_sys->hash_index->heaps[i]);
128 +               }
129 +       }
130 +
131 +       lock_sys_subtotal = 0;
132 +       if (trx_sys) {
133 +       mutex_enter(&kernel_mutex);
134 +       trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list);
135 +       while (trx) {
136 +               lock_sys_subtotal += ((trx->lock_heap) ? mem_heap_get_size(trx->lock_heap) : 0);
137 +               trx = UT_LIST_GET_NEXT(mysql_trx_list, trx);
138 +       }
139 +       mutex_exit(&kernel_mutex);
140 +       }
141 +
142 +       recv_sys_subtotal = ((recv_sys && recv_sys->addr_hash)
143 +                            ? mem_heap_get_size(recv_sys->heap) : 0);
144 +
145 +       io_counter_subtotal = ((buf_pool->io_counter_heap)
146 +                              ? mem_heap_get_size(buf_pool->io_counter_heap) : 0);
147 +
148 +       fprintf(file,
149 +       "Internal hash tables (constant factor + variable factor)\n"
150 +       "    Adaptive hash index %lu \t(%lu + %lu)\n"
151 +       "    Page hash           %lu\n"
152 +       "    Dictionary cache    %lu \t(%lu + %lu)\n"
153 +       "    File system         %lu \t(%lu + %lu)\n"
154 +       "    Lock system         %lu \t(%lu + %lu)\n"
155 +       "    Recovery system     %lu \t(%lu + %lu)\n"
156 +       "    Threads             %lu \t(%lu + %lu)\n"
157 +       "    innodb_io_pattern   %lu \t(%lu + %lu)\n",
158 +
159 +               (ulong) (btr_search_sys
160 +                        ? (btr_search_sys->hash_index->n_cells * sizeof(hash_cell_t)) : 0)
161 +                       + btr_search_sys_subtotal,
162 +               (ulong) (btr_search_sys
163 +                        ? (btr_search_sys->hash_index->n_cells * sizeof(hash_cell_t)) : 0),
164 +               (ulong) btr_search_sys_subtotal,
165 +
166 +               (ulong) (buf_pool->page_hash->n_cells * sizeof(hash_cell_t)),
167 +
168 +               (ulong) (dict_sys ? ((dict_sys->table_hash->n_cells
169 +                         + dict_sys->table_id_hash->n_cells
170 +                         + dict_sys->col_hash->n_cells) * sizeof(hash_cell_t)
171 +                        + dict_sys->size) : 0),
172 +               (ulong) (dict_sys ? ((dict_sys->table_hash->n_cells
173 +                         + dict_sys->table_id_hash->n_cells
174 +                         + dict_sys->col_hash->n_cells) * sizeof(hash_cell_t)) : 0),
175 +               (ulong) (dict_sys ? (dict_sys->size) : 0),
176 +
177 +               (ulong) (fil_system_hash_cells() * sizeof(hash_cell_t)
178 +                        + fil_system_hash_nodes()),
179 +               (ulong) (fil_system_hash_cells() * sizeof(hash_cell_t)),
180 +               (ulong) fil_system_hash_nodes(),
181 +
182 +               (ulong) ((lock_sys ? (lock_sys->rec_hash->n_cells * sizeof(hash_cell_t)) : 0)
183 +                        + lock_sys_subtotal),
184 +               (ulong) (lock_sys ? (lock_sys->rec_hash->n_cells * sizeof(hash_cell_t)) : 0),
185 +               (ulong) lock_sys_subtotal,
186 +
187 +               (ulong) (((recv_sys && recv_sys->addr_hash)
188 +                         ? (recv_sys->addr_hash->n_cells * sizeof(hash_cell_t)) : 0)
189 +                        + recv_sys_subtotal),
190 +               (ulong) ((recv_sys && recv_sys->addr_hash)
191 +                        ? (recv_sys->addr_hash->n_cells * sizeof(hash_cell_t)) : 0),
192 +               (ulong) recv_sys_subtotal,
193 +
194 +               (ulong) (thr_local_hash_cells() * sizeof(hash_cell_t)
195 +                        + thr_local_hash_nodes()),
196 +               (ulong) (thr_local_hash_cells() * sizeof(hash_cell_t)),
197 +               (ulong) thr_local_hash_nodes(),
198 +
199 +               (ulong) (((buf_pool->io_counter_hash) /* needs &(buf_pool->mutex) ? */
200 +                         ? (buf_pool->io_counter_hash->n_cells * sizeof(hash_cell_t)) : 0)
201 +                        + io_counter_subtotal),
202 +               (ulong) ((buf_pool->io_counter_hash) /* needs &(buf_pool->mutex) ? */
203 +                        ? (buf_pool->io_counter_hash->n_cells * sizeof(hash_cell_t)) : 0),
204 +               (ulong) io_counter_subtotal);
205 +
206         if (srv_use_awe) {
207                 fprintf(file,
208         "In addition to that %lu MB of AWE memory allocated\n",
209 diff -ruN mysql-5.0.67_highperf/innobase/thr/thr0loc.c mysql-5.0.67_highperf_tmp/innobase/thr/thr0loc.c
210 --- mysql-5.0.67_highperf/innobase/thr/thr0loc.c        2008-11-12 09:24:58.000000000 +0900
211 +++ mysql-5.0.67_highperf_tmp/innobase/thr/thr0loc.c    2008-11-12 09:27:52.000000000 +0900
212 @@ -32,6 +32,7 @@
213  
214  /* The hash table. The module is not yet initialized when it is NULL. */
215  hash_table_t*  thr_local_hash  = NULL;
216 +ulint          thr_local_hash_n_nodes = 0;
217  
218  /* The private data for each thread should be put to
219  the structure below and the accessor functions written
220 @@ -223,6 +224,7 @@
221         HASH_INSERT(thr_local_t, hash, thr_local_hash,
222                         os_thread_pf(os_thread_get_curr_id()),
223                         local);
224 +       thr_local_hash_n_nodes++;
225                                 
226         mutex_exit(&thr_local_mutex);
227  }
228 @@ -251,6 +253,7 @@
229                                                 
230         HASH_DELETE(thr_local_t, hash, thr_local_hash,
231                                 os_thread_pf(id), local);
232 +       thr_local_hash_n_nodes--;
233  
234         mutex_exit(&thr_local_mutex);
235                                 
236 @@ -274,3 +277,29 @@
237         mutex_create(&thr_local_mutex);
238         mutex_set_level(&thr_local_mutex, SYNC_THR_LOCAL);
239  }
240 +
241 +/*************************************************************************
242 +Return local hash table informations. */
243 +
244 +ulint
245 +thr_local_hash_cells(void)
246 +/*======================*/
247 +{
248 +       if (thr_local_hash) {
249 +               return (thr_local_hash->n_cells);
250 +       } else {
251 +               return 0;
252 +       }
253 +}
254 +
255 +ulint
256 +thr_local_hash_nodes(void)
257 +/*======================*/
258 +{
259 +       if (thr_local_hash) {
260 +               return (thr_local_hash_n_nodes
261 +                       * (sizeof(thr_local_t) + MEM_BLOCK_HEADER_SIZE));
262 +       } else {
263 +               return 0;
264 +       }
265 +}
266 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
267 --- /dev/null   1970-01-01 09:00:00.000000000 +0900
268 +++ mysql-5.0.67_highperf_tmp/patch_info/innodb_show_hashed_memory.info 2008-11-12 09:27:52.000000000 +0900
269 @@ -0,0 +1,6 @@
270 +File=innodb_show_hashed_memory.patch
271 +Name=Adds additional information of InnoDB internal hash table memories in SHOW INNODB STATUS
272 +Version=1.0
273 +Author=Percona <info@percona.com>
274 +License=GPL
275 +Comment=
This page took 0.044705 seconds and 3 git commands to generate.