-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add benchmark filter run script (#3271)
* Added benchmark run script Signed-off-by: Calum Murray <[email protected]> * Updated docs to explain how to run filter benchmarks Signed-off-by: Calum Murray <[email protected]> * Add time in unix to each benchmark run output file Signed-off-by: Calum Murray <[email protected]> * Actually use the logging config file Signed-off-by: Calum Murray <[email protected]> * Added check to see if a valid classname is provided Signed-off-by: Calum Murray <[email protected]> * Added list of available java benchmark classes to README Signed-off-by: Calum Murray <[email protected]> --------- Signed-off-by: Calum Murray <[email protected]>
- Loading branch information
Showing
6 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- | ||
Copyright © 2018 Knative Authors ([email protected]) | ||
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. | ||
--> | ||
<configuration> | ||
<appender name="jsonConsoleAppender" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/> | ||
</appender> | ||
<root level="INFO"> | ||
<appender-ref ref="jsonConsoleAppender"/> | ||
</root> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ExactFilterBenchmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright © 2018 Knative Authors ([email protected]) | ||
# | ||
# 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 | ||
|
||
TIME=$(date +%s) | ||
|
||
run_java_filter_benchmarks_for_class() { | ||
CLASS=$1 | ||
|
||
echo "Running benchmarks for ${CLASS}" | ||
|
||
java -Dlogback.configurationFile=${SCRIPT_DIR}/resources/config-logging.xml \ | ||
-jar "${SCRIPT_DIR}/target/benchmarks.jar" $CLASS 2>&1 | tee "${SCRIPT_DIR}/output/${CLASS}.${TIME}.out.txt" | ||
|
||
echo "Successfully ran benchmarks for ${CLASS}!\n\nThe results can be found at ${SCRIPT_DIR}/output/${CLASS}.${TIME}.out.txt" | ||
} | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
|
||
DATA_PLANE_DIR="${SCRIPT_DIR}/../" | ||
|
||
# check if the benchmark class exists | ||
|
||
if [[ ! -z $1 ]]; then | ||
FOUND=0 | ||
while IFS="" read -r p || [[ -n "$p" ]]; do | ||
if [[ "$1" == "$p" ]]; then | ||
FOUND=1 | ||
break | ||
fi | ||
done <"${SCRIPT_DIR}/resources/filter-class-list.txt" | ||
if [[ "$FOUND" != 1 ]]; then | ||
echo "Please provide a valid class name for a filter benchmark" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
pushd ${DATA_PLANE_DIR} || return $? | ||
|
||
# build only benchmarks and it's dependents - skip aggregating licenses as it will be missing licenses due to only | ||
# building some projects | ||
./mvnw clean package -DskipTests -Dlicense.skipAggregateDownloadLicenses -Dlicense.skipAggregateAddThirdParty -P no-release -pl benchmarks -am | ||
|
||
popd || return $? | ||
|
||
mkdir -p "${SCRIPT_DIR}/output" | ||
|
||
if [[ -z $1 ]]; then | ||
while IFS="" read -r p || [ -n "$p" ]; do | ||
run_java_filter_benchmarks_for_class "$p" | ||
done <"${SCRIPT_DIR}/resources/filter-class-list.txt" | ||
else | ||
run_java_filter_benchmarks_for_class $1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters