mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
This patch: * Ensures that all calls to `jerry_port_log` in jerry-core happen via macros defined in jrt.h. Also, it unifies the names of those macros: as `JERRY_ERROR_MSG` and `JERRY_WARNING_MSG` gave a good pattern that was well aligned with the naming scheme of the log level enum, `JERRY_DLOG` and `JERRY_DDLOG` were rewritten to `JERRY_DEBUG_MSG` and `JERRY_TRACE_MSG`. * Ensures that all debug logging code parts of jerry-core (i.e., memory statistics, JS byte-code dumps, and RegExp byte-code dumps) are guarded by macros: `JMEM_STATS`, `PARSER_DUMP_BYTE_CODE`, and `REGEXP_DUMP_BYTE_CODE`, which in turn are controled by cmake build system feature flags `FEATURE_MEM_STATS`, `FEATURE_PARSER_DUMP`, and `FEATURE_REGEXP_DUMP`. * Ensures that all debug logging functionalities can be controled during run time (provided that they were enabled during build time): the engine has `JERRY_INIT_MEM_STATS[_SEPARATE]`, `JERRY_INIT_SHOW_OPCODES`, `JERRY_INIT_SHOW_REGEXP_OPCODES` init flags, and the default unix/linux command line app has corresponding command line switches.` * Drops `FEATURE_LOG`, `JERRY_ENABLE_LOG`, and `JERRY_INIT_ENABLE_LOG`, as their name was misleadingly general, even though they mostly controled the regexp engine only. The above-mentioned `*REGEXP*` things mostly act as their replacements. * Updates build, test, and measurement tool scripts, and documentation. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
86 lines
2.3 KiB
Bash
Executable File
86 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
|
|
# Copyright 2016 University of Szeged.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# Choosing table or semicolon-separated output mode
|
|
if [ "$1" == "-d" ]
|
|
then
|
|
TABLE="no"
|
|
PRINT_TEST_NAME_AWK_SCRIPT='{printf "%s;", $1}'
|
|
PRINT_TOTAL_AWK_SCRIPT='{printf "%d;%d;%d\n", $1, $2, $3 * 1024}'
|
|
|
|
shift
|
|
else
|
|
PRINT_TEST_NAME_AWK_SCRIPT='{printf "%30s", $1}'
|
|
PRINT_TOTAL_AWK_SCRIPT='{printf "%25d%25d%25d\n", $1, $2, $3 * 1024}'
|
|
TABLE="yes"
|
|
fi
|
|
|
|
function fail_msg
|
|
{
|
|
echo "$1"
|
|
exit 1
|
|
}
|
|
|
|
# Engine
|
|
|
|
# Check if the specified build supports memory statistics options
|
|
function is_mem_stats_build
|
|
{
|
|
[ -x "$1" ] || fail_msg "Engine '$1' is not executable"
|
|
|
|
tmpfile=`mktemp`
|
|
"$1" --mem-stats $tmpfile 2>&1 | grep -- "Ignoring JERRY_INIT_MEM_STATS flag because of !JMEM_STATS configuration." 2>&1 > /dev/null
|
|
code=$?
|
|
rm $tmpfile
|
|
|
|
return $code
|
|
}
|
|
|
|
JERRY="$1"
|
|
shift
|
|
is_mem_stats_build "$JERRY" || fail_msg "First engine specified should be built without memory statistics support"
|
|
|
|
JERRY_MEM_STATS="$1"
|
|
shift
|
|
is_mem_stats_build "$JERRY_MEM_STATS" && fail_msg "Second engine specified should be built with memory statistics support"
|
|
|
|
# Benchmarks list
|
|
BENCHMARKS=""
|
|
|
|
while [ $# -ne 0 ]
|
|
do
|
|
BENCHMARKS="$BENCHMARKS $1"
|
|
shift
|
|
done
|
|
|
|
# Running
|
|
if [ "$TABLE" == "yes" ]
|
|
then
|
|
awk 'BEGIN {printf "%30s%25s%25s%25s\n", "Test name", "Peak Heap (parser)", "Peak Heap (execution)", "Maximum RSS"}'
|
|
echo
|
|
fi
|
|
|
|
for bench in $BENCHMARKS
|
|
do
|
|
test=`basename $bench .js`
|
|
|
|
echo "$test" | awk "$PRINT_TEST_NAME_AWK_SCRIPT"
|
|
MEM_STATS=$("$JERRY_MEM_STATS" --mem-stats --mem-stats-separate $bench | grep -e "Peak allocated =" | grep -o "[0-9]*")
|
|
RSS=$(./tools/rss-measure.sh "$JERRY" $bench | tail -n 1 | grep -o "[0-9]*")
|
|
echo $MEM_STATS $RSS | xargs | awk "$PRINT_TOTAL_AWK_SCRIPT"
|
|
done
|