Update of --mem-stats flag fix: leaving MEM_STATS definition only in jerry-core.

This commit is contained in:
Ruben Ayrapetyan
2015-03-30 13:30:26 +03:00
parent ac7edde72e
commit eb7dce272a
8 changed files with 51 additions and 50 deletions
+3
View File
@@ -66,6 +66,9 @@ project (JerryCore CXX C ASM)
CONFIG_ECMA_COMPACT_PROFILE_DISABLE_JSON_BUILTIN
CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN)
# Memory statistics
set(DEFINES_MEMORY_STATISTICS MEM_STATS)
# Valgrind
set(DEFINES_JERRY_VALGRIND JERRY_VALGRIND)
+9
View File
@@ -13,6 +13,8 @@
* limitations under the License.
*/
#include <stdio.h>
#include "deserializer.h"
#include "ecma-extension.h"
#include "ecma-gc.h"
@@ -269,6 +271,13 @@ jerry_init (jerry_flag_t flags) /**< combination of Jerry flags */
{
jerry_flags = flags;
#ifndef MEM_STATS
if (flags & JERRY_FLAG_MEM_STATS)
{
printf ("Ignoring memory statistics option because of '!MEM_STATS' build configuration.\n");
}
#endif /* !MEM_STATS */
mem_init ();
deserializer_init ();
ecma_init ();
+11 -11
View File
@@ -65,18 +65,18 @@ mem_finalize (bool is_show_mem_stats) /**< show heap memory stats
mem_pools_get_stats (&stats);
printf ("Pools stats:\n");
printf (" Chunk size: %u\n"
" Pools: %lu\n"
" Allocated chunks: %lu\n"
" Free chunks: %lu\n"
" Peak pools: %lu\n"
" Peak allocated chunks: %lu\n\n",
printf (" Chunk size: %zu\n"
" Pools: %zu\n"
" Allocated chunks: %zu\n"
" Free chunks: %zu\n"
" Peak pools: %zu\n"
" Peak allocated chunks: %zu\n\n",
MEM_POOL_CHUNK_SIZE,
(unsigned long) stats.pools_count,
(unsigned long) stats.allocated_chunks,
(unsigned long) stats.free_chunks,
(unsigned long) stats.peak_pools_count,
(unsigned long) stats.peak_allocated_chunks);
stats.pools_count,
stats.allocated_chunks,
stats.free_chunks,
stats.peak_pools_count,
stats.peak_allocated_chunks);
#endif /* MEM_STATS */
}
+3 -3
View File
@@ -26,17 +26,17 @@
/**
* Size of heap
*/
#define MEM_HEAP_AREA_SIZE (CONFIG_MEM_HEAP_AREA_SIZE)
#define MEM_HEAP_AREA_SIZE ((size_t) (CONFIG_MEM_HEAP_AREA_SIZE))
/**
* Size of heap chunk
*/
#define MEM_HEAP_CHUNK_SIZE (CONFIG_MEM_HEAP_CHUNK_SIZE)
#define MEM_HEAP_CHUNK_SIZE ((size_t) (CONFIG_MEM_HEAP_CHUNK_SIZE))
/**
* Size of pool chunk
*/
#define MEM_POOL_CHUNK_SIZE (CONFIG_MEM_POOL_CHUNK_SIZE)
#define MEM_POOL_CHUNK_SIZE ((size_t) (CONFIG_MEM_POOL_CHUNK_SIZE))
/**
* Log2 of maximum number of chunks in a pool
+22 -22
View File
@@ -962,28 +962,28 @@ mem_heap_print (bool dump_block_headers, /**< print block headers */
if (dump_stats)
{
printf ("Heap stats:\n");
printf (" Heap size = %lu bytes\n"
" Chunk size = %lu bytes\n"
" Blocks count = %lu\n"
" Allocated blocks count = %lu\n"
" Allocated chunks count = %lu\n"
" Allocated = %lu bytes\n"
" Waste = %lu bytes\n"
" Peak allocated blocks count = %lu\n"
" Peak allocated chunks count = %lu\n"
" Peak allocated= %lu bytes\n"
" Peak waste = %lu bytes\n",
(uint64_t) mem_heap_stats.size,
(uint64_t) MEM_HEAP_CHUNK_SIZE,
(uint64_t) mem_heap_stats.blocks,
(uint64_t) mem_heap_stats.allocated_blocks,
(uint64_t) mem_heap_stats.allocated_chunks,
(uint64_t) mem_heap_stats.allocated_bytes,
(uint64_t) mem_heap_stats.waste_bytes,
(uint64_t) mem_heap_stats.peak_allocated_blocks,
(uint64_t) mem_heap_stats.peak_allocated_chunks,
(uint64_t) mem_heap_stats.peak_allocated_bytes,
(uint64_t) mem_heap_stats.peak_waste_bytes);
printf (" Heap size = %zu bytes\n"
" Chunk size = %zu bytes\n"
" Blocks count = %zu\n"
" Allocated blocks count = %zu\n"
" Allocated chunks count = %zu\n"
" Allocated = %zu bytes\n"
" Waste = %zu bytes\n"
" Peak allocated blocks count = %zu\n"
" Peak allocated chunks count = %zu\n"
" Peak allocated= %zu bytes\n"
" Peak waste = %zu bytes\n",
mem_heap_stats.size,
MEM_HEAP_CHUNK_SIZE,
mem_heap_stats.blocks,
mem_heap_stats.allocated_blocks,
mem_heap_stats.allocated_chunks,
mem_heap_stats.allocated_bytes,
mem_heap_stats.waste_bytes,
mem_heap_stats.peak_allocated_blocks,
mem_heap_stats.peak_allocated_chunks,
mem_heap_stats.peak_allocated_bytes,
mem_heap_stats.peak_waste_bytes);
}
#else /* MEM_STATS */
(void) dump_stats;