Skip to content

Commit 9c124e2

Browse files
akosthekissLaszloLango
authored andcommitted
Revive mem_stats.sh
The tool became bitrotten. Bringing it up-to-date to handle the output of jerry and rss-measure.sh properly. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]
1 parent ca01412 commit 9c124e2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tools/mem_stats.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Copyright 2015 Samsung Electronics Co., Ltd.
3+
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -19,12 +19,12 @@ if [ "$1" == "-d" ]
1919
then
2020
TABLE="no"
2121
PRINT_TEST_NAME_AWK_SCRIPT='{printf "%s;", $1}'
22-
PRINT_TOTAL_AWK_SCRIPT='{printf "%d;%d;%d;%d\n", $1, $2, $4, $5 * 1024}'
22+
PRINT_TOTAL_AWK_SCRIPT='{printf "%d;%d;%d\n", $1, $2, $3 * 1024}'
2323

2424
shift
2525
else
2626
PRINT_TEST_NAME_AWK_SCRIPT='{printf "%30s", $1}'
27-
PRINT_TOTAL_AWK_SCRIPT='{printf "%25d%35d%35d%20d\n", $1, $2, $4, $5 * 1024}'
27+
PRINT_TOTAL_AWK_SCRIPT='{printf "%25d%25d%25d\n", $1, $2, $3 * 1024}'
2828
TABLE="yes"
2929
fi
3030

@@ -42,7 +42,7 @@ function is_mem_stats_build
4242
[ -x "$1" ] || fail_msg "Engine '$1' is not executable"
4343

4444
tmpfile=`mktemp`
45-
"$1" --mem-stats $tmpfile | grep -- "Ignoring memory statistics option because of '!MEM_STATS' build configuration." 2>&1 > /dev/null
45+
"$1" --mem-stats $tmpfile 2>&1 | grep -- "Ignoring memory statistics option because of '!MEM_STATS' build configuration." 2>&1 > /dev/null
4646
code=$?
4747
rm $tmpfile
4848

@@ -69,7 +69,7 @@ done
6969
# Running
7070
if [ "$TABLE" == "yes" ]
7171
then
72-
awk 'BEGIN {printf "%30s%25s%35s%35s%20s\n", "Test name", "Heap (byte-code)", "Heap (byte-code + parser)", "Heap (byte-code + execution)", "Maximum RSS"}'
72+
awk 'BEGIN {printf "%30s%25s%25s%25s\n", "Test name", "Peak Heap (parser)", "Peak Heap (execution)", "Maximum RSS"}'
7373
echo
7474
fi
7575

@@ -78,7 +78,7 @@ do
7878
test=`basename -s '.js' $bench`
7979

8080
echo "$test" | awk "$PRINT_TEST_NAME_AWK_SCRIPT"
81-
MEM_STATS=$("$JERRY_MEM_STATS" --mem-stats --mem-stats-separate $bench | grep -e "Peak allocated=" -e "Allocated =" | grep -o "[0-9]*")
82-
RSS=$(./tools/rss-measure.sh "$JERRY" $bench | tail -n 1 | grep -e "Rss" | grep -o "[0-9]*")
81+
MEM_STATS=$("$JERRY_MEM_STATS" --mem-stats --mem-stats-separate $bench | grep -e "Peak allocated =" | grep -o "[0-9]*")
82+
RSS=$(./tools/rss-measure.sh "$JERRY" $bench | tail -n 1 | grep -o "[0-9]*")
8383
echo $MEM_STATS $RSS | xargs | awk "$PRINT_TOTAL_AWK_SCRIPT"
8484
done

0 commit comments

Comments
 (0)