1 // Import the utility functionality.
3 import jobs.generation.*;
5 def project = GithubProject
6 def branch = GithubBranchName
7 def projectName = Utilities.getFolderName(project)
8 def projectFolder = projectName + '/' + Utilities.getFolderName(branch)
10 def static getOSGroup(def os) {
11 def osGroupMap = ['Ubuntu14.04':'Linux',
13 'Ubuntu16.04': 'Linux',
17 'Windows_NT':'Windows_NT',
20 'OpenSUSE13.2': 'Linux',
21 'OpenSUSE42.1': 'Linux',
22 'LinuxARMEmulator': 'Linux']
23 def osGroup = osGroupMap.get(os, null)
24 assert osGroup != null : "Could not find os group for ${os}"
28 // Setup perflab tests runs
29 [true, false].each { isPR ->
30 ['Windows_NT'].each { os ->
31 ['x64', 'x86'].each { arch ->
32 ['ryujit'].each { jit ->
33 ['full_opt', 'min_opt'].each { opt_level ->
35 def architecture = arch
36 def jobName = "perf_perflab_${os}_${arch}_${opt_level}_${jit}"
39 def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
41 label('windows_server_2016_clr_perf')
44 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
50 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form <branch> private BenchviewCommitName')
55 stringParam('XUNIT_PERFORMANCE_MAX_ITERATION', '21', 'Sets the number of iterations to twenty one. We are doing this to limit the amount of data that we upload as 20 iterations is enough to get a good sample')
56 stringParam('XUNIT_PERFORMANCE_MAX_ITERATION_INNER_SPECIFIED', '21', 'Sets the number of iterations to twenty one. We are doing this to limit the amount of data that we upload as 20 iterations is enough to get a good sample')
59 def configuration = 'Release'
60 def runType = isPR ? 'private' : 'rolling'
61 def benchViewName = isPR ? 'coreclr private %BenchviewCommitName%' : 'coreclr rolling %GIT_BRANCH_WITHOUT_ORIGIN% %GIT_COMMIT%'
62 def uploadString = '-uploadToBenchview'
67 batchFile("powershell -NoProfile wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile \"%WORKSPACE%\\nuget.exe\"")
68 batchFile("if exist \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\" rmdir /s /q \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\"")
69 batchFile("\"%WORKSPACE%\\nuget.exe\" install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion")
70 //Do this here to remove the origin but at the front of the branch name as this is a problem for BenchView
71 //we have to do it all as one statement because cmd is called each time and we lose the set environment variable
72 batchFile("if \"%GIT_BRANCH:~0,7%\" == \"origin/\" (set \"GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH:origin/=%\") else (set \"GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH%\")\n" +
73 "set \"BENCHVIEWNAME=${benchViewName}\"\n" +
74 "set \"BENCHVIEWNAME=%BENCHVIEWNAME:\"=\"\"%\"\n" +
75 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\submission-metadata.py\" --name \"%BENCHVIEWNAME%\" --user-email \"dotnet-bot@microsoft.com\"\n" +
76 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\build.py\" git --branch %GIT_BRANCH_WITHOUT_ORIGIN% --type ${runType}")
77 batchFile("py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\machinedata.py\"")
78 batchFile("set __TestIntermediateDir=int&&build.cmd ${configuration} ${architecture}")
80 batchFile("tests\\runtest.cmd ${configuration} ${architecture} GenerateLayoutOnly")
82 def runXUnitPerfCommonArgs = "-arch ${arch} -configuration ${configuration} -os ${os} -generateBenchviewData \"%WORKSPACE%\\Microsoft.Benchview.JSONFormat\\tools\" ${uploadString} -runtype ${runType} ${testEnv} -optLevel ${opt_level} -jitName ${jit} -outputdir \"%WORKSPACE%\\bin\\sandbox_logs\" -stabilityPrefix \"START \\\"CORECLR_PERF_RUN\\\" /B /WAIT /HIGH /AFFINITY 0x2\""
84 // Run with just stopwatch: Profile=Off
85 batchFile("py tests\\scripts\\run-xunit-perf.py ${runXUnitPerfCommonArgs} -testBinLoc bin\\tests\\${os}.${architecture}.${configuration}\\performance\\perflab\\Perflab -library")
86 batchFile("py tests\\scripts\\run-xunit-perf.py ${runXUnitPerfCommonArgs} -testBinLoc bin\\tests\\${os}.${architecture}.${configuration}\\Jit\\Performance\\CodeQuality")
88 // Run with the full set of counters enabled: Profile=On
89 if (opt_level != 'min_opt') {
90 batchFile("py tests\\scripts\\run-xunit-perf.py ${runXUnitPerfCommonArgs} -testBinLoc bin\\tests\\${os}.${architecture}.${configuration}\\performance\\perflab\\Perflab -library -collectionFlags default+BranchMispredictions+CacheMisses+InstructionRetired+gcapi")
91 batchFile("py tests\\scripts\\run-xunit-perf.py ${runXUnitPerfCommonArgs} -testBinLoc bin\\tests\\${os}.${architecture}.${configuration}\\Jit\\Performance\\CodeQuality -collectionFlags default+BranchMispredictions+CacheMisses+InstructionRetired+gcapi")
96 def archiveSettings = new ArchivalSettings()
97 archiveSettings.addFiles('bin/sandbox_logs/**')
98 archiveSettings.addFiles('machinedata.json')
99 archiveSettings.setAlwaysArchive()
101 Utilities.addArchival(newJob, archiveSettings)
102 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
106 artifactDaysToKeep(30)
108 artifactNumToKeep(200)
119 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
120 builder.setGithubContext("${os} ${arch} ${opt_level} ${jit} CoreCLR Perf Tests")
123 if (opt_level == 'min_opt') {
124 opts = '\\W+min_opts'
127 if (jit != 'ryujit') {
131 builder.triggerOnlyOnComment()
132 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+${arch}${opts}${jitt}\\W+perf.*")
133 builder.triggerForBranch(branch)
134 builder.emitTrigger(newJob)
136 else if (opt_level == 'full_opt') {
137 // Set a push trigger
138 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
139 builder.emitTrigger(newJob)
142 // Set periodic trigger
143 Utilities.addPeriodicTrigger(newJob, '@daily')
151 // Setup throughput perflab tests runs
152 [true, false].each { isPR ->
153 ['Windows_NT'].each { os ->
154 ['x64', 'x86'].each { arch ->
155 ['ryujit'].each { jit ->
156 [true, false].each { pgo_optimized ->
157 ['full_opt', 'min_opt'].each { opt_level ->
158 def architecture = arch
163 if (!pgo_optimized) {
164 pgo_build = " -nopgooptimize"
169 def newJob = job(Utilities.getFullJobName(project, "perf_throughput_perflab_${os}_${arch}_${opt_level}_${jit}_${pgo_string}", isPR)) {
171 label('windows_server_2016_clr_perf')
174 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
180 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that will be used to build the full title of a run in Benchview.')
184 def configuration = 'Release'
185 def runType = isPR ? 'private' : 'rolling'
186 def benchViewName = isPR ? 'coreclr-throughput private %BenchviewCommitName%' : 'coreclr-throughput rolling %GIT_BRANCH_WITHOUT_ORIGIN% %GIT_COMMIT%'
190 batchFile("if exist \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\" rmdir /s /q \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\"")
191 batchFile("if exist \"%WORKSPACE%\\Microsoft.BenchView.ThroughputBenchmarks.${architecture}.${os}\" rmdir /s /q \"%WORKSPACE%\\Microsoft.BenchView.ThroughputBenchmarks.${architecture}.${os}\"")
192 batchFile("C:\\Tools\\nuget.exe install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion")
193 batchFile("C:\\Tools\\nuget.exe install Microsoft.BenchView.ThroughputBenchmarks.${architecture}.${os} -Source https://dotnet.myget.org/F/dotnet-core -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion")
194 //Do this here to remove the origin but at the front of the branch name as this is a problem for BenchView
195 //we have to do it all as one statement because cmd is called each time and we lose the set environment variable
196 batchFile("if \"%GIT_BRANCH:~0,7%\" == \"origin/\" (set \"GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH:origin/=%\") else (set \"GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH%\")\n" +
197 "set \"BENCHVIEWNAME=${benchViewName}\"\n" +
198 "set \"BENCHVIEWNAME=%BENCHVIEWNAME:\"=\"\"%\"\n" +
199 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\submission-metadata.py\" --name \"${benchViewName}\" --user-email \"dotnet-bot@microsoft.com\"\n" +
200 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\build.py\" git --branch %GIT_BRANCH_WITHOUT_ORIGIN% --type ${runType}")
201 batchFile("py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\machinedata.py\"")
202 batchFile("set __TestIntermediateDir=int&&build.cmd ${configuration} ${architecture}${pgo_build} skiptests")
203 batchFile("py -u tests\\scripts\\run-throughput-perf.py -arch ${arch} -os ${os} -configuration ${configuration} -opt_level ${opt_level} -jit_name ${jit}${pgo_test} -clr_root \"%WORKSPACE%\" -assembly_root \"%WORKSPACE%\\Microsoft.BenchView.ThroughputBenchmarks.${architecture}.${os}\\lib\" -benchview_path \"%WORKSPACE%\\Microsoft.Benchview.JSONFormat\\tools\" -run_type ${runType}")
207 // Save machinedata.json to /artifact/bin/ Jenkins dir
208 def archiveSettings = new ArchivalSettings()
209 archiveSettings.addFiles('throughput-*.csv')
210 archiveSettings.setAlwaysArchive()
211 Utilities.addArchival(newJob, archiveSettings)
213 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
217 if (opt_level == 'min_opt') {
218 opts = '\\W+min_opts'
222 if (jit != 'ryujit') {
228 pgo_trigger = "\\W+nopgo"
232 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
233 builder.setGithubContext("${os} ${arch} ${opt_level} ${jit} ${pgo_string} CoreCLR Throughput Perf Tests")
234 builder.triggerOnlyOnComment()
235 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+${arch}${opts}${jitt}${pgo_trigger}\\W+throughput.*")
236 builder.triggerForBranch(branch)
237 builder.emitTrigger(newJob)
239 else if (opt_level == 'full_opt' && pgo_optimized) {
240 // Set a push trigger
241 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
242 builder.emitTrigger(newJob)
245 // Set periodic trigger
246 Utilities.addPeriodicTrigger(newJob, '@daily')
255 def static getFullPerfJobName(def project, def os, def isPR) {
256 return Utilities.getFullJobName(project, "perf_${os}", isPR)
259 // Create the Linux/OSX/CentOS coreclr test leg for debug and release and each scenario
260 [true, false].each { isPR ->
261 def fullBuildJobName = Utilities.getFullJobName(project, 'perf_linux_build', isPR)
262 def architecture = 'x64'
263 def configuration = 'Release'
265 // Build has to happen on RHEL7.2 (that's where we produce the bits we ship)
266 ['RHEL7.2'].each { os ->
267 def newBuildJob = job(fullBuildJobName) {
269 shell("./build.sh verbose ${architecture} ${configuration}")
270 shell("./build-test.sh generatelayoutonly ${architecture} ${configuration}")
273 Utilities.setMachineAffinity(newBuildJob, os, 'latest-or-auto')
274 Utilities.standardJobSetup(newBuildJob, project, isPR, "*/${branch}")
275 Utilities.addArchival(newBuildJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so,bin/tests/**", "bin/Product/**/.nuget/**")
279 // Actual perf testing on the following OSes
280 def perfOSList = ['Ubuntu16.04']
281 perfOSList.each { os ->
282 def newJob = job(getFullPerfJobName(project, os, isPR)) {
284 label('ubuntu_1604_clr_perf')
287 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
293 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form <branch> private BenchviewCommitName')
298 // Cap the maximum number of iterations to 21.
299 stringParam('XUNIT_PERFORMANCE_MAX_ITERATION', '21', 'Sets the number of iterations to twenty one. We are doing this to limit the amount of data that we upload as 20 iterations is enough to get a good sample')
300 stringParam('XUNIT_PERFORMANCE_MAX_ITERATION_INNER_SPECIFIED', '21', 'Sets the number of iterations to twenty one. We are doing this to limit the amount of data that we upload as 20 iterations is enough to get a good sample')
301 stringParam('PRODUCT_BUILD', '', 'Build number from which to copy down the CoreCLR Product binaries built for Linux')
304 def osGroup = getOSGroup(os)
305 def runType = isPR ? 'private' : 'rolling'
306 def benchViewName = isPR ? 'coreclr private \$BenchviewCommitName' : 'coreclr rolling \$GIT_BRANCH_WITHOUT_ORIGIN \$GIT_COMMIT'
307 def uploadString = '-uploadToBenchview'
309 def runXUnitCommonArgs = "-arch ${architecture} -os ${os} -configuration ${configuration} -stabilityPrefix \"taskset 0x00000002 nice --adjustment=-10\" -generateBenchviewData \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools\" ${uploadString} -runtype ${runType} -outputdir \"\${WORKSPACE}/bin/sandbox_logs\""
312 shell("./tests/scripts/perf-prep.sh --nocorefx")
313 shell("./init-tools.sh")
314 copyArtifacts(fullBuildJobName) {
315 includePatterns("bin/**")
317 buildNumber('\${PRODUCT_BUILD}')
320 shell("GIT_BRANCH_WITHOUT_ORIGIN=\$(echo \$GIT_BRANCH | sed \"s/[^/]*\\/\\(.*\\)/\\1 /\")\n" +
321 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/submission-metadata.py\" --name \" ${benchViewName} \" --user-email \"dotnet-bot@microsoft.com\"\n" +
322 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/build.py\" git --branch \$GIT_BRANCH_WITHOUT_ORIGIN --type ${runType}")
323 shell("""python3 ./tests/scripts/run-xunit-perf.py -testBinLoc bin/tests/Windows_NT.${architecture}.${configuration}/JIT/Performance/CodeQuality ${runXUnitCommonArgs}""")
327 def archiveSettings = new ArchivalSettings()
328 archiveSettings.addFiles('bin/sandbox_logs/**')
329 archiveSettings.addFiles('machinedata.json')
330 archiveSettings.setAlwaysArchive()
332 Utilities.addArchival(newJob, archiveSettings)
333 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
335 // For perf, we need to keep the run results longer
337 // Enable the log rotator
339 artifactDaysToKeep(30)
341 artifactNumToKeep(200)
352 def flowJobPerfRunList = perfOSList.collect { os ->
353 "{ build(params + [PRODUCT_BUILD: b.build.number], '${getFullPerfJobName(project, os, isPR)}') }"
355 def newFlowJob = buildFlowJob(Utilities.getFullJobName(project, "perf_linux_flow", isPR, '')) {
358 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form <branch> private BenchviewCommitName')
362 // First, build the bits on RHEL7.2
363 b = build(params, '${fullBuildJobName}')
365 // Then, run the perf tests
367 ${flowJobPerfRunList.join(",\n ")}
372 Utilities.setMachineAffinity(newFlowJob, 'Windows_NT', 'latest-or-auto')
373 Utilities.standardJobSetup(newFlowJob, project, isPR, "*/${branch}")
376 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
377 builder.setGithubContext("Linux Perf Test Flow")
378 builder.triggerOnlyOnComment()
379 builder.setCustomTriggerPhrase("(?i).*test\\W+linux\\W+perf\\W+flow.*")
380 builder.triggerForBranch(branch)
381 builder.emitTrigger(newFlowJob)
384 // Set a push trigger
385 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
386 builder.emitTrigger(newFlowJob)
391 def static getFullThroughputJobName(def project, def os, def isPR) {
392 return Utilities.getFullJobName(project, "perf_throughput_${os}", isPR)
395 // Create the Linux/OSX/CentOS coreclr test leg for debug and release and each scenario
396 [true, false].each { isPR ->
397 def fullBuildJobName = Utilities.getFullJobName(project, 'perf_throughput_linux_build', isPR)
398 def architecture = 'x64'
399 def configuration = 'Release'
401 // Build has to happen on RHEL7.2 (that's where we produce the bits we ship)
402 ['RHEL7.2'].each { os ->
403 def newBuildJob = job(fullBuildJobName) {
405 shell("./build.sh verbose ${architecture} ${configuration}")
408 Utilities.setMachineAffinity(newBuildJob, os, 'latest-or-auto')
409 Utilities.standardJobSetup(newBuildJob, project, isPR, "*/${branch}")
410 Utilities.addArchival(newBuildJob, "bin/Product/**")
413 // Actual perf testing on the following OSes
414 def throughputOSList = ['Ubuntu14.04']
415 def throughputOptLevelList = ['full_opt', 'min_opt']
417 def throughputOSOptLevelList = []
419 throughputOSList.each { os ->
420 throughputOptLevelList.each { opt_level ->
421 throughputOSOptLevelList.add("${os}_${opt_level}")
425 throughputOSList.each { os ->
426 throughputOptLevelList.each { opt_level ->
427 def newJob = job(getFullThroughputJobName(project, "${os}_${opt_level}", isPR)) {
429 label('ubuntu_1604_clr_perf')
432 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
438 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that will be used to build the full title of a run in Benchview.')
443 stringParam('PRODUCT_BUILD', '', 'Build number from which to copy down the CoreCLR Product binaries built for Linux')
446 def osGroup = getOSGroup(os)
447 def runType = isPR ? 'private' : 'rolling'
448 def benchViewName = isPR ? 'coreclr-throughput private \$BenchviewCommitName' : 'coreclr-throughput rolling \$GIT_BRANCH_WITHOUT_ORIGIN \$GIT_COMMIT'
451 shell("bash ./tests/scripts/perf-prep.sh --throughput")
452 shell("./init-tools.sh")
453 copyArtifacts(fullBuildJobName) {
454 includePatterns("bin/Product/**")
456 buildNumber('\${PRODUCT_BUILD}')
459 shell("GIT_BRANCH_WITHOUT_ORIGIN=\$(echo \$GIT_BRANCH | sed \"s/[^/]*\\/\\(.*\\)/\\1 /\")\n" +
460 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/submission-metadata.py\" --name \" ${benchViewName} \" --user-email \"dotnet-bot@microsoft.com\"\n" +
461 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/build.py\" git --branch \$GIT_BRANCH_WITHOUT_ORIGIN --type ${runType}")
462 shell("""python3.5 ./tests/scripts/run-throughput-perf.py \\
463 -arch \"${architecture}\" \\
465 -configuration \"${configuration}\" \\
466 -opt_level \"${opt_level}\" \\
467 -clr_root \"\${WORKSPACE}\" \\
468 -assembly_root \"\${WORKSPACE}/Microsoft.Benchview.ThroughputBenchmarks.${architecture}.Windows_NT/lib\" \\
469 -run_type \"${runType}\" \\
470 -benchview_path \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools\"""")
474 // Save machinedata.json to /artifact/bin/ Jenkins dir
475 def archiveSettings = new ArchivalSettings()
476 archiveSettings.addFiles('throughput-*.csv')
477 archiveSettings.addFiles('machinedata.json')
478 archiveSettings.setAlwaysArchive()
479 Utilities.addArchival(newJob, archiveSettings)
481 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
483 // For perf, we need to keep the run results longer
485 // Enable the log rotator
487 artifactDaysToKeep(7)
489 artifactNumToKeep(25)
496 def flowJobTPRunList = throughputOSOptLevelList.collect { os ->
497 "{ build(params + [PRODUCT_BUILD: b.build.number], '${getFullThroughputJobName(project, os, isPR)}') }"
499 def newFlowJob = buildFlowJob(Utilities.getFullJobName(project, "perf_throughput_linux_flow", isPR, '')) {
502 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form <branch> private BenchviewCommitName')
506 // First, build the bits on RHEL7.2
507 b = build(params, '${fullBuildJobName}')
509 // Then, run the perf tests
511 ${flowJobTPRunList.join(",\n ")}
516 Utilities.setMachineAffinity(newFlowJob, 'Windows_NT', 'latest-or-auto')
517 Utilities.standardJobSetup(newFlowJob, project, isPR, "*/${branch}")
520 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
521 builder.setGithubContext("Linux Throughput Perf Test Flow")
522 builder.triggerOnlyOnComment()
523 builder.setCustomTriggerPhrase("(?i).*test\\W+linux\\W+throughput\\W+flow.*")
524 builder.triggerForBranch(branch)
525 builder.emitTrigger(newFlowJob)
528 // Set a push trigger
529 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
530 builder.emitTrigger(newFlowJob)
535 // Setup CoreCLR-Scenarios tests
536 [true, false].each { isPR ->
537 ['Windows_NT'].each { os ->
538 ['x64', 'x86'].each { arch ->
539 ['ryujit'].each { jit ->
540 ['full_opt', 'min_opt', 'tiered'].each { opt_level ->
541 def architecture = arch
542 def newJob = job(Utilities.getFullJobName(project, "perf_scenarios_${os}_${arch}_${opt_level}_${jit}", isPR)) {
547 label('windows_server_2016_clr_perf')
550 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
556 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form <branch> private BenchviewCommitName')
561 stringParam('XUNIT_PERFORMANCE_MAX_ITERATION', '1', 'Size test, one iteration is sufficient')
562 stringParam('XUNIT_PERFORMANCE_MAX_ITERATION_INNER_SPECIFIED', '1', 'Size test, one iteration is sufficient')
565 def configuration = 'Release'
566 def runType = isPR ? 'private' : 'rolling'
567 def benchViewName = isPR ? 'CoreCLR-Scenarios private %BenchviewCommitName%' : 'CoreCLR-Scenarios rolling %GIT_BRANCH_WITHOUT_ORIGIN% %GIT_COMMIT%'
568 def uploadString = '-uploadToBenchview'
572 batchFile("powershell -NoProfile wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile \"%WORKSPACE%\\nuget.exe\"")
573 batchFile("if exist \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\" rmdir /s /q \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\"")
574 batchFile("\"%WORKSPACE%\\nuget.exe\" install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion")
576 //Do this here to remove the origin but at the front of the branch name as this is a problem for BenchView
577 //we have to do it all as one statement because cmd is called each time and we lose the set environment variable
578 batchFile("if \"%GIT_BRANCH:~0,7%\" == \"origin/\" (set \"GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH:origin/=%\") else (set \"GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH%\")\n" +
579 "set \"BENCHVIEWNAME=${benchViewName}\"\n" +
580 "set \"BENCHVIEWNAME=%BENCHVIEWNAME:\"=\"\"%\"\n" +
581 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\submission-metadata.py\" --name \"%BENCHVIEWNAME%\" --user-email \"dotnet-bot@microsoft.com\"\n" +
582 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\build.py\" git --branch %GIT_BRANCH_WITHOUT_ORIGIN% --type ${runType}")
583 batchFile("py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\machinedata.py\"")
584 batchFile("set __TestIntermediateDir=int&&build.cmd ${configuration} ${architecture}")
586 batchFile("tests\\runtest.cmd ${configuration} ${architecture} GenerateLayoutOnly")
588 def runXUnitPerfCommonArgs = "-arch ${arch} -configuration ${configuration} -os ${os} -generateBenchviewData \"%WORKSPACE%\\Microsoft.Benchview.JSONFormat\\tools\" ${uploadString} -runtype ${runType} ${testEnv} -optLevel ${opt_level} -jitName ${jit} -outputdir \"%WORKSPACE%\\bin\\sandbox_logs\" -stabilityPrefix \"START \\\"CORECLR_PERF_RUN\\\" /B /WAIT /HIGH\" -scenarioTest"
591 batchFile("py tests\\scripts\\run-xunit-perf.py ${runXUnitPerfCommonArgs} -testBinLoc bin\\tests\\${os}.${architecture}.${configuration}\\performance\\Scenario\\JitBench -group CoreCLR-Scenarios")
594 if (opt_level != 'min_opt') {
595 batchFile("py tests\\scripts\\run-xunit-perf.py ${runXUnitPerfCommonArgs} -testBinLoc bin\\tests\\${os}.${architecture}.${configuration}\\performance\\Scenario\\JitBench -group CoreCLR-Scenarios -collectionFlags BranchMispredictions+CacheMisses+InstructionRetired")
600 def archiveSettings = new ArchivalSettings()
601 archiveSettings.addFiles('bin/sandbox_logs/**')
602 archiveSettings.addFiles('machinedata.json')
603 archiveSettings.setAlwaysArchive()
605 Utilities.addArchival(newJob, archiveSettings)
606 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
610 artifactDaysToKeep(30)
612 artifactNumToKeep(200)
624 if (opt_level == 'min_opt') {
625 opts = '\\W+min_opts'
628 if (jit != 'ryujit') {
632 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
633 builder.setGithubContext("${os} ${arch} ${opt_level} ${jit} Performance Scenarios Tests")
634 builder.triggerOnlyOnComment()
635 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+${arch}${opts}${jitt}\\W+perf\\W+scenarios.*")
636 builder.triggerForBranch(branch)
637 builder.emitTrigger(newJob)
639 else if (opt_level == 'full_opt') {
640 // Set a push trigger
641 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
642 builder.emitTrigger(newJob)
645 // Set periodic trigger
646 Utilities.addPeriodicTrigger(newJob, '@daily')
654 // Setup size-on-disk test
655 ['Windows_NT'].each { os ->
656 ['x64', 'x86'].each { arch ->
657 def architecture = arch
658 def newJob = job(Utilities.getFullJobName(project, "sizeondisk_${arch}", false)) {
662 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
666 def channel = 'master'
667 def configuration = 'Release'
668 def runType = 'rolling'
669 def benchViewName = 'Dotnet Size on Disk %DATE% %TIME%'
670 def testBin = "%WORKSPACE%\\bin\\tests\\${os}.${architecture}.${configuration}"
671 def coreRoot = "${testBin}\\Tests\\Core_Root"
672 def benchViewTools = "%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools"
675 // Install nuget and get BenchView tools
676 batchFile("powershell -NoProfile wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile \"%WORKSPACE%\\nuget.exe\"")
677 batchFile("if exist \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\" rmdir /s /q \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\"")
678 batchFile("\"%WORKSPACE%\\nuget.exe\" install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion")
680 // Generate submission metadata for BenchView
681 // Do this here to remove the origin but at the front of the branch name as this is a problem for BenchView
682 // we have to do it all as one statement because cmd is called each time and we lose the set environment variable
683 batchFile("if \"%GIT_BRANCH:~0,7%\" == \"origin/\" (set \"GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH:origin/=%\") else (set \"GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH%\")\n" +
684 "set \"BENCHVIEWNAME=${benchViewName}\"\n" +
685 "set \"BENCHVIEWNAME=%BENCHVIEWNAME:\"=\"\"%\"\n" +
686 "py \"${benchViewTools}\\submission-metadata.py\" --name \"%BENCHVIEWNAME%\" --user-email \"dotnet-bot@microsoft.com\"\n" +
687 "py \"${benchViewTools}\\build.py\" git --branch %GIT_BRANCH_WITHOUT_ORIGIN% --type ${runType}")
689 // Generate machine data from BenchView
690 batchFile("py \"${benchViewTools}\\machinedata.py\"")
692 // Build CoreCLR and gnerate test layout
693 batchFile("set __TestIntermediateDir=int&&build.cmd ${configuration} ${architecture}")
694 batchFile("tests\\runtest.cmd ${configuration} ${architecture} GenerateLayoutOnly")
696 // Run the size on disk benchmark
697 batchFile("\"${coreRoot}\\CoreRun.exe\" \"${testBin}\\sizeondisk\\sodbench\\SoDBench\\SoDBench.exe\" -o \"%WORKSPACE%\\sodbench.csv\" --architecture ${arch} --channel ${channel}")
699 // From sodbench.csv, create measurment.json, then submission.json
700 batchFile("py \"${benchViewTools}\\measurement.py\" csv \"%WORKSPACE%\\sodbench.csv\" --metric \"Size on Disk\" --unit \"bytes\" --better \"desc\"")
701 batchFile("py \"${benchViewTools}\\submission.py\" measurement.json --build build.json --machine-data machinedata.json --metadata submission-metadata.json --group \"Dotnet Size on Disk\" --type ${runType} --config-name ${configuration} --architecture ${arch} --machinepool VM --config Channel ${channel}")
703 // If this is a PR, upload submission.json
704 batchFile("py \"${benchViewTools}\\upload.py\" submission.json --container coreclr")
708 Utilities.setMachineAffinity(newJob, "Windows_NT", '20170427-elevated')
710 def archiveSettings = new ArchivalSettings()
711 archiveSettings.addFiles('bin/toArchive/**')
712 archiveSettings.addFiles('machinedata.json')
713 archiveSettings.setAlwaysArchive()
715 Utilities.addArchival(newJob, archiveSettings)
716 Utilities.standardJobSetup(newJob, project, false, "*/${branch}")
718 // Set the cron job here. We run nightly on each flavor, regardless of code changes
719 Utilities.addPeriodicTrigger(newJob, "@daily", true /*always run*/)
723 artifactDaysToKeep(30)
725 artifactNumToKeep(200)
737 // Setup IlLink tests
738 [true, false].each { isPR ->
739 ['Windows_NT'].each { os ->
740 ['x64'].each { arch ->
741 ['ryujit'].each { jit ->
742 ['full_opt'].each { opt_level ->
743 def architecture = arch
744 def newJob = job(Utilities.getFullJobName(project, "perf_illink_${os}_${arch}_${opt_level}_${jit}", isPR)) {
749 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
755 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form <branch> private BenchviewCommitName')
760 stringParam('XUNIT_PERFORMANCE_MAX_ITERATION', '1', 'Size test, one iteration is sufficient')
761 stringParam('XUNIT_PERFORMANCE_MAX_ITERATION_INNER_SPECIFIED', '1', 'Size test, one iteration is sufficient')
764 def configuration = 'Release'
765 def runType = isPR ? 'private' : 'rolling'
766 def benchViewName = isPR ? 'CoreCLR-Scenarios private %BenchviewCommitName%' : 'CoreCLR-Scenarios rolling %GIT_BRANCH_WITHOUT_ORIGIN% %GIT_COMMIT%'
767 def uploadString = '-uploadToBenchview'
771 batchFile("powershell -NoProfile wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile \"%WORKSPACE%\\nuget.exe\"")
772 batchFile("if exist \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\" rmdir /s /q \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\"")
773 batchFile("\"%WORKSPACE%\\nuget.exe\" install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion")
775 //Do this here to remove the origin but at the front of the branch name as this is a problem for BenchView
776 //we have to do it all as one statement because cmd is called each time and we lose the set environment variable
777 batchFile("if \"%GIT_BRANCH:~0,7%\" == \"origin/\" (set \"GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH:origin/=%\") else (set \"GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH%\")\n" +
778 "set \"BENCHVIEWNAME=${benchViewName}\"\n" +
779 "set \"BENCHVIEWNAME=%BENCHVIEWNAME:\"=\"\"%\"\n" +
780 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\submission-metadata.py\" --name \"%BENCHVIEWNAME%\" --user-email \"dotnet-bot@microsoft.com\"\n" +
781 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\build.py\" git --branch %GIT_BRANCH_WITHOUT_ORIGIN% --type ${runType}")
782 batchFile("py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\machinedata.py\"")
783 batchFile("set __TestIntermediateDir=int&&build.cmd ${configuration} ${architecture}")
785 batchFile("tests\\runtest.cmd ${configuration} ${architecture} GenerateLayoutOnly")
787 def runXUnitPerfCommonArgs = "-arch ${arch} -configuration ${configuration} -os ${os} -generateBenchviewData \"%WORKSPACE%\\Microsoft.Benchview.JSONFormat\\tools\" ${uploadString} -runtype ${runType} ${testEnv} -optLevel ${opt_level} -jitName ${jit} -outputdir \"%WORKSPACE%\\bin\\sandbox_logs\" -scenarioTest"
790 batchFile("\"%VS140COMNTOOLS%\\..\\..\\VC\\vcvarsall.bat\" x86_amd64 && " +
791 "py tests\\scripts\\run-xunit-perf.py ${runXUnitPerfCommonArgs} -testBinLoc bin\\tests\\${os}.${architecture}.${configuration}\\performance\\linkbench\\linkbench -group ILLink -nowarmup")
795 def archiveSettings = new ArchivalSettings()
796 archiveSettings.addFiles('bin/sandbox_logs/**')
797 archiveSettings.addFiles('machinedata.json')
798 archiveSettings.setAlwaysArchive()
800 // Set the label (currently we are only measuring size, therefore we are running on VM).
801 Utilities.setMachineAffinity(newJob, "Windows_NT", '20170427-elevated')
802 Utilities.addArchival(newJob, archiveSettings)
803 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
807 artifactDaysToKeep(30)
809 artifactNumToKeep(200)
820 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
821 builder.setGithubContext("${os} ${arch} ${opt_level} ${jit} IlLink Tests")
822 builder.triggerOnlyOnComment()
823 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+${arch}\\W+illink.*")
824 builder.triggerForBranch(branch)
825 builder.emitTrigger(newJob)
828 // Set a push trigger
829 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
830 builder.emitTrigger(newJob)
838 Utilities.createHelperJob(this, project, branch,
839 "Welcome to the ${project} Perf help",