Lines Matching +full:memory +full:- +full:to +full:- +full:memory
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 .Nd "library interface to retrieve kernel memory allocator statistics"
39 .Ss Memory Type List Management Functions
67 .Ss Memory Type Accessor Methods
144 provides an interface to retrieve kernel memory allocator statistics, for
146 from implementation details of the allocators, and allowing a tool to
150 incrementally updating statistics for long-term monitoring.
153 describes each memory type using a
155 an opaque memory type accessed by the application using accessor functions
166 Lists of memory types are populated via calls that query the kernel for
175 Repeated calls will incrementally update the list of memory types, permitting
180 and converted to a user-readable string using
183 Freeing the list will free all memory type data in the list, and so
184 invalidates any outstanding pointers to entries in the list.
193 which will return a pointer to the first entry matching the passed
196 A series of accessor methods is provided to access fields of the structure,
199 Direct application access to the data structure fields is not supported.
203 holds a description of the memory type, including its name and the allocator
209 such as the quantity of free items in per-CPU caches, or administrative
214 includes fields to allow the application to store data, in the form of
215 pointers and 64-bit integers, with memory types.
217 pointers to reference a more complex data structure tracking long-term
218 behavior of the memory type, or a window system object that is used to
219 render the state of the memory type.
220 General and per-CPU storage is provided with each
225 argument to the get and set accessor methods.
233 Caller-owned fields are initialized to
239 is allocated and attached to a memory type list; these fields retain their
240 values across queries that update library-owned fields.
252 These values may be passed to
260 which can be used to specify that returning types matching any allocator is
265 a given memory type:
266 .Bl -tag -width indent
268 Return a pointer to the name of the memory type.
269 Memory for the name is owned by
271 and will be valid through a call to
273 Note that names will be unique with respect to a single allocator, but that
274 the same name might be used by different memory types owned by different
275 memory allocators.
277 Return an integer identifier for the memory allocator that owns the memory
280 If the memory type has an administrative limit on the number of simultaneous
283 If the memory type has an administrative limit on the number of bytes of
284 memory that may be simultaneously allocated for the memory type, return it.
286 If the memory type supports variable allocation sizes, return a bitmask of
287 sizes allocated for the memory type.
289 If the memory type supports a fixed allocation size, return that size.
291 If the memory type supports a fixed allocation size, return real size
293 Real size can exceed requested size due to alignment constraints or
296 Return the total number of bytes allocated for the memory type over its
299 Return the total number of bytes freed for the memory type over its lifetime.
301 Return the total number of allocations for the memory type over its lifetime.
303 Return the total number of frees for the memory type over its lifetime.
305 Return the current number of bytes allocated to the memory type.
307 Return the current number of allocations for the memory type.
309 If the memory allocator supports a cache, return the number of items in the
312 If the memory allocator and type permit allocation failures, return the
315 Return a caller-owned pointer for the memory type.
317 Set a caller-owned pointer for the memory type.
319 Return a caller-owned integer for the memory type.
321 Set a caller-owned integer for the memory type.
323 If the memory allocator supports a multi-level allocation structure, return
328 If the memory allocator supports a multi-level allocation structure, return
333 If the memory allocator supports per-CPU statistics, return the number of
334 bytes of memory allocated for the memory type on the CPU over its lifetime.
336 If the memory allocator supports per-CPU statistics, return the number of
337 bytes of memory freed from the memory type on the CPU over its lifetime.
339 If the memory allocator supports per-CPU statistics, return the number of
340 allocations for the memory type on the CPU over its lifetime.
342 If the memory allocator supports per-CPU statistics, return the number of
343 frees for the memory type on the CPU over its lifetime.
345 If the memory allocator supports variable size memory allocation and per-CPU
346 statistics, return the size bitmask for the memory type on the CPU.
348 Return a caller-owned per-CPU pointer for the memory type.
350 Set a caller-owned per-CPU pointer for the memory type.
352 Return a caller-owned per-CPU integer for the memory type.
354 Set a caller-owned per-CPU integer for the memory type.
356 If the memory allocator supports a per-CPU cache, return the number of free
357 items in the per-CPU cache of the designated CPU.
361 functions fall into three categories: functions returning a pointer to an
366 Functions returning a pointer to an object will generally return
387 \-1
391 may be used to retrieve the error state.
395 .Bl -tag -width ".Dv MEMSTAT_ERROR_KVM_SHORTREAD"
402 Insufficient memory.
403 Occurs if library calls to
405 fail, or if a system call to retrieve kernel statistics fails with
410 is unable to interpret the statistics data returned by the kernel due to an
411 explicit version mismatch, or to differences in data structures that cannot
423 is unable to interpret statistics data returned by the data source, even
424 though there does not appear to be a version problem.
430 interfaces to query statistics data.
437 is unable to read a required symbol from the kernel being operated on.
441 attempts to read data from a live memory image or kernel core dump and
447 pointer are not permitted to fail, and directly return either a statistic
448 or pointer to a string.
450 Create a memory type list, query the
452 memory allocator for available statistics, and print out the number of
456 .Bd -literal -offset indent
463 err(-1, "memstat_mtl_alloc");
465 err(-1, "memstat_sysctl_uma");
468 errx(-1, "memstat_mtl_find: mbuf not found");
483 The kernel memory allocator changes necessary to support a general purpose
487 There are memory allocators in the kernel, such as the VM page allocator
493 Once a memory type is present on a memory type list, it will not be removed
496 In order to flush removed memory types, it is necessary to free the entire