#ifndef _MEMSTAT_H_
#define _MEMSTAT_H_
#define MEMSTAT_MAXCALLER 16
#define ALLOCATOR_UNKNOWN 0
#define ALLOCATOR_MALLOC 1
#define ALLOCATOR_UMA 2
#define ALLOCATOR_ANY 255
#define MEMTYPE_MAXNAME 32
#define MEMSTAT_ERROR_UNDEFINED 0
#define MEMSTAT_ERROR_NOMEMORY 1
#define MEMSTAT_ERROR_VERSION 2
#define MEMSTAT_ERROR_PERMISSION 3
#define MEMSTAT_ERROR_DATAERROR 5
#define MEMSTAT_ERROR_KVM 6
#define MEMSTAT_ERROR_KVM_NOSYMBOL 7
#define MEMSTAT_ERROR_KVM_SHORTREAD 8
struct memory_type;
struct memory_type_list;
__BEGIN_DECLS
const char *memstat_strerror(int error);
struct memory_type_list *memstat_mtl_alloc(void);
struct memory_type *memstat_mtl_first(struct memory_type_list *list);
struct memory_type *memstat_mtl_next(struct memory_type *mtp);
struct memory_type *memstat_mtl_find(struct memory_type_list *list,
int allocator, const char *name);
void memstat_mtl_free(struct memory_type_list *list);
int memstat_mtl_geterror(struct memory_type_list *list);
int memstat_sysctl_all(struct memory_type_list *list, int flags);
int memstat_sysctl_malloc(struct memory_type_list *list, int flags);
int memstat_sysctl_uma(struct memory_type_list *list, int flags);
int memstat_kvm_all(struct memory_type_list *list, void *kvm_handle);
int memstat_kvm_malloc(struct memory_type_list *list, void *kvm_handle);
int memstat_kvm_uma(struct memory_type_list *list, void *kvm_handle);
size_t memstat_malloc_zone_get_count(void);
size_t memstat_malloc_zone_get_size(size_t n);
int memstat_malloc_zone_used(const struct memory_type *mtp, size_t n);
const char *memstat_get_name(const struct memory_type *mtp);
int memstat_get_allocator(const struct memory_type *mtp);
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);
uint64_t memstat_get_numfrees(const struct memory_type *mtp);
uint64_t memstat_get_bytes(const struct memory_type *mtp);
uint64_t memstat_get_count(const struct memory_type *mtp);
uint64_t memstat_get_free(const struct memory_type *mtp);
uint64_t memstat_get_failures(const struct memory_type *mtp);
uint64_t memstat_get_sleeps(const struct memory_type *mtp);
uint64_t memstat_get_xdomain(const struct memory_type *mtp);
void *memstat_get_caller_pointer(const struct memory_type *mtp,
int index);
void memstat_set_caller_pointer(struct memory_type *mtp,
int index, void *value);
uint64_t memstat_get_caller_uint64(const struct memory_type *mtp,
int index);
void memstat_set_caller_uint64(struct memory_type *mtp, int index,
uint64_t value);
uint64_t memstat_get_zonefree(const struct memory_type *mtp);
uint64_t memstat_get_kegfree(const struct memory_type *mtp);
uint64_t memstat_get_percpu_memalloced(const struct memory_type *mtp,
int cpu);
uint64_t memstat_get_percpu_memfreed(const struct memory_type *mtp,
int cpu);
uint64_t memstat_get_percpu_numallocs(const struct memory_type *mtp,
int cpu);
uint64_t memstat_get_percpu_numfrees(const struct memory_type *mtp,
int cpu);
uint64_t memstat_get_percpu_sizemask(const struct memory_type *mtp,
int cpu);
void *memstat_get_percpu_caller_pointer(
const struct memory_type *mtp, int cpu, int index);
void memstat_set_percpu_caller_pointer(struct memory_type *mtp,
int cpu, int index, void *value);
uint64_t memstat_get_percpu_caller_uint64(
const struct memory_type *mtp, int cpu, int index);
void memstat_set_percpu_caller_uint64(struct memory_type *mtp,
int cpu, int index, uint64_t value);
uint64_t memstat_get_percpu_free(const struct memory_type *mtp,
int cpu);
__END_DECLS
#endif