|
@@ -15,11 +15,25 @@
|
|
|
*
|
|
|
*/
|
|
|
|
|
|
-#include "print_stats.h"
|
|
|
+#include <dmmlib/print_stats.h>
|
|
|
#include "dmm_config.h"
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
+size_t get_allocated_space(heap_t *heap) {
|
|
|
+ return heap->dmm_stats.mem_allocated;
|
|
|
+}
|
|
|
+
|
|
|
+size_t get_used_space(heap_t *heap) {
|
|
|
+ return heap->dmm_stats.mem_used;
|
|
|
+}
|
|
|
+
|
|
|
+#ifdef FUTURE_FEATURES
|
|
|
+uint32_t get_requested_space(heap_t *heap) {
|
|
|
+ return heap->dmm_stats.mem_requested;
|
|
|
+}
|
|
|
+#endif /* FUTURE_FEATURES */
|
|
|
+
|
|
|
void print_stats(allocator_t *allocator) {
|
|
|
int i;
|
|
|
|
|
@@ -29,9 +43,13 @@ void print_stats(allocator_t *allocator) {
|
|
|
(int) allocator->heaps[i].dmm_stats.num_malloc);
|
|
|
printf("Total free() calls: %d\n",
|
|
|
(int) allocator->heaps[i].dmm_stats.num_free);
|
|
|
+ printf("Memory currently used: %d\n",
|
|
|
+ (int) allocator->heaps[i].dmm_stats.mem_used);
|
|
|
printf("Memory currently allocated: %d\n",
|
|
|
(int) allocator->heaps[i].dmm_stats.mem_allocated);
|
|
|
+#ifdef FUTURE_FEATURES
|
|
|
printf("Memory currently requested: %d\n",
|
|
|
(int) allocator->heaps[i].dmm_stats.mem_requested);
|
|
|
+#endif /* FUTURE_FEATURES */
|
|
|
}
|
|
|
}
|