Deleted Added
full compact
memstat_internal.h (147997) memstat_internal.h (148041)
1/*-
2 * Copyright (c) 2005 Robert N. M. Watson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2005 Robert N. M. Watson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/lib/libmemstat/memstat_internal.h 147997 2005-07-14 17:40:02Z rwatson $
26 * $FreeBSD: head/lib/libmemstat/memstat_internal.h 148041 2005-07-15 11:19:55Z rwatson $
27 */
28
29#ifndef _MEMSTAT_INTERNAL_H_
30#define _MEMSTAT_INTERNAL_H_
31
32/*
33 * memstat maintains its own internal notion of statistics on each memory
34 * type, common across UMA and kernel malloc. Some fields are straight from

--- 25 unchanged lines hidden (view full) ---

60 uint64_t mt_memalloced; /* Bytes allocated over life time. */
61 uint64_t mt_memfreed; /* Bytes freed over life time. */
62 uint64_t mt_numallocs; /* Allocations over life time. */
63 uint64_t mt_numfrees; /* Frees over life time. */
64 uint64_t mt_bytes; /* Bytes currently allocated. */
65 uint64_t mt_count; /* Number of current allocations. */
66 uint64_t mt_free; /* Number of cached free items. */
67 uint64_t mt_failures; /* Number of allocation failures. */
27 */
28
29#ifndef _MEMSTAT_INTERNAL_H_
30#define _MEMSTAT_INTERNAL_H_
31
32/*
33 * memstat maintains its own internal notion of statistics on each memory
34 * type, common across UMA and kernel malloc. Some fields are straight from

--- 25 unchanged lines hidden (view full) ---

60 uint64_t mt_memalloced; /* Bytes allocated over life time. */
61 uint64_t mt_memfreed; /* Bytes freed over life time. */
62 uint64_t mt_numallocs; /* Allocations over life time. */
63 uint64_t mt_numfrees; /* Frees over life time. */
64 uint64_t mt_bytes; /* Bytes currently allocated. */
65 uint64_t mt_count; /* Number of current allocations. */
66 uint64_t mt_free; /* Number of cached free items. */
67 uint64_t mt_failures; /* Number of allocation failures. */
68 uint64_t _mt_spare_uint64[4]; /* Spare. */
69
70 /*
71 * Caller-owned memory.
72 */
68
69 /*
70 * Caller-owned memory.
71 */
73 void *mt_caller_pointer[4]; /* Caller-owned pointers. */
74 uint64_t mt_caller_uint64[4]; /* Caller-owned longs. */
72 void *mt_caller_pointer[MEMSTAT_MAXCALLER]; /* Pointers. */
73 uint64_t mt_caller_uint64[MEMSTAT_MAXCALLER]; /* Integers. */
75
76 /*
77 * For allocators making use of per-CPU caches, we also provide raw
78 * statistics from the central allocator and each per-CPU cache,
79 * which (combined) sometimes make up the above general statistics.
80 *
81 * First, central zone/type state, all numbers excluding any items
82 * cached in per-CPU caches.
83 *
84 * XXXRW: Might be desirable to separately expose allocation stats
85 * from zone, which should (combined with per-cpu) add up to the
86 * global stats above.
87 */
88 uint64_t mt_zonefree; /* Free items in zone. */
74
75 /*
76 * For allocators making use of per-CPU caches, we also provide raw
77 * statistics from the central allocator and each per-CPU cache,
78 * which (combined) sometimes make up the above general statistics.
79 *
80 * First, central zone/type state, all numbers excluding any items
81 * cached in per-CPU caches.
82 *
83 * XXXRW: Might be desirable to separately expose allocation stats
84 * from zone, which should (combined with per-cpu) add up to the
85 * global stats above.
86 */
87 uint64_t mt_zonefree; /* Free items in zone. */
89 uint64_t _mt_spare_uint642[4]; /* Spare. */
90
91 /*
92 * Per-CPU measurements fall into two categories: per-CPU allocation,
93 * and per-CPU cache state.
94 */
95 struct {
96 uint64_t mtp_memalloced;/* Per-CPU mt_memalloced. */
97 uint64_t mtp_memfreed; /* Per-CPU mt_memfreed. */
98 uint64_t mtp_numallocs; /* Per-CPU mt_numallocs. */
99 uint64_t mtp_numfrees; /* Per-CPU mt_numfrees. */
100 uint64_t mtp_sizemask; /* Per-CPU mt_sizemask. */
88
89 /*
90 * Per-CPU measurements fall into two categories: per-CPU allocation,
91 * and per-CPU cache state.
92 */
93 struct {
94 uint64_t mtp_memalloced;/* Per-CPU mt_memalloced. */
95 uint64_t mtp_memfreed; /* Per-CPU mt_memfreed. */
96 uint64_t mtp_numallocs; /* Per-CPU mt_numallocs. */
97 uint64_t mtp_numfrees; /* Per-CPU mt_numfrees. */
98 uint64_t mtp_sizemask; /* Per-CPU mt_sizemask. */
101 void *mtp_caller_pointer[2]; /* Caller data. */
102 uint64_t mtp_caller_uint64[2]; /* Caller data. */
103 uint64_t _mtp_spare_uint64[3]; /* Per-CPU spare. */
99 void *mtp_caller_pointer[MEMSTAT_MAXCALLER];
100 uint64_t mtp_caller_uint64[MEMSTAT_MAXCALLER];
104 } mt_percpu_alloc[MEMSTAT_MAXCPU];
105
106 struct {
107 uint64_t mtp_free; /* Per-CPU cache free items. */
101 } mt_percpu_alloc[MEMSTAT_MAXCPU];
102
103 struct {
104 uint64_t mtp_free; /* Per-CPU cache free items. */
108 uint64_t _mtp_spare_uint64[3]; /* Per-CPU spare. */
109 } mt_percpu_cache[MEMSTAT_MAXCPU];
110
111 LIST_ENTRY(memory_type) mt_list; /* List of types. */
112};
113
114/*
115 * Description of struct memory_type_list is in memstat.h.
116 */
117LIST_HEAD(memory_type_list, memory_type);
118
119void memstat_mtl_free(struct memory_type_list *list);
120struct memory_type *memstat_mt_allocate(struct memory_type_list *list,
121 int allocator, const char *name);
122void memstat_mt_reset_stats(struct memory_type *mtp);
123
124#endif /* !_MEMSTAT_INTERNAL_H_ */
105 } mt_percpu_cache[MEMSTAT_MAXCPU];
106
107 LIST_ENTRY(memory_type) mt_list; /* List of types. */
108};
109
110/*
111 * Description of struct memory_type_list is in memstat.h.
112 */
113LIST_HEAD(memory_type_list, memory_type);
114
115void memstat_mtl_free(struct memory_type_list *list);
116struct memory_type *memstat_mt_allocate(struct memory_type_list *list,
117 int allocator, const char *name);
118void memstat_mt_reset_stats(struct memory_type *mtp);
119
120#endif /* !_MEMSTAT_INTERNAL_H_ */