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:
Ruben Ayrapetyan
2015-04-23 15:50:58 +03:00
parent bb258ad1e2
commit d8adf0de2c
4 changed files with 24 additions and 14 deletions
+5 -4
View File
@@ -904,7 +904,7 @@ jerry_init (jerry_flag_t flags) /**< combination of Jerry flags */
jerry_flags = flags;
#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");
}
@@ -921,7 +921,7 @@ jerry_init (jerry_flag_t flags) /**< combination of Jerry flags */
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 ();
serializer_free ();
@@ -966,8 +966,9 @@ jerry_parse (const char* source_p, /**< script source */
serializer_print_opcodes ();
parser_free ();
bool is_show_mem_stats = ((jerry_flags & JERRY_FLAG_MEM_STATS) != 0);
init_int (opcodes, is_show_mem_stats);
bool is_show_mem_stats_per_opcode = ((jerry_flags & JERRY_FLAG_MEM_STATS_PER_OPCODE) != 0);
init_int (opcodes, is_show_mem_stats_per_opcode);
return true;
} /* jerry_parse */
+7 -6
View File
@@ -31,12 +31,13 @@
*/
typedef uint32_t jerry_flag_t;
#define JERRY_FLAG_EMPTY (0) /**< empty flag set */
#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
* (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)
* FIXME: Remove. */
#define JERRY_FLAG_EMPTY (0) /**< empty flag set */
#define JERRY_FLAG_SHOW_OPCODES (1 << 0) /**< dump opcodes to stdout after parse */
#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) */
#define JERRY_FLAG_MEM_STATS_PER_OPCODE (1 << 2) /**< dump peak memory statistics before exit */
#define JERRY_FLAG_PARSE_ONLY (1 << 3) /**< parse only, prevents script execution (only for testing)
* FIXME: Remove. */
/**
* Error codes
+6 -2
View File
@@ -139,9 +139,13 @@ main (int argc,
printf ("Branch name:\t%s\n", jerry_branch_name);
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]))
{
+6 -2
View File
@@ -146,9 +146,13 @@ int jerry_main (int argc, char *argv[])
printf ("Commit hash:\t%s\n", jerry_commit_hash);
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]))
{