-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add benchmark script #156
Merged
+107
−0
Merged
Add benchmark script #156
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2214520
Prototype for running a subset of benchmarks on a pull request (#58)
gareth-ellis 95d27e9
Updating run.sh to include saving the output csv + saving output
gareth-ellis af0f115
src: allow 3 way merge for bench runs (#287)
mhdawson 5d320bc
add compiler selection (#302)
mhdawson d0958c7
move benchmark script
rluvaton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#!/bin/bash | ||
function mandatory() { | ||
if [ -z "${!1}" ]; then | ||
echo "${1} not set" | ||
usage | ||
exit | ||
fi | ||
} | ||
|
||
function optional() { | ||
if [ -z "${!1}" ]; then | ||
echo -n "${1} not set (ok)" | ||
if [ -n "${2}" ]; then | ||
echo -n ", default is: ${2}" | ||
export ${1}="${2}" | ||
fi | ||
echo "" | ||
fi | ||
} | ||
function usage(){ | ||
echo "Usage:" | ||
|
||
echo "This script has two use cases:" | ||
echo "Use case 1: We want to test the impact of a PR on a branch." | ||
echo "To run this, declare:" | ||
echo "The script expects the following variables to be set:" | ||
echo "CATEGORY = a category of tests to run - folders in benchmark/" | ||
echo "BRANCH = the branch the test should be based off. e.g. master" | ||
echo "PULL_ID = the pull request that contains changes to test" | ||
echo "-------------------------------------------------------------" | ||
echo "Use case 2: We want to compare two branches, tags or commits." | ||
echo "To run this, declare:" | ||
echo "CATEGORY = a category of tests to run - folders in benchmark/" | ||
echo "BASE = the branch/tag/commit the test should be based off. e.g. master" | ||
echo "TARGET = the branch/tag/commit to compare against base" | ||
echo "-------------------------------------------------------------" | ||
echo "The following are optional across both use cases" | ||
echo "RUNS = defaults to empty" | ||
echo "FILTER = defaults to empty" | ||
echo "MACHINE_THREADS - used for building node. Defaults to all threads on machine" | ||
|
||
} | ||
|
||
if [ -z $PULL_ID ]; then | ||
#PULL_ID isn't declared. Therefore we are probably in use case #2 | ||
export USE_CASE=2 | ||
mandatory BASE | ||
mandatory TARGET | ||
else | ||
export USE_CASE=1 | ||
mandatory BRANCH | ||
mandatory PULL_ID | ||
fi | ||
mandatory CATEGORY | ||
optional RUNS | ||
optional FILTER | ||
getMACHINE_THREADS=`cat /proc/cpuinfo |grep processor|tail -n1|awk {'print $3'}` | ||
let getMACHINE_THREADS=getMACHINE_THREADS+1 #getting threads this way is 0 based. Add one | ||
optional MACHINE_THREADS $getMACHINE_THREADS | ||
rm -rf node | ||
git clone https://github.com/nodejs/node.git | ||
cd node | ||
case $USE_CASE in | ||
1) | ||
git checkout $BRANCH | ||
;; | ||
2) | ||
git checkout $BASE | ||
;; | ||
esac | ||
|
||
# build master | ||
# select the appropriate compiler | ||
curl -sLO https://raw.githubusercontent.com/nodejs/build/master/jenkins/scripts/select-compiler.sh | ||
. ./select-compiler.sh | ||
./configure > ../node-master-build.log | ||
make -j${MACHINE_THREADS} >> ../node-master-build.log | ||
mv out/Release/node ./node-master | ||
|
||
# build pr | ||
case $USE_CASE in | ||
1) | ||
curl -L https://github.com/nodejs/node/pull/${PULL_ID}.patch|git apply -3 | ||
;; | ||
2) | ||
git checkout $TARGET | ||
;; | ||
esac | ||
# select the appropriate compiler | ||
. ./select-compiler.sh | ||
./configure > ../node-pr-build.log | ||
make -j${MACHINE_THREADS} >> ../node-pr-build.log | ||
mv out/Release/node ./node-pr | ||
if [ -n "$FILTER" ]; then | ||
FILTER="--filter ${FILTER}" | ||
fi | ||
if [ -n "$RUNS" ]; then | ||
RUNS="--runs ${RUNS}" | ||
fi | ||
# run benchmark | ||
fileName=output`date +%d%m%y-%H%M%S`.csv | ||
echo "Output will be saved to $fileName" | ||
pwd | ||
./node-master benchmark/compare.js --old ./node-master --new ./node-pr $FILTER $RUNS -- $CATEGORY | tee $fileName | ||
|
||
cat $fileName | Rscript benchmark/compare.R | ||
mv $fileName $startDir |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the CPUSET instruction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to add in different pr, just creating this with the history of the original file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed git history