add --mem-stats flag to print memory usage statistics at exit

This commit is contained in:
e.gavrin
2014-07-31 17:56:17 +04:00
parent 2c85a55c85
commit 6f7e2ecdbc
+9 -2
View File
@@ -146,6 +146,7 @@ main (int argc __unused,
{
const char *file_name = NULL;
bool parse_only = false;
bool print_mem_stats = false;
int i;
for (i = 1; i < argc; i++)
@@ -157,6 +158,10 @@ main (int argc __unused,
__printf("Branch name:\t%s\n", JERRY_BRANCH_NAME);
__printf("\n");
}
if (!__strcmp ("--mem-stats", argv[i]))
{
print_mem_stats = true;
}
else if (!__strcmp ("--parse-only", argv[i]))
{
parse_only = true;
@@ -181,8 +186,10 @@ main (int argc __unused,
jerry_run (source_p, source_size, parse_only);
mem_heap_print( false, false, true);
if (print_mem_stats)
{
mem_heap_print( false, false, true);
}
return 0;
}
#endif