瀏覽代碼

don't compile get_total_allocated_memory() if REQUEST_SIZE_INFO is not enabled

Ioannis Koutras 11 年之前
父節點
當前提交
5c8ddb91a8
共有 2 個文件被更改,包括 8 次插入8 次删除
  1. 3 3
      include/dmmlib/dmmstats.h
  2. 5 5
      src/statistics.c

+ 3 - 3
include/dmmlib/dmmstats.h

@@ -49,12 +49,12 @@ typedef struct dmmstats_s {
 #ifdef REQUEST_SIZE_INFO
 /** Returns the total memory currently requested by the application. */
 size_t get_total_requested_memory(void);
+
+/** Returns the current utilization index. */
+long double get_utilization_index(void);
 #endif /* REQUEST_SIZE_INFO */
 
 /** Returns the total memory currently allocated for the application. */
 size_t get_total_allocated_memory(void);
 
-/** Returns the current utilization index. */
-long double get_utilization_index(void);
-
 #endif /* DMMSTATS_H */

+ 5 - 5
src/statistics.c

@@ -100,11 +100,6 @@ void update_stats
 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;
-}
 
 long double get_utilization_index(void) {
     if(systemallocator.dmm_stats.total_mem_allocated != 0) {
@@ -114,3 +109,8 @@ long double get_utilization_index(void) {
         return 1.0;
     }
 }
+#endif /* REQUEST_SIZE_INFO */
+
+size_t get_total_allocated_memory(void) {
+    return systemallocator.dmm_stats.total_mem_allocated;
+}