mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Update of --mem-stats flag fix: leaving MEM_STATS definition only in jerry-core.
This commit is contained in:
parent
ac7edde72e
commit
eb7dce272a
@ -252,10 +252,6 @@ project (Jerry CXX C ASM)
|
||||
set(LINKER_FLAGS_COMMON "${LINKER_FLAGS_COMMON} ${LINKER_FLAGS_COMMON_${PLATFORM_EXT}}")
|
||||
set(SOURCE_JERRY_STANDALONE_MAIN ${SOURCE_JERRY_STANDALONE_MAIN_${PLATFORM_EXT}})
|
||||
|
||||
# Definitions
|
||||
# Memory statistics
|
||||
set(DEFINES_MEMORY_STATISTICS MEM_STATS)
|
||||
|
||||
# Component targets
|
||||
# Jerry's libc
|
||||
if(NOT ${USE_EXTERNAL_LIBC})
|
||||
@ -278,15 +274,16 @@ project (Jerry CXX C ASM)
|
||||
set(LIBC_TARGET_NAME ${BUILD_MODE_PREFIX_${BUILD_MODE}}.jerry-libc.${PLATFORM_L}.lib)
|
||||
|
||||
function(declare_target_with_modifiers ) # modifiers are passed in ARGN implicit argument
|
||||
set(DEFINES_JERRY)
|
||||
set(CORE_TARGET_NAME ${BUILD_MODE_PREFIX_${BUILD_MODE}})
|
||||
foreach(MODIFIER ${ARGN})
|
||||
set(TARGET_NAME ${TARGET_NAME}${MODIFIER_SUFFIX_${MODIFIER}})
|
||||
|
||||
set(CORE_TARGET_NAME ${CORE_TARGET_NAME}${MODIFIER_SUFFIX_${MODIFIER}})
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} ${DEFINES_${MODIFIER}})
|
||||
endforeach()
|
||||
set(CORE_TARGET_NAME ${CORE_TARGET_NAME}.jerry-core)
|
||||
|
||||
set(DEFINES_JERRY )
|
||||
|
||||
if(NOT ${EXTERNAL_BUILD})
|
||||
add_executable(${TARGET_NAME} ${SOURCE_JERRY_STANDALONE_MAIN})
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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 ();
|
||||
|
||||
@ -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 */
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -141,11 +141,7 @@ main (int argc,
|
||||
}
|
||||
else if (!strcmp ("--mem-stats", argv[i]))
|
||||
{
|
||||
#ifdef MEM_STATS
|
||||
flags |= JERRY_FLAG_MEM_STATS;
|
||||
#else /* MEM_STATS */
|
||||
printf ("Ignoring --mem-stats because of '!MEM_STATS' build configuration.\n");
|
||||
#endif /* !MEM_STATS */
|
||||
}
|
||||
else if (!strcmp ("--parse-only", argv[i]))
|
||||
{
|
||||
|
||||
@ -148,11 +148,7 @@ int jerry_main (int argc, char *argv[])
|
||||
}
|
||||
else if (!strcmp ("--mem-stats", argv[i]))
|
||||
{
|
||||
#ifdef MEM_STATS
|
||||
flags |= JERRY_FLAG_MEM_STATS;
|
||||
#else /* MEM_STATS */
|
||||
printf ("Ignoring --mem-stats because of '!MEM_STATS' build configuration.\n");
|
||||
#endif /* !MEM_STATS */
|
||||
}
|
||||
else if (!strcmp ("--parse-only", argv[i]))
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user