aboutsummaryrefslogtreecommitdiff
path: root/lib/libmemstat
Commit message (Collapse)AuthorAgeFilesLines
* MFC r242152:Matthew D Fleming2012-10-301-1/+1
| | | | | | | Const-ify the zone name argument to uma_zcreate(9). Notes: svn path=/stable/8/; revision=242366
* MFC r232157, r232158:Glen Barber2012-04-261-2/+2
| | | | | | | | | | | | | | | | r232157: Fix various typos in manual pages. Submitted by: amdmi3 PR: 165431 r232158: Whitespace cleanup: o Wrap sentences on to new lines o Cleanup trailing whitespace Notes: svn path=/stable/8/; revision=234719
* MFC r225330:Sergey Kandaurov2011-09-051-1/+0
| | | | | | | Cosmetic cleanup: remove unused #define LIBMEMSTAT Notes: svn path=/stable/8/; revision=225386
* MFC r206622,207939,208593,208732,209031: mdoc cleanupUlrich Spörlein2010-08-271-1/+1
| | | | | | | | | | - order prologue by Dd/Dt/Os - fix prologue - remove empty lines and other garbage - uppercase document title Notes: svn path=/stable/8/; revision=211872
* Bump the version of all non-symbol-versioned shared libraries inKen Smith2009-07-191-1/+1
| | | | | | | | | | | preparation for 8.0-RELEASE. Add the previous version of those libraries to ObsoleteFiles.inc and bump __FreeBSD_Version. Reviewed by: kib Approved by: re (rwatson) Notes: svn path=/head/; revision=195767
* Update the KVM backend for malloc stats to catch up to the internal structureJohn Baldwin2009-05-151-6/+5
| | | | | | | | | BI change from the addition of DTrace malloc(9) probes. Submitted by: Ben Kelly ben of wanderview dot com Notes: svn path=/head/; revision=192148
* Make pointer argument to kread_string() const since the kernel structureRobert Watson2007-05-211-3/+4
| | | | | | | | | | field is const, and then employ __DECONST before getting into the kvm code. This eliminates a gcc 4.2 warning about losing constification. __DECONST advice from: sam Notes: svn path=/head/; revision=169838
* Bump library versions in preparation for 7.0.Daniel Eischen2007-05-211-1/+1
| | | | | | | Ok'd by: kan Notes: svn path=/head/; revision=169807
* Fix a comment in memstat.h: errors are associated with memory type lists,Robert Watson2007-03-151-1/+1
| | | | | | | | | | not individual types. Submitted by: Bryan Venteicher <bryanv at daemoninthecloset dot org> MFC after: 3 days Notes: svn path=/head/; revision=167597
* Increase the number of CPUs to 32 to suit sun4v.John Birrell2006-07-261-1/+1
| | | | | | | Reviewed by: rwatson@ Notes: svn path=/head/; revision=160695
* Update copyright for 2006.Robert Watson2006-02-111-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=155552
* The uma_zone data structure defines the size of its uz_cpu[] array as 1,Robert Watson2006-02-111-2/+24
| | | | | | | | | | | | | | | | but then sizes the containing data structure at run-time to make room for per-cpu cache data. Modify libmemstat to separately allocate a buffer to hold per-cpu cache data, sized based on the run-time mp_maxid variable when using libkvm to access UMA data. This avoids reading invalid cache data from beyond the end of the uma_zone data structure on the stack, which can result in invalid statistics and/or reads from invalid kernel addresses. Foot target practice by: ps MFC after: 3 days Notes: svn path=/head/; revision=155550
* When reporting an error reading from UMA per-cpu cache pointers using KVM,Robert Watson2006-02-111-4/+2
| | | | | | | | | | | return a KVM error rather than an out of memory error, so that the caller reports the KVM error state. This replaces a misleading error message with a more accurate although equally confusing one. MFC after: 3 days Notes: svn path=/head/; revision=155549
* Read all_cpus variable out of kmem, and validate CPUs against the all_cpusRobert Watson2006-02-111-0/+10
| | | | | | | | | | | cpu mask before looking at the cache entries for the CPU. For systems with sparse CPU id arrays, this skips otherwise uninitialized cache structures. MFC after: 3 days Notes: svn path=/head/; revision=155547
* Correct a typo in the extraction of zone information from UMA using kmem:Robert Watson2006-02-111-1/+1
| | | | | | | | | bytes = allocated - freed, not bytes = allocated = freed. MFC after: 3 days Notes: svn path=/head/; revision=155542
* Remove unnecessary and undesirable 'static' from function-local kegRobert Watson2006-01-161-1/+1
| | | | | | | | | | | list, which could cause problems for multi-threaded applications using libmemstat to monitor UMA in more than one thread simultaneously. MFC after: 3 days Notes: svn path=/head/; revision=154416
* Tidy up markup and fix two bugs.Ruslan Ermilov2005-11-211-77/+93
| | | | Notes: svn path=/head/; revision=152650
* Add symlinks for kvm access methods for memstat(3).Robert Watson2005-11-131-0/+3
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=152377
* Add missing shared library interdependencies.Ruslan Ermilov2005-11-101-0/+2
| | | | Notes: svn path=/head/; revision=152285
* The "Mbuf" zone was renamed "mbuf" to improve consistency, but the codeRobert Watson2005-08-151-4/+4
| | | | | | | | | | | | example in libmemstat.3 was not updated to take this rename into account. Update the example. PR: 84946 Submitted by: Wojciech A. Koszek <dunstan at freebsd dot czest dot pl> MFC after: 1 day Notes: svn path=/head/; revision=149080
* Document kvm(3)-related error constants, and correct minor formattingRobert Watson2005-08-091-2/+20
| | | | | | | nits. Notes: svn path=/head/; revision=148907
* Teach libmemstat(3) how to extract malloc(9) statistics using kvm(3),Robert Watson2005-08-064-7/+190
| | | | | | | | | | | | so that libmemstat can be used to view full memory statistics from kernel core dumps and /dev/mem. This is provided via a new query function, memstat_kvm_malloc(), which is also automatically invoked by memstat_kvm_all(). A kvm handle must be passed in. This will allow malloc(9)-specific code to be removed from vmstat(8). Notes: svn path=/head/; revision=148789
* Define LIBMEMSTAT so that vm_page.h won't perform a nested include ofRobert Watson2005-08-041-9/+1
| | | | | | | | | | | | opt_vmpage.h. Remove definition of _KERNEL, it is no longer required in order to include uma_int.h, as the sensitive parts of uma_int.h (a number of inlines depending on kernel-only constants) are now protected by _KERNEL. Notes: svn path=/head/; revision=148693
* Add memstat_kvm_uma(), an implementation of a libmemstat(3) query routineRobert Watson2005-08-015-2/+248
| | | | | | | | | | | | | | | that knows how to extract UMA(9) allocator statistics from a core dump or live memory image using kvm(3). The caller is expected to provide the necessary kvm_t handle, which is then used by libmemstat(3). With these changes, it is trivially straight forward to re-introduce vmstat -z support on core dumps, which was lost when UMA was introduced. In the short term, this requires including vm/ include files that are not intended for extra-kernel use, requiring in turn some ugliness. Notes: svn path=/head/; revision=148627
* Correct two libmemstat(3) bugs:Robert Watson2005-08-014-4/+12
| | | | | | | | | | | | | | | | | | | | | - Move memory_type_list flushing logic from memstat_mtl_free() to _memstat_mtl_empty(), a libmemstat-internal function that can be called from other parts of the library. Invoke _memstat_mtl_empty() from memstat_mtl_free(), which also frees the containing list structure. Invoke _memstat_mtl_empty() instead of memstat_mtl_free() in various error cases in memstat_malloc.c and memstat_uma.c, which previously resulted in the list being freed prematurely. - Reverse the order of updating the mt_kegfree and mt_free fields of the memory_type in memstat_uma.c, otherwise keg free items won't be counted properly for non-secondary zones. MFC after: 3 days Notes: svn path=/head/; revision=148619
* If a retrieved UMA zone is a secondary zone, don't report keg free items,Robert Watson2005-07-251-1/+10
| | | | | | | | | | as they actually belong to the primary zone, and maye otherwise be reported more than once. MFC after: 1 day Notes: svn path=/head/; revision=148381
* Having decided not to provide a libmemstat(3) error number to textRobert Watson2005-07-244-3/+38
| | | | | | | | | | | | | | | | conversion routine, now change my mind and add one, memstat_strerror(3), which returns a const char * pointer to a string describing the error, to be used on the results of memstat_mtl_geterror(). While here, also correct a minor typo in the HISTORY man page. Pointers on improving ease of internationalization would be appreciated. MFC after: 1 day Notes: svn path=/head/; revision=148359
* Document additional aspects of libmemstat(3):Robert Watson2005-07-242-0/+171
| | | | | | | | | | | - Short description of each memory type access method. - Descriptions of libmemstat(3) errors and memstat_mtl_geterror(3). MFC after: 1 day Notes: svn path=/head/; revision=148358
* Introduce more formal error handling for libmemstat(3):Robert Watson2005-07-245-66/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Define a set of libmemstat(3) error constants, which are used by all libmemstat(3) methods except for memstat_mtl_alloc(), which allocates a memory type list and may return ENOMEM via errno. - Define a per-memory_type_list current error value, which is set when a call associated with a memory list fails. This requires wrapping a structure around the queue(9) list head data structure, but this change is not visible to libmemstat(3) consumers due to using access methods. - Add a new accessor method, memstat_mtl_geterror() to retrieve the error number. - Consistently set the error number in a number of failure modes where previously some combination of setting errno and printf'ing error descriptions was used. libmemstat(3) will now no longer print to stdio under any circumstances. Returns of NULL/-1 for errors remain the same. This avoids use of stdio, misuse of error numbers, and should make it easier to program a libmemstat(3) consumer able to print useful error messages. Currently, no error-to-string function is provided, as I'm unsure how to address internationalization concerns. MFC after: 1 day Notes: svn path=/head/; revision=148357
* Prefix two non-static libmemstat(3) internal functions with '_' symbols, toRobert Watson2005-07-234-19/+12
| | | | | | | | | | try and discourage use outside the library. Remove duplicate declaration of memstat_mtl_free() from memstat_internal.h, as it's not internal, and the memstat.h definition suffices. Notes: svn path=/head/; revision=148354
* UMA supports "secondary" zones, in which a second zone can be layeredRobert Watson2005-07-205-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | on top of a primary zone, sharing the same allocation "keg". When reporting statistics for zones, do not report the free items in the keg as part of the free items in the zone, or those free items will be reported more than once: for the primary zone, and then any secondary zones off the primary zone. Separately record and maintain a kegfree statistic, and export via memstat_get_kegfree(), which is available for use if needed. Since items free'd back to the keg are not fully initialized, and hence may not actually be available (since secondary zone ctor-time initialization can fail), this makes some amount of sense. This change corrects a bug made visible in the libmemstat(3) modifications to netstat: mbufs freed back to the keg from the packet zone would be counted twice, resulting in negative values being printed in the mbuf free count. Some further refinement of reporting relating to secondary zones may still be required. Reported by: ssouhlal MFC after: 3 days Notes: svn path=/head/; revision=148170
* Bump MEMSTAT_MAXCALLER to 16. memtop(8) seems to be able to happilyRobert Watson2005-07-181-1/+1
| | | | | | | | | | consume that many slots to track snapshot-to-snapshot changes and running totals. And 16 is a nice round number. MFC after: 1 week Notes: svn path=/head/; revision=148121
* Add __BEGIN_DECLS and __END_DECLS to make libmemstat(3) more C++-friendly.Robert Watson2005-07-171-0/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=148094
* Teach libmemstat(3) about UMA(9) failure statistics.Robert Watson2005-07-151-0/+1
| | | | | | | | Requested by: victor cruceru <victor dot cruceru at gmail dot com> MFC after: 1 week Notes: svn path=/head/; revision=148071
* Provide more documentation on caller-owned storage in struct memory_type,Robert Watson2005-07-151-7/+20
| | | | | | | | | as well as documenting MEMSTAT_MAXCALLER. MFC after: 1 week Notes: svn path=/head/; revision=148042
* Increase the number of caller memory storage slots from 2 or 4 toRobert Watson2005-07-152-8/+12
| | | | | | | | | | | | | | | MEMSTAT_MAXCALLER (8), and expose MEMSTAT_MAXCALLER via memstat.h so that applications can check their assumptions about how many slots are available. Remove 'spare' memory storage in struct malloc_type, since we now don't expose the data structure internals to applications and rely on accessor methods, this approach to ABI stability isn't required. MFC after: 7 days Notes: svn path=/head/; revision=148041
* Add a section on the allocator name space and its interactions withRobert Watson2005-07-151-0/+22
| | | | | | | | | memstat_mtl_find(). MFC after: 10 days Notes: svn path=/head/; revision=148039
* Re-spell wronge less wrongly as wrong.Robert Watson2005-07-152-4/+4
| | | | | | | | Submitted by: jkoshy MFC after: 1 week Notes: svn path=/head/; revision=148038
* Properly combine per-CPU UMA cache allocation and free counts with theRobert Watson2005-07-141-4/+5
| | | | | | | | | global counters maintained in the zone. MFC after: 1 week Notes: svn path=/head/; revision=148007
* Add libmemstat(3), a library for use by debugging and monitoringRobert Watson2005-07-148-0/+1402
applications in tracking kernel memory statistics. It provides an abstracted interface to uma(9) and malloc(9) statistics, wrapped around the recently added binary stream sysctls for the allocators. Using this interface, it is easy to build monitoring tools, query specific memory types for usage information, etc. Facilities are provided for binding caller-provided data to memory types, incremental updates of memory types, and queries that span multiple allocators. Support for additional allocators is (relatively) easy to add. The API for libmemstat(3) will probably change some over time as consumers are written, and requirements evolve. It is written to avoid encoding ABIs for data structure layout into consuming applications for this reason. MFC after: 1 week Notes: svn path=/head/; revision=147997