add --mem-stats flag to print memory usage statistics at exit
This commit is contained in:
+9
-2
@@ -146,6 +146,7 @@ main (int argc __unused,
|
|||||||
{
|
{
|
||||||
const char *file_name = NULL;
|
const char *file_name = NULL;
|
||||||
bool parse_only = false;
|
bool parse_only = false;
|
||||||
|
bool print_mem_stats = false;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 1; i < argc; 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("Branch name:\t%s\n", JERRY_BRANCH_NAME);
|
||||||
__printf("\n");
|
__printf("\n");
|
||||||
}
|
}
|
||||||
|
if (!__strcmp ("--mem-stats", argv[i]))
|
||||||
|
{
|
||||||
|
print_mem_stats = true;
|
||||||
|
}
|
||||||
else if (!__strcmp ("--parse-only", argv[i]))
|
else if (!__strcmp ("--parse-only", argv[i]))
|
||||||
{
|
{
|
||||||
parse_only = true;
|
parse_only = true;
|
||||||
@@ -181,8 +186,10 @@ main (int argc __unused,
|
|||||||
|
|
||||||
jerry_run (source_p, source_size, parse_only);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user