#ifndef UCS_MEMTRACK_INT_H_
#define UCS_MEMTRACK_INT_H_
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <ucs/sys/compiler_def.h>
#include <ucs/debug/memtrack.h>
#include <stdlib.h>
#include <stdio.h>
BEGIN_C_DECLS
enum {
UCS_MEMTRACK_STAT_ALLOCATION_COUNT,
UCS_MEMTRACK_STAT_ALLOCATION_SIZE,
UCS_MEMTRACK_STAT_LAST
};
typedef struct ucs_memtrack_entry {
size_t size;
size_t peak_size;
unsigned count;
unsigned peak_count;
char name[0];
} ucs_memtrack_entry_t;
void ucs_memtrack_init();
void ucs_memtrack_cleanup();
int ucs_memtrack_is_enabled();
void ucs_memtrack_dump(FILE* output);
void ucs_memtrack_total(ucs_memtrack_entry_t* total);
void *ucs_malloc(size_t size, const char *name);
void *ucs_calloc(size_t nmemb, size_t size, const char *name);
void *ucs_realloc(void *ptr, size_t size, const char *name);
int ucs_posix_memalign(void **ptr, size_t boundary, size_t size,
const char *name);
void ucs_free(void *ptr);
void *ucs_mmap(void *addr, size_t length, int prot, int flags, int fd,
off_t offset, const char *name);
int ucs_munmap(void *addr, size_t length);
char *ucs_strdup(const char *src, const char *name);
char *ucs_strndup(const char *src, size_t n, const char *name);
int ucs_posix_memalign_realloc(void **ptr, size_t boundary, size_t size,
const char *name);
END_C_DECLS
#endif