| 1 | #include "hooks.h" |
| 2 | static int armed; |
| 3 | static uint64_t allocations, releases, bytes; |
| 4 | void vheap_alloc(void *pointer, uint64_t size) { |
| 5 | (void)pointer; |
| 6 | if (armed) { allocations++; bytes += size; } |
| 7 | } |
| 8 | void vheap_free(void *pointer) { |
| 9 | (void)pointer; |
| 10 | if (armed) releases++; |
| 11 | } |
| 12 | void goops_heap_arm(void) { allocations = releases = bytes = 0; armed = 1; } |
| 13 | void goops_heap_disarm(void) { armed = 0; } |
| 14 | uint64_t goops_heap_allocations(void) { return allocations; } |
| 15 | uint64_t goops_heap_releases(void) { return releases; } |
| 16 | uint64_t goops_heap_bytes(void) { return bytes; } |
| 17 | |