Skip to content

Commit

Permalink
module statistics: Properly update the "real_used" memory stat
Browse files Browse the repository at this point in the history
(cherry picked from commit bc34043)
  • Loading branch information
liviuchircu committed Jun 29, 2016
1 parent d835721 commit d8c4b2a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mem/shm_mem.h
Expand Up @@ -272,7 +272,8 @@ inline static void* _shm_realloc(void *ptr, unsigned int size,

#ifdef SHM_EXTRA_STATS
size_f = (frag_size(p) - size_f);
update_module_stats(size_f, size_f + (ptr)?(0):(FRAG_OVERHEAD), (ptr)?(0):(1), VAR_STAT(MOD_NAME));
update_module_stats(size_f, size_f + (ptr ? 0 : FRAG_OVERHEAD),
ptr ? 0 : 1 , VAR_STAT(MOD_NAME));

#endif

Expand All @@ -293,7 +294,8 @@ inline static void* _shm_realloc_unsafe(void *ptr, unsigned int size,

#ifdef SHM_EXTRA_STATS
size_f = (frag_size(p) - size_f);
update_module_stats(size_f, size_f + (ptr)?(0):(FRAG_OVERHEAD), (ptr)?(0):(1), VAR_STAT(MOD_NAME));
update_module_stats(size_f, size_f + (ptr ? 0 : FRAG_OVERHEAD),
ptr ? 0 : 1 , VAR_STAT(MOD_NAME));
#endif

return p;
Expand Down Expand Up @@ -434,7 +436,8 @@ inline static void* shm_realloc(void *ptr, unsigned int size)

#ifdef SHM_EXTRA_STATS
size_f = (frag_size(p) - size_f);
update_module_stats(size_f, size_f + (ptr)?(0):(FRAG_OVERHEAD), (ptr)?(0):(1), VAR_STAT(MOD_NAME));
update_module_stats(size_f, size_f + (ptr ? 0 : FRAG_OVERHEAD),
ptr ? 0 : 1 , VAR_STAT(MOD_NAME));
#endif

return p;
Expand All @@ -452,7 +455,8 @@ inline static void* shm_realloc_unsafe(void *ptr, unsigned int size)

#ifdef SHM_EXTRA_STATS
size_f = (frag_size(p) - size_f);
update_module_stats(size_f, size_f + (ptr)?(0):(FRAG_OVERHEAD), (ptr)?(0):(1), VAR_STAT(MOD_NAME));
update_module_stats(size_f, size_f + (ptr ? 0 : FRAG_OVERHEAD),
ptr ? 0 : 1 , VAR_STAT(MOD_NAME));
#endif
return p;
}
Expand Down

0 comments on commit d8c4b2a

Please sign in to comment.