| 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 | /* |
| 3 | * Copyright (C) 2019-2021 Paul Cercueil <paul@crapouillou.net> |
| 4 | */ |
| 5 | |
| 6 | #ifndef __MEMMANAGER_H__ |
| 7 | #define __MEMMANAGER_H__ |
| 8 | |
| 9 | #include "lightrec.h" |
| 10 | |
| 11 | enum mem_type { |
| 12 | MEM_FOR_CODE, |
| 13 | MEM_FOR_MIPS_CODE, |
| 14 | MEM_FOR_IR, |
| 15 | MEM_FOR_LIGHTREC, |
| 16 | MEM_TYPE_END, |
| 17 | }; |
| 18 | |
| 19 | void * lightrec_malloc(struct lightrec_state *state, |
| 20 | enum mem_type type, unsigned int len); |
| 21 | void * lightrec_calloc(struct lightrec_state *state, |
| 22 | enum mem_type type, unsigned int len); |
| 23 | void lightrec_free(struct lightrec_state *state, |
| 24 | enum mem_type type, unsigned int len, void *ptr); |
| 25 | |
| 26 | void lightrec_register(enum mem_type type, unsigned int len); |
| 27 | void lightrec_unregister(enum mem_type type, unsigned int len); |
| 28 | |
| 29 | unsigned int lightrec_get_mem_usage(enum mem_type type); |
| 30 | unsigned int lightrec_get_total_mem_usage(void); |
| 31 | float lightrec_get_average_ipi(void); |
| 32 | |
| 33 | #endif /* __MEMMANAGER_H__ */ |