Splitting --mem-stats option to --mem-stats-at-exit and --mem-stats-per-opcode.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
@@ -904,7 +904,7 @@ jerry_init (jerry_flag_t flags) /**< combination of Jerry flags */
|
|||||||
jerry_flags = flags;
|
jerry_flags = flags;
|
||||||
|
|
||||||
#ifndef MEM_STATS
|
#ifndef MEM_STATS
|
||||||
if (flags & JERRY_FLAG_MEM_STATS)
|
if (flags & (JERRY_FLAG_MEM_STATS_AT_EXIT | JERRY_FLAG_MEM_STATS_PER_OPCODE))
|
||||||
{
|
{
|
||||||
printf ("Ignoring memory statistics option because of '!MEM_STATS' build configuration.\n");
|
printf ("Ignoring memory statistics option because of '!MEM_STATS' build configuration.\n");
|
||||||
}
|
}
|
||||||
@@ -921,7 +921,7 @@ jerry_init (jerry_flag_t flags) /**< combination of Jerry flags */
|
|||||||
void
|
void
|
||||||
jerry_cleanup (void)
|
jerry_cleanup (void)
|
||||||
{
|
{
|
||||||
bool is_show_mem_stats = ((jerry_flags & JERRY_FLAG_MEM_STATS) != 0);
|
bool is_show_mem_stats = ((jerry_flags & JERRY_FLAG_MEM_STATS_AT_EXIT) != 0);
|
||||||
|
|
||||||
ecma_finalize ();
|
ecma_finalize ();
|
||||||
serializer_free ();
|
serializer_free ();
|
||||||
@@ -966,8 +966,9 @@ jerry_parse (const char* source_p, /**< script source */
|
|||||||
serializer_print_opcodes ();
|
serializer_print_opcodes ();
|
||||||
parser_free ();
|
parser_free ();
|
||||||
|
|
||||||
bool is_show_mem_stats = ((jerry_flags & JERRY_FLAG_MEM_STATS) != 0);
|
bool is_show_mem_stats_per_opcode = ((jerry_flags & JERRY_FLAG_MEM_STATS_PER_OPCODE) != 0);
|
||||||
init_int (opcodes, is_show_mem_stats);
|
|
||||||
|
init_int (opcodes, is_show_mem_stats_per_opcode);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} /* jerry_parse */
|
} /* jerry_parse */
|
||||||
|
|||||||
+7
-6
@@ -31,12 +31,13 @@
|
|||||||
*/
|
*/
|
||||||
typedef uint32_t jerry_flag_t;
|
typedef uint32_t jerry_flag_t;
|
||||||
|
|
||||||
#define JERRY_FLAG_EMPTY (0) /**< empty flag set */
|
#define JERRY_FLAG_EMPTY (0) /**< empty flag set */
|
||||||
#define JERRY_FLAG_SHOW_OPCODES (1 << 0) /**< dump opcodes to stdout after parse */
|
#define JERRY_FLAG_SHOW_OPCODES (1 << 0) /**< dump opcodes to stdout after parse */
|
||||||
#define JERRY_FLAG_MEM_STATS (1 << 1) /**< dump per-opcode memory statistics during execution
|
#define JERRY_FLAG_MEM_STATS_AT_EXIT (1 << 1) /**< dump per-opcode memory statistics during execution
|
||||||
* (in the mode full GC is performed after each opcode handler) */
|
* (in the mode full GC is performed after each opcode handler) */
|
||||||
#define JERRY_FLAG_PARSE_ONLY (1 << 2) /**< parse only, prevents script execution (only for testing)
|
#define JERRY_FLAG_MEM_STATS_PER_OPCODE (1 << 2) /**< dump peak memory statistics before exit */
|
||||||
* FIXME: Remove. */
|
#define JERRY_FLAG_PARSE_ONLY (1 << 3) /**< parse only, prevents script execution (only for testing)
|
||||||
|
* FIXME: Remove. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error codes
|
* Error codes
|
||||||
|
|||||||
+6
-2
@@ -139,9 +139,13 @@ main (int argc,
|
|||||||
printf ("Branch name:\t%s\n", jerry_branch_name);
|
printf ("Branch name:\t%s\n", jerry_branch_name);
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
}
|
}
|
||||||
else if (!strcmp ("--mem-stats", argv[i]))
|
else if (!strcmp ("--mem-stats-at-exit", argv[i]))
|
||||||
{
|
{
|
||||||
flags |= JERRY_FLAG_MEM_STATS;
|
flags |= JERRY_FLAG_MEM_STATS_AT_EXIT;
|
||||||
|
}
|
||||||
|
else if (!strcmp ("--mem-stats-per-opcode", argv[i]))
|
||||||
|
{
|
||||||
|
flags |= JERRY_FLAG_MEM_STATS_PER_OPCODE;
|
||||||
}
|
}
|
||||||
else if (!strcmp ("--parse-only", argv[i]))
|
else if (!strcmp ("--parse-only", argv[i]))
|
||||||
{
|
{
|
||||||
|
|||||||
+6
-2
@@ -146,9 +146,13 @@ int jerry_main (int argc, char *argv[])
|
|||||||
printf ("Commit hash:\t%s\n", jerry_commit_hash);
|
printf ("Commit hash:\t%s\n", jerry_commit_hash);
|
||||||
printf ("Branch name:\t%s\n", jerry_branch_name);
|
printf ("Branch name:\t%s\n", jerry_branch_name);
|
||||||
}
|
}
|
||||||
else if (!strcmp ("--mem-stats", argv[i]))
|
else if (!strcmp ("--mem-stats-at-exit", argv[i]))
|
||||||
{
|
{
|
||||||
flags |= JERRY_FLAG_MEM_STATS;
|
flags |= JERRY_FLAG_MEM_STATS_AT_EXIT;
|
||||||
|
}
|
||||||
|
else if (!strcmp ("--mem-stats-per-opcode", argv[i]))
|
||||||
|
{
|
||||||
|
flags |= JERRY_FLAG_MEM_STATS_PER_OPCODE;
|
||||||
}
|
}
|
||||||
else if (!strcmp ("--parse-only", argv[i]))
|
else if (!strcmp ("--parse-only", argv[i]))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user