dart-sdk/sdk/bin/dartdevc_sdk
Jonas Termansen 8cbc4f3982 [benchmark] Add support for benchmarking DDC.
This change adds the required support to benchmark DDC just like dart2js.

The ddb tool gains the following options:

  --compile-vm-options=VM-OPTIONS
      The value of the DART_VM_OPTIONS environment variable set when running
      dartdevc. This option is required to measure the memory use of
      dartdevc while compiling.

  --packages=PACKAGES-FILE
      The .packages file to use when compiling. This option is required for
      special benchmarks with a .packages in a subdirectory and is generally
      useful.

  --out=OUTPUT-FILE
      Write the compiled javascript to this path and the other generated
      files along it. This option makes the benchmark configuration easier
      and is generally useful.

The dartdevc and dartdevc.bat scripts in the released Dart SDK now gains
support for the DART_VM_OPTIONS environment variable, just like the dart2js
scripts. This feature is needed to measure the memory usage of the Dart VM
executing dartdevc.

tools/bots/try_benchmarks.sh now tests that ddb can compile and run
benchmarks using the needed features.

Change-Id: Ib1ef07b0888a8c0cf900fe2fbb5697aab733db08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118440
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2019-09-25 09:48:00 +00:00

39 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Run dev compiler on the Dart VM. This script assumes the Dart SDK's
# directory structure.
function follow_links() {
file="$1"
while [ -h "$file" ]; do
# On Mac OS, readlink -f doesn't work.
file="$(readlink "$file")"
done
echo "$file"
}
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
PROG_NAME="$(follow_links "$BASH_SOURCE")"
# Handle the case where dart-sdk/bin has been symlinked to.
BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
SNAPSHOT="$BIN_DIR/snapshots/dartdevc.dart.snapshot"
# We are running the snapshot in the built SDK.
DART="$BIN_DIR/dart"
unset EXTRA_VM_OPTIONS
declare -a EXTRA_VM_OPTIONS
# We allow extra vm options to be passed in through an environment variable.
if [[ $DART_VM_OPTIONS ]]; then
read -a OPTIONS <<< "$DART_VM_OPTIONS"
EXTRA_VM_OPTIONS+=("${OPTIONS[@]}")
fi
exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "$@"