3 source_directory=$BUILD_SOURCESDIRECTORY
6 framework=netcoreapp5.0
7 compilation_mode=tiered
8 repository=$BUILD_REPOSITORY_NAME
9 branch=$BUILD_SOURCEBRANCH
10 commit_sha=$BUILD_SOURCEVERSION
11 build_number=$BUILD_BUILDNUMBER
14 run_categories="coreclr corefx"
15 csproj="src\benchmarks\micro\MicroBenchmarks.csproj"
17 run_from_perf_repo=false
21 lowerI="$(echo $1 | awk '{print tolower($0)}')"
28 core_root_directory=$2
80 echo "Common settings:"
81 echo " --corerootdirectory <value> Directory where Core_Root exists, if running perf testing with --corerun"
82 echo " --architecture <value> Architecture of the testing being run"
83 echo " --configurations <value> List of key=value pairs that will be passed to perf testing infrastructure."
84 echo " ex: --configurations \"CompilationMode=Tiered OptimzationLevel=PGO\""
85 echo " --help Print help and exit"
87 echo "Advanced settings:"
88 echo " --framework <value> The framework to run, if not running in master"
89 echo " --compliationmode <value> The compilation mode if not passing --configurations"
90 echo " --sourcedirectory <value> The directory of the sources. Defaults to env:BUILD_SOURCESDIRECTORY"
91 echo " --repository <value> The name of the repository in the <owner>/<repository name> format. Defaults to env:BUILD_REPOSITORY_NAME"
92 echo " --branch <value> The name of the branch. Defaults to env:BUILD_SOURCEBRANCH"
93 echo " --commitsha <value> The commit sha1 to run against. Defaults to env:BUILD_SOURCEVERSION"
94 echo " --buildnumber <value> The build number currently running. Defaults to env:BUILD_BUILDNUMBER"
95 echo " --csproj The relative path to the benchmark csproj whose tests should be run. Defaults to src\benchmarks\micro\MicroBenchmarks.csproj"
96 echo " --kind <value> Related to csproj. The kind of benchmarks that should be run. Defaults to micro"
97 echo " --runcategories <value> Related to csproj. Categories of benchmarks to run. Defaults to \"coreclr corefx\""
98 echo " --internal If the benchmarks are running as an official job."
105 if [[ "$repository" == "dotnet/performance" ]]; then
106 run_from_perf_repo=true
109 if [ -z "$configurations" ]; then
110 configurations="CompliationMode=$compilation_mode"
113 if [ -z "$core_root_directory" ]; then
117 payload_directory=$source_directory/Payload
118 performance_directory=$payload_directory/performance
119 workitem_directory=$source_directory/workitem
120 extra_benchmark_dotnet_arguments="--iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true"
122 queue=Ubuntu.1804.Amd64.Open
123 creator=$BUILD_DEFINITIONNAME
124 helix_source_prefix="pr"
126 if [[ "$internal" == true ]]; then
127 perflab_arguments="--upload-to-perflab-container"
128 helix_source_prefix="official"
130 extra_benchmark_dotnet_arguments=
132 if [[ "$architecture" = "arm64" ]]; then
133 queue=Ubuntu.1804.Arm64.Perf
135 queue=Ubuntu.1804.Amd64.Tiger.Perf
139 common_setup_arguments="--frameworks $framework --queue $queue --build-number $build_number --build-configs $configurations"
140 setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments"
142 if [[ "$run_from_perf_repo" = true ]]; then
144 workitem_directory=$source_directory
145 performance_directory=$workitem_directory
146 setup_arguments="--perf-hash $commit_sha $common_setup_arguments"
148 git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $performance_directory
150 docs_directory=$performance_directory/docs
151 mv $docs_directory $workitem_directory
154 if [[ "$use_core_run" = true ]]; then
155 new_core_root=$payload_directory/Core_Root
156 mv $core_root_directory $new_core_root
161 _script_dir=$(pwd)/eng/common
162 . "$_script_dir/pipeline-logging-functions.sh"
164 # Make sure all of our variables are available for future steps
165 Write-PipelineSetVariable -name "UseCoreRun" -value "$use_core_run" -is_multi_job_variable false
166 Write-PipelineSetVariable -name "Architecture" -value "$architecture" -is_multi_job_variable false
167 Write-PipelineSetVariable -name "PayloadDirectory" -value "$payload_directory" -is_multi_job_variable false
168 Write-PipelineSetVariable -name "PerformanceDirectory" -value "$performance_directory" -is_multi_job_variable false
169 Write-PipelineSetVariable -name "WorkItemDirectory" -value "$workitem_directory" -is_multi_job_variable false
170 Write-PipelineSetVariable -name "Queue" -value "$queue" -is_multi_job_variable false
171 Write-PipelineSetVariable -name "SetupArguments" -value "$setup_arguments" -is_multi_job_variable false
172 Write-PipelineSetVariable -name "Python" -value "$python3" -is_multi_job_variable false
173 Write-PipelineSetVariable -name "PerfLabArguments" -value "$perflab_arguments" -is_multi_job_variable false
174 Write-PipelineSetVariable -name "ExtraBenchmarkDotNetArguments" -value "$extra_benchmark_dotnet_arguments" -is_multi_job_variable false
175 Write-PipelineSetVariable -name "BDNCategories" -value "$run_categories" -is_multi_job_variable false
176 Write-PipelineSetVariable -name "TargetCsproj" -value "$csproj" -is_multi_job_variable false
177 Write-PipelineSetVariable -name "RunFromPerfRepo" -value "$run_from_perf_repo" -is_multi_job_variable false
178 Write-PipelineSetVariable -name "Creator" -value "$creator" -is_multi_job_variable false
179 Write-PipelineSetVariable -name "HelixSourcePrefix" -value "$helix_source_prefix" -is_multi_job_variable false
180 Write-PipelineSetVariable -name "Kind" -value "$kind" -is_multi_job_variable false
181 Write-PipelineSetVariable -name "_BuildConfig" -value "$architecture.$kind.$framework" -is_multi_job_variable false