Commit | Line | Data |
---|---|---|
98fa08a5 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
d16005f8 | 2 | /* |
98fa08a5 | 3 | * Copyright (C) 2019-2021 Paul Cercueil <paul@crapouillou.net> |
d16005f8 PC |
4 | */ |
5 | ||
6 | #ifndef __MEMMANAGER_H__ | |
7 | #define __MEMMANAGER_H__ | |
8 | ||
9 | #include "lightrec.h" | |
10 | ||
98fa08a5 PC |
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 | ||
d16005f8 PC |
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 | ||
98fa08a5 PC |
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 | ||
d16005f8 | 33 | #endif /* __MEMMANAGER_H__ */ |