ソースを参照

initial API for statistics

Ioannis Koutras 12 年 前
コミット
6305649113
共有3 個のファイルを変更した21 個の追加0 個の削除を含む
  1. 8 0
      include/dmmlib/dmmstats.h
  2. 2 0
      include/dmmlib/knobs.h
  3. 11 0
      src/statistics.c

+ 8 - 0
include/dmmlib/dmmstats.h

@@ -42,4 +42,12 @@ typedef struct dmmstats_s {
     uint32_t num_realloc; /**< Number of realloc()'s served. */
 } dmmstats_t;
 
+#ifdef REQUEST_SIZE_INFO
+/** Returns the total memory currently requested by the application. */
+size_t get_total_requested_memory(void);
+#endif /* REQUEST_SIZE_INFO */
+
+/** Returns the total memory currently allocated for the application. */
+size_t get_total_allocated_memory(void);
+
 #endif /* DMMSTATS_H */

+ 2 - 0
include/dmmlib/knobs.h

@@ -27,6 +27,8 @@
 
 #include "dmm_config.h"
 
+#include <dmmlib/dmmstats.h>
+
 /** The knobs structure of dmmlib. */
 typedef struct dmm_knobs_s {
     double sys_alloc_size; /**< The default size of the raw block. */

+ 11 - 0
src/statistics.c

@@ -69,3 +69,14 @@ void update_stats
 
 }
 
+#ifdef REQUEST_SIZE_INFO
+size_t get_total_requested_memory(void) {
+    return systemallocator.dmm_stats.total_mem_requested;
+}
+#endif /* REQUEST_SIZE_INFO */
+
+size_t get_total_allocated_memory(void) {
+    return systemallocator.dmm_stats.total_mem_allocated;
+}
+
+