Debian Codegraph @

docs/api_reference/C/mempstat.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>DB_ENV-&gt;memp_stat()</title>
7 <link rel="stylesheet" href="apiReference.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB C API Reference" />
10 <link rel="up" href="memp.html" title="Chapter 8.  The DB_MPOOLFILE Handle" />
11 <link rel="prev" href="mempregister.html" title="DB_ENV-&gt;memp_register()" />
12 <link rel="next" href="mempstat_print.html" title="DB_ENV-&gt;memp_stat_print()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DB_ENV-&gt;memp_stat()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="mempregister.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 8. 
26 The DB_MPOOLFILE Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="mempstat_print.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="mempstat"></a>DB_ENV-&gt;memp_stat()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;memp_stat(DB_ENV *env, DB_MPOOL_STAT **gsp,
45 DB_MPOOL_FSTAT *(*fsp)[], u_int32_t flags); </pre>
46 <p>
47 The <code class="methodname">DB_ENV-&gt;memp_stat()</code> method returns the memory pool (that is, the
48 buffer cache) subsystem statistics.
49 </p>
50 <p>
51 The <code class="methodname">DB_ENV-&gt;memp_stat()</code> method creates statistical structures of
52 type <code class="literal">DB_MPOOL_STAT</code> and <code class="literal">DB_MPOOL_FSTAT</code>, and copy
53 pointers to them into user-specified memory locations. The cache statistics are stored in
54 the <code class="literal">DB_MPOOL_STAT</code> structure and the per-file cache statistics are stored
55 the <code class="literal">DB_MPOOL_FSTAT</code> structure.
56 </p>
57 <p>
58 Statistical structures are stored in allocated memory. If
59 application-specific allocation routines have been declared (see
60 <a class="xref" href="envset_alloc.html" title="DB_ENV-&gt;set_alloc()">DB_ENV-&gt;set_alloc()</a>
61 for more information), they are used to allocate the memory;
62 otherwise, the standard C library <span class="bold"><strong>malloc</strong></span>(3) is used. The caller is responsible
63 for deallocating the memory. To deallocate the memory, free the
64 memory reference; references inside the returned memory need not be
65 individually freed.
66 </p>
67 <p>
68 If <span class="bold"><strong>gsp</strong></span> is non-NULL, the global
69 statistics for the cache <span class="bold"><strong>mp</strong></span> are
70 copied into the memory location to which it refers. The following
71 <code class="literal">DB_MPOOL_STAT</code> fields will be filled in:
72 </p>
73 <div class="itemizedlist">
74 <ul type="disc">
75 <li>
76 <p>
77 <span class="bold"><strong>u_int32_t st_gbytes;</strong></span>
78 </p>
79 <p>
80 Gigabytes of cache (total cache size is st_gbytes + st_bytes).
81 </p>
82 </li>
83 <li>
84 <p>
85 <span class="bold"><strong>u_int32_t st_bytes;</strong></span>
86 </p>
87 <p>
88 Bytes of cache (total cache size is st_gbytes + st_bytes).
89 </p>
90 </li>
91 <li>
92 <p>
93 <span class="bold"><strong>u_int32_t st_ncache;</strong></span>
94 </p>
95 <p>
96 Number of caches.
97 </p>
98 </li>
99 <li>
100 <p>
101 <span class="bold"><strong>u_int32_t st_max_ncache;</strong></span>
102 </p>
103 <p>
104 Maximum number of caches, as configured with the
105 <a class="xref" href="envset_cache_max.html" title="DB_ENV-&gt;set_cache_max()">DB_ENV-&gt;set_cache_max()</a>
106 method.
107 </p>
108 </li>
109 <li>
110 <p>
111 <span class="bold"><strong>roff_t st_regsize;</strong></span>
112 </p>
113 <p>
114 Individual cache size, in bytes.
115 </p>
116 </li>
117 <li>
118 <p>
119 <span class="bold"><strong>size_t st_mmapsize;</strong></span>
120 </p>
121 <p>
122 Maximum memory-mapped file size.
123 </p>
124 </li>
125 <li>
126 <p>
127 <span class="bold"><strong>int st_maxopenfd;</strong></span>
128 </p>
129 <p>
130 Maximum open file descriptors.
131 </p>
132 </li>
133 <li>
134 <p>
135 <span class="bold"><strong>int st_maxwrite;</strong></span>
136 </p>
137 <p>
138 Maximum sequential buffer writes.
139 </p>
140 </li>
141 <li>
142 <p>
143 <span class="bold"><strong>db_timeout_t st_maxwrite_sleep;</strong></span>
144 </p>
145 <p>
146 Microseconds to pause after writing maximum sequential buffers.
147 </p>
148 </li>
149 <li>
150 <p>
151 <span class="bold"><strong>u_int32_t st_map;</strong></span>
152 </p>
153 <p>
154 Requested pages mapped into the process' address space (there is no
155 available information about whether or not this request caused disk
156 I/O, although examining the application page fault rate may be
157 helpful).
158 </p>
159 </li>
160 <li>
161 <p>
162 <span class="bold"><strong>uintmax_t st_cache_hit;</strong></span>
163 </p>
164 <p>
165 Requested pages found in the cache.
166 </p>
167 </li>
168 <li>
169 <p>
170 <span class="bold"><strong>uintmax_t st_cache_miss;</strong></span>
171 </p>
172 <p>
173 Requested pages not found in the cache.
174 </p>
175 </li>
176 <li>
177 <p>
178 <span class="bold"><strong>uintmax_t st_page_create;</strong></span>
179 </p>
180 <p>
181 Pages created in the cache.
182 </p>
183 </li>
184 <li>
185 <p>
186 <span class="bold"><strong>uintmax_t st_page_in;</strong></span>
187 </p>
188 <p>
189 Pages read into the cache.
190 </p>
191 </li>
192 <li>
193 <p>
194 <span class="bold"><strong>uintmax_t st_page_out;</strong></span>
195 </p>
196 <p>
197 Pages written from the cache to the backing file.
198 </p>
199 </li>
200 <li>
201 <p>
202 <span class="bold"><strong>uintmax_t st_ro_evict;</strong></span>
203 </p>
204 <p>
205 Clean pages forced from the cache.
206 </p>
207 </li>
208 <li>
209 <p>
210 <span class="bold"><strong>uintmax_t st_rw_evict;</strong></span>
211 </p>
212 <p>
213 Dirty pages forced from the cache.
214 </p>
215 </li>
216 <li>
217 <p>
218 <span class="bold"><strong>uintmax_t st_page_trickle;</strong></span>
219 </p>
220 <p>
221 Dirty pages written using the
222 <a class="xref" href="memptrickle.html" title="DB_ENV-&gt;memp_trickle()">DB_ENV-&gt;memp_trickle()</a>
223 method.
224 </p>
225 </li>
226 <li>
227 <p>
228 <span class="bold"><strong>u_int32_t st_pages;</strong></span>
229 </p>
230 <p>
231 Pages in the cache.
232 </p>
233 </li>
234 <li>
235 <p>
236 <span class="bold"><strong>u_int32_t st_page_clean;</strong></span>
237 </p>
238 <p>
239 Clean pages currently in the cache.
240 </p>
241 </li>
242 <li>
243 <p>
244 <span class="bold"><strong>u_int32_t st_page_dirty;</strong></span>
245 </p>
246 <p>
247 Dirty pages currently in the cache.
248 </p>
249 </li>
250 <li>
251 <p>
252 <span class="bold"><strong>u_int32_t st_hash_buckets;</strong></span>
253 </p>
254 <p>
255 Number of hash buckets in buffer hash table.
256 </p>
257 </li>
258 <li>
259 <p>
260 <span class="bold"><strong>uintmax_t st_hash_examined;</strong></span>
261 </p>
262 <p>
263 Total number of hash elements traversed during hash table lookups.
264 </p>
265 </li>
266 <li>
267 <p>
268 <span class="bold"><strong>u_int32_t st_hash_longest;</strong></span>
269 </p>
270 <p>
271 Longest chain ever encountered in buffer hash table lookups.
272 </p>
273 </li>
274 <li>
275 <p>
276 <span class="bold"><strong>u_int32_t st_hash_mutexes;</strong></span>
277 </p>
278 <p>
279 The number of hash bucket mutexes in the buffer hash table.
280 </p>
281 </li>
282 <li>
283 <p>
284 <span class="bold"><strong>uintmax_t st_hash_nowait;</strong></span>
285 </p>
286 <p>
287 Number of times that a thread of control was able to obtain a hash
288 bucket lock without waiting.
289 </p>
290 </li>
291 <li>
292 <p>
293 <span class="bold"><strong>u_int32_t st_hash_searches;</strong></span>
294 </p>
295 <p>
296 Total number of buffer hash table lookups.
297 </p>
298 </li>
299 <li>
300 <p>
301 <span class="bold"><strong>uintmax_t st_hash_wait;</strong></span>
302 </p>
303 <p>
304 Number of times that a thread of control was forced to wait before
305 obtaining a hash bucket lock.
306 </p>
307 </li>
308 <li>
309 <p>
310 <span class="bold"><strong>uintmax_t st_hash_max_nowait;</strong></span>
311 </p>
312 <p>
313 The number of times a thread of control was able to obtain the hash
314 bucket lock without waiting on the bucket which had the maximum number
315 of times that a thread of control needed to wait.
316 </p>
317 </li>
318 <li>
319 <p>
320 <span class="bold"><strong>uintmax_t st_hash_max_wait;</strong></span>
321 </p>
322 <p>
323 Maximum number of times any hash bucket lock was waited for by a
324 thread of control.
325 </p>
326 </li>
327 <li>
328 <p>
329 <span class="bold"><strong>uintmax_t st_region_wait;</strong></span>
330 </p>
331 <p>
332 Number of times that a thread of control was forced to wait before
333 obtaining a cache region mutex.
334 </p>
335 </li>
336 <li>
337 <p>
338 <span class="bold"><strong>uintmax_t st_region_nowait;</strong></span>
339 </p>
340 <p>
341 Number of times that a thread of control was able to obtain a cache
342 region mutex without waiting.
343 </p>
344 </li>
345 <li>
346 <p>
347 <span class="bold"><strong>uintmax_t st_mvcc_frozen;</strong></span>
348 </p>
349 <p>
350 Number of buffers frozen.
351 </p>
352 </li>
353 <li>
354 <p>
355 <span class="bold"><strong>uintmax_t st_mvcc_thawed;</strong></span>
356 </p>
357 <p>
358 Number of buffers thawed.
359 </p>
360 </li>
361 <li>
362 <p>
363 <span class="bold"><strong>uintmax_t st_mvcc_freed;</strong></span>
364 </p>
365 <p>
366 Number of frozen buffers freed.
367 </p>
368 </li>
369 <li>
370 <p>
371 <span class="bold"><strong>uintmax_t st_alloc;</strong></span>
372 </p>
373 <p>
374 Number of page allocations.
375 </p>
376 </li>
377 <li>
378 <p>
379 <span class="bold"><strong>uintmax_t st_alloc_buckets;</strong></span>
380 </p>
381 <p>
382 Number of hash buckets checked during allocation.
383 </p>
384 </li>
385 <li>
386 <p>
387 <span class="bold"><strong>uintmax_t st_alloc_max_buckets;</strong></span>
388 </p>
389 <p>
390 Maximum number of hash buckets checked during an allocation.
391 </p>
392 </li>
393 <li>
394 <p>
395 <span class="bold"><strong>uintmax_t st_alloc_pages;</strong></span>
396 </p>
397 <p>
398 Number of pages checked during allocation.
399 </p>
400 </li>
401 <li>
402 <p>
403 <span class="bold"><strong>uintmax_t st_alloc_max_pages;</strong></span>
404 </p>
405 <p>
406 Maximum number of pages checked during an allocation.
407 </p>
408 </li>
409 <li>
410 <p>
411 <span class="bold"><strong>uintmax_t st_io_wait;</strong></span>
412 </p>
413 <p>
414 Number of operations blocked waiting for I/O to complete.
415 </p>
416 </li>
417 <li>
418 <p>
419 <span class="bold"><strong>uintmax_t st_sync_interrupted;</strong></span>
420 </p>
421 <p>
422 Number of mpool sync operations interrupted.
423 </p>
424 </li>
425 </ul>
426 </div>
427 <p>
428 If <span class="bold"><strong>fsp</strong></span> is non-NULL, a pointer to a
429 NULL-terminated variable length array of statistics for individual
430 files, in the cache <span class="bold"><strong>mp</strong></span>, is copied
431 into the memory location to which it refers. If no individual files
432 currently exist in the cache, <span class="bold"><strong>fsp</strong></span>
433 will be set to NULL.
434 </p>
435 <p>
436 The per-file statistics are stored in structures of type <code class="literal">DB_MPOOL_FSTAT</code>.
437 The following <code class="literal">DB_MPOOL_FSTAT</code> fields will be filled in for each file in
438 the cache; that is, each element of the array:
439 </p>
440 <div class="itemizedlist">
441 <ul type="disc">
442 <li>
443 <p>
444 <span class="bold"><strong>char * file_name;</strong></span>
445 </p>
446 <p>
447 The name of the file.
448 </p>
449 </li>
450 <li>
451 <p>
452 <span class="bold"><strong>size_t st_pagesize;</strong></span>
453 </p>
454 <p>
455 Page size in bytes.
456 </p>
457 </li>
458 <li>
459 <p>
460 <span class="bold"><strong>uintmax_t st_cache_hit;</strong></span>
461 </p>
462 <p>
463 Requested pages found in the cache.
464 </p>
465 </li>
466 <li>
467 <p>
468 <span class="bold"><strong>uintmax_t st_cache_miss;</strong></span>
469 </p>
470 <p>
471 Requested pages not found in the cache.
472 </p>
473 </li>
474 <li>
475 <p>
476 <span class="bold"><strong>u_int32_t st_map;</strong></span>
477 </p>
478 <p>
479 Requested pages mapped into the process' address space.
480 </p>
481 </li>
482 <li>
483 <p>
484 <span class="bold"><strong>uintmax_t st_page_create;</strong></span>
485 </p>
486 <p>
487 Pages created in the cache.
488 </p>
489 </li>
490 <li>
491 <p>
492 <span class="bold"><strong>uintmax_t st_page_in;</strong></span>
493 </p>
494 <p>
495 Pages read into the cache.
496 </p>
497 </li>
498 <li>
499 <p>
500 <span class="bold"><strong>uintmax_t st_page_out;</strong></span>
501 </p>
502 <p>
503 Pages written from the cache to the backing file.
504 </p>
505 </li>
506 </ul>
507 </div>
508 <p>
509 The <code class="methodname">DB_ENV-&gt;memp_stat()</code> method may not be called before the
510 <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> method is called.
511 </p>
512 <p>
513 The <code class="methodname">DB_ENV-&gt;memp_stat()</code> <span>
514 <span>
515 method returns a non-zero error value on failure and 0 on success.
516 </span>
517
518 </span>
519 </p>
520 <div class="sect2" lang="en" xml:lang="en">
521 <div class="titlepage">
522 <div>
523 <div>
524 <h3 class="title"><a id="idp53261848"></a>Parameters</h3>
525 </div>
526 </div>
527 </div>
528 <div class="sect3" lang="en" xml:lang="en">
529 <div class="titlepage">
530 <div>
531 <div>
532 <h4 class="title"><a id="idp53286184"></a>gsp</h4>
533 </div>
534 </div>
535 </div>
536 <p>
537 The <span class="bold"><strong>gsp</strong></span> parameter references memory
538 into which a pointer to the allocated global statistics structure is
539 copied.
540 </p>
541 </div>
542 <div class="sect3" lang="en" xml:lang="en">
543 <div class="titlepage">
544 <div>
545 <div>
546 <h4 class="title"><a id="idp53289784"></a>fsp</h4>
547 </div>
548 </div>
549 </div>
550 <p>
551 The <span class="bold"><strong>fsp</strong></span> parameter references memory
552 into which a pointer to the allocated per-file statistics structures
553 is copied.
554 </p>
555 </div>
556 <div class="sect3" lang="en" xml:lang="en">
557 <div class="titlepage">
558 <div>
559 <div>
560 <h4 class="title"><a id="idp53290560"></a>flags</h4>
561 </div>
562 </div>
563 </div>
564 <p>
565 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
566 or the following value:
567 </p>
568 <div class="itemizedlist">
569 <ul type="disc">
570 <li>
571 <p><a id="mempstat_DB_STAT_CLEAR"></a>
572 <code class="literal">DB_STAT_CLEAR</code>
573 </p>
574 <p>
575 Reset statistics after returning their values.
576 </p>
577 </li>
578 </ul>
579 </div>
580 </div>
581 </div>
582 <div class="sect2" lang="en" xml:lang="en">
583 <div class="titlepage">
584 <div>
585 <div>
586 <h3 class="title"><a id="idp53295480"></a>Errors</h3>
587 </div>
588 </div>
589 </div>
590 <p>
591 The <code class="methodname">DB_ENV-&gt;memp_stat()</code> <span>
592 <span>
593 method may fail and return one of the following non-zero errors:
594 </span>
595
596 </span>
597 </p>
598 <div class="sect3" lang="en" xml:lang="en">
599 <div class="titlepage">
600 <div>
601 <div>
602 <h4 class="title"><a id="idp53300128"></a>EINVAL</h4>
603 </div>
604 </div>
605 </div>
606 <p>
607 An invalid flag value or parameter was specified.
608 </p>
609 </div>
610 </div>
611 <div class="sect2" lang="en" xml:lang="en">
612 <div class="titlepage">
613 <div>
614 <div>
615 <h3 class="title"><a id="idp53298832"></a>Class</h3>
616 </div>
617 </div>
618 </div>
619 <p>
620 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>, <a class="link" href="memp.html" title="Chapter 8.  The DB_MPOOLFILE Handle">DB_MPOOLFILE</a>
621 </p>
622 </div>
623 <div class="sect2" lang="en" xml:lang="en">
624 <div class="titlepage">
625 <div>
626 <div>
627 <h3 class="title"><a id="idp53301208"></a>See Also</h3>
628 </div>
629 </div>
630 </div>
631 <p>
632 <a class="xref" href="memp.html#memplist" title="Memory Pools and Related Methods">Memory Pools and Related Methods</a>
633 </p>
634 </div>
635 </div>
636 <div class="navfooter">
637 <hr />
638 <table width="100%" summary="Navigation footer">
639 <tr>
640 <td width="40%" align="left"><a accesskey="p" href="mempregister.html">Prev</a> </td>
641 <td width="20%" align="center">
642 <a accesskey="u" href="memp.html">Up</a>
643 </td>
644 <td width="40%" align="right"> <a accesskey="n" href="mempstat_print.html">Next</a></td>
645 </tr>
646 <tr>
647 <td width="40%" align="left" valign="top">DB_ENV-&gt;memp_register() </td>
648 <td width="20%" align="center">
649 <a accesskey="h" href="index.html">Home</a>
650 </td>
651 <td width="40%" align="right" valign="top"> DB_ENV-&gt;memp_stat_print()</td>
652 </tr>
653 </table>
654 </div>
655 </body>
656 </html>