diff options
author | Simon J. Gerraty <sjg@FreeBSD.org> | 2014-04-27 08:13:43 +0000 |
---|---|---|
committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2014-04-27 08:13:43 +0000 |
commit | 9d2ab4a62d6733c45958627ac113bdbd818d1e2a (patch) | |
tree | b92e741b68057a24e381faa9809f32030d65574c /lib/libmemstat | |
parent | 1991e07af89dbccabfb71af86738da2a979b3d20 (diff) | |
parent | 8be1b6d975fae2513af1b0e5ad6923c3c2428ddd (diff) |
Merge head
Notes
Notes:
svn path=/projects/bmake/; revision=265006
Diffstat (limited to 'lib/libmemstat')
-rw-r--r-- | lib/libmemstat/libmemstat.3 | 9 | ||||
-rw-r--r-- | lib/libmemstat/memstat.c | 7 | ||||
-rw-r--r-- | lib/libmemstat/memstat.h | 1 | ||||
-rw-r--r-- | lib/libmemstat/memstat_internal.h | 1 | ||||
-rw-r--r-- | lib/libmemstat/memstat_uma.c | 2 |
5 files changed, 19 insertions, 1 deletions
diff --git a/lib/libmemstat/libmemstat.3 b/lib/libmemstat/libmemstat.3 index 9b749f053c71..3eff1566d03e 100644 --- a/lib/libmemstat/libmemstat.3 +++ b/lib/libmemstat/libmemstat.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 25, 2012 +.Dd February 11, 2014 .Dt LIBMEMSTAT 3 .Os .Sh NAME @@ -80,6 +80,8 @@ .Ft uint64_t .Fn memstat_get_size "const struct memory_type *mtp" .Ft uint64_t +.Fn memstat_get_rsize "const struct memory_type *mtp" +.Ft uint64_t .Fn memstat_get_memalloced "const struct memory_type *mtp" .Ft uint64_t .Fn memstat_get_memfreed "const struct memory_type *mtp" @@ -287,6 +289,11 @@ If the memory type supports variable allocation sizes, return a bitmask of sizes allocated for the memory type. .It Fn memstat_get_size If the memory type supports a fixed allocation size, return that size. +.It Fn memstat_get_rsize +If the memory type supports a fixed allocation size, return real size +of an allocation. +Real size can exceed requested size due to alignment constraints or +implicit padding. .It Fn memstat_get_memalloced Return the total number of bytes allocated for the memory type over its lifetime. diff --git a/lib/libmemstat/memstat.c b/lib/libmemstat/memstat.c index c7957c8b576c..40bdc9d19f0f 100644 --- a/lib/libmemstat/memstat.c +++ b/lib/libmemstat/memstat.c @@ -254,6 +254,13 @@ memstat_get_size(const struct memory_type *mtp) } uint64_t +memstat_get_rsize(const struct memory_type *mtp) +{ + + return (mtp->mt_rsize); +} + +uint64_t memstat_get_memalloced(const struct memory_type *mtp) { diff --git a/lib/libmemstat/memstat.h b/lib/libmemstat/memstat.h index cca75b32092d..8394dc1c1221 100644 --- a/lib/libmemstat/memstat.h +++ b/lib/libmemstat/memstat.h @@ -124,6 +124,7 @@ uint64_t memstat_get_countlimit(const struct memory_type *mtp); uint64_t memstat_get_byteslimit(const struct memory_type *mtp); uint64_t memstat_get_sizemask(const struct memory_type *mtp); uint64_t memstat_get_size(const struct memory_type *mtp); +uint64_t memstat_get_rsize(const struct memory_type *mtp); uint64_t memstat_get_memalloced(const struct memory_type *mtp); uint64_t memstat_get_memfreed(const struct memory_type *mtp); uint64_t memstat_get_numallocs(const struct memory_type *mtp); diff --git a/lib/libmemstat/memstat_internal.h b/lib/libmemstat/memstat_internal.h index 2416e09b115a..9fdc22813b2a 100644 --- a/lib/libmemstat/memstat_internal.h +++ b/lib/libmemstat/memstat_internal.h @@ -51,6 +51,7 @@ struct memory_type { uint64_t mt_byteslimit; /* 0, or maximum bytes. */ uint64_t mt_sizemask; /* malloc: allocated size bitmask. */ uint64_t mt_size; /* uma: size of objects. */ + uint64_t mt_rsize; /* uma: real size of objects. */ /* * Zone or type information that includes all caches and any central diff --git a/lib/libmemstat/memstat_uma.c b/lib/libmemstat/memstat_uma.c index b8ff3a1f2c03..8e89585300b0 100644 --- a/lib/libmemstat/memstat_uma.c +++ b/lib/libmemstat/memstat_uma.c @@ -212,6 +212,7 @@ retry: } mtp->mt_size = uthp->uth_size; + mtp->mt_rsize = uthp->uth_rsize; mtp->mt_memalloced = mtp->mt_numallocs * uthp->uth_size; mtp->mt_memfreed = mtp->mt_numfrees * uthp->uth_size; mtp->mt_bytes = mtp->mt_memalloced - mtp->mt_memfreed; @@ -435,6 +436,7 @@ memstat_kvm_uma(struct memory_type_list *list, void *kvm_handle) } skip_percpu: mtp->mt_size = kz.uk_size; + mtp->mt_rsize = kz.uk_rsize; mtp->mt_memalloced = mtp->mt_numallocs * mtp->mt_size; mtp->mt_memfreed = mtp->mt_numfrees * mtp->mt_size; mtp->mt_bytes = mtp->mt_memalloced - mtp->mt_memfreed; |