diff options
author | Mads Ager <ager@google.com> | 2022-03-31 12:48:55 +0200 |
---|---|---|
committer | Jiaxiang Chen <roaringacw@gmail.com> | 2022-03-31 13:22:51 -0700 |
commit | 938f2ebcdaa32799442c05b5762c2b72cac998bb (patch) | |
tree | 3b696ac97ed197edb9e7edf6ba2229a8f31ffc6f /benchmark | |
parent | 8e7ad59da55fbec1876445f1820ecbc0dcde8c73 (diff) | |
download | ksp-938f2ebcdaa32799442c05b5762c2b72cac998bb.tar.gz |
Add script to upload benchmark data.
Minor tweaks to runner and benchmark data build scripts.
Benchmark runner can now be used in the ksp repo with just the
benchmark name as the argument:
`./benchmark/runner/runner.sh TachiyomiExhaustive`
Diffstat (limited to 'benchmark')
-rwxr-xr-x | benchmark/TachiyomiExhaustive/build.sh | 1 | ||||
-rwxr-xr-x | benchmark/TachiyomiExhaustive/upload-benchmark-data.sh | 30 | ||||
-rwxr-xr-x | benchmark/runner/runner.sh | 27 |
3 files changed, 55 insertions, 3 deletions
diff --git a/benchmark/TachiyomiExhaustive/build.sh b/benchmark/TachiyomiExhaustive/build.sh index bfd8be31..cadbfa03 100755 --- a/benchmark/TachiyomiExhaustive/build.sh +++ b/benchmark/TachiyomiExhaustive/build.sh @@ -19,6 +19,7 @@ set -e SCRIPT_DIR=$(dirname "$(realpath $0)") ROOT=$SCRIPT_DIR/../.. cd $SCRIPT_DIR +rm -rf tachiyomi git clone https://github.com/inorichi/tachiyomi.git cd tachiyomi git checkout 938339690eecdfe309d83264b6a89aff3c767687 diff --git a/benchmark/TachiyomiExhaustive/upload-benchmark-data.sh b/benchmark/TachiyomiExhaustive/upload-benchmark-data.sh new file mode 100755 index 00000000..b3eba05e --- /dev/null +++ b/benchmark/TachiyomiExhaustive/upload-benchmark-data.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copyright 2022 Google LLC +# +# 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. +# + +set -e +SCRIPT_DIR=$(dirname "$(realpath $0)") +cd $SCRIPT_DIR +TEMP_DIR=$(mktemp -d) +BUNDLE=$TEMP_DIR/tachiyomi-exhaustive.tar.gz +tar cfz $BUNDLE tachiyomi lib +BUNDLE_HASH_AND_NAME=$(sha256sum $BUNDLE) +BUNDLE_HASH=$(echo $BUNDLE_HASH_AND_NAME | cut -d " " -f 1) +BUNDLE_UPLOAD_LOCATION=gs://r8-deps/ksp-bench/$BUNDLE_HASH.tar.gz +BUNDLE_DOWNLOAD_LOCATION=http://storage.googleapis.com/r8-deps/ksp-bench/$BUNDLE_HASH.tar.gz +echo Uploading to: $BUNDLE_UPLOAD_LOCATION +gsutil.py cp -a public-read $BUNDLE $BUNDLE_UPLOAD_LOCATION +echo Available for download at: $BUNDLE_DOWNLOAD_LOCATION diff --git a/benchmark/runner/runner.sh b/benchmark/runner/runner.sh index 4034365a..70a25a4e 100755 --- a/benchmark/runner/runner.sh +++ b/benchmark/runner/runner.sh @@ -15,12 +15,33 @@ # limitations under the License. set -e + +SCRIPT_DIR=$(dirname "$(realpath $0)") BENCHMARK_DIR=$1 PREFIX=$2 -SCRIPT_DIR=$(dirname "$(realpath $0)") +if [ -z $PREFIX ] +then + PREFIX=.. +fi + +JAVA_ARG=$3 + +if [ -z $JAVA_ARG ] +then + JAVA=java +else + JAVA=$(realpath $SCRIPT_DIR/$JAVA_ARG) +fi + +BENCHMARK_DATA_DIR=$(realpath $SCRIPT_DIR/$PREFIX/$BENCHMARK_DIR) + +echo Running benchmark: $BENCHMARK_DIR +echo With benchmark data directory: $BENCHMARK_DATA_DIR +echo Using java: $JAVA + cd $SCRIPT_DIR -CP=../build/libs/benchmark.jar:$(echo $SCRIPT_DIR/$PREFIX/$BENCHMARK_DIR/lib/*.jar | tr ' ' ':') +CP=../build/libs/benchmark.jar:$(echo $BENCHMARK_DATA_DIR/lib/*.jar | tr ' ' ':') KSP_PLUGIN_ID=com.google.devtools.ksp.symbol-processing KSP_PLUGIN_OPT=plugin:$KSP_PLUGIN_ID @@ -30,7 +51,7 @@ KSP_API_JAR=./com/google/devtools/ksp/symbol-processing-api/2.0.255/symbol-proce AP=processor-1.0-SNAPSHOT.jar mkdir -p out -find $SCRIPT_DIR/$PREFIX/$BENCHMARK_DIR -name "*.kt" | xargs java -cp $CP com.google.devtools.ksp.BenchRunnerKt $BENCHMARK_DIR\ +find $BENCHMARK_DATA_DIR -name "*.kt" | xargs $JAVA -cp $CP com.google.devtools.ksp.BenchRunnerKt $BENCHMARK_DIR\ -kotlin-home . \ -Xplugin=$KSP_PLUGIN_JAR \ -Xplugin=$KSP_API_JAR \ |