Automate the perf data collection for JIT CodeQuality benchmarks on Windows.
authorSmile Wei <xiwe@microsoft.com>
Wed, 3 Aug 2016 22:20:15 +0000 (15:20 -0700)
committerSmile Wei <xiwe@microsoft.com>
Wed, 10 Aug 2016 21:02:07 +0000 (14:02 -0700)
Fix a quote.

Commit migrated from https://github.com/dotnet/coreclr/commit/cdc68196cc0adc3be2a755fa8b4116f3cf4c8af8

src/coreclr/perf.groovy [new file with mode: 0644]
src/coreclr/tests/scripts/run-xunit-perf.cmd [new file with mode: 0644]

diff --git a/src/coreclr/perf.groovy b/src/coreclr/perf.groovy
new file mode 100644 (file)
index 0000000..add6dc2
--- /dev/null
@@ -0,0 +1,32 @@
+// Import the utility functionality.
+
+import jobs.generation.*;
+
+def project = GithubProject
+def branch = GithubBranchName
+def projectFolder = Utilities.getFolderName(project) + '/' + Utilities.getFolderName(branch)
+
+
+[true, false].each { isPR ->
+    ['Windows_NT'].each { os ->
+        def newJob = job(Utilities.getFullJobName(project, "perf_${os}", isPR)) {
+            // Set the label.
+            steps {
+                    // Batch
+                    batchFile("set __TestIntermediateDir=int&&build.cmd release x64")
+                    batchFile("tests\\runtest.cmd release x64")
+                    batchFile("tests\\scripts\\run-xunit-perf.cmd")
+            }
+        }
+
+        Utilities.setMachineAffinity(newJob, os, 'latest-or-auto-elevated') // Just run against Windows_NT VM\92s for now.
+        Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
+        if (isPR) {
+            Utilities.addGithubPRTriggerForBranch(newJob, branch, "${os} Perf Tests") // Add a PR trigger.
+        }
+        else {
+            // Set a push trigger
+            Utilities.addGithubPushTrigger(newJob)
+        }
+    }
+}
diff --git a/src/coreclr/tests/scripts/run-xunit-perf.cmd b/src/coreclr/tests/scripts/run-xunit-perf.cmd
new file mode 100644 (file)
index 0000000..e09da47
--- /dev/null
@@ -0,0 +1,60 @@
+@rem Licensed to the .NET Foundation under one or more agreements.
+@rem The .NET Foundation licenses this file to you under the MIT license.
+@rem See the LICENSE file in the project root for more information.
+
+@setlocal
+@echo off
+
+set HERE=%CD%
+set CORECLR_REPO=%CD%
+set CORECLR_OVERLAY=%CORECLR_REPO%\bin\tests\Windows_NT.x64.Release\Tests\Core_Root
+set CORECLR_PERF=%CORECLR_REPO%\bin\tests\Windows_NT.x64.Release\Jit\Performance\CodeQuality
+set RUNLOG=%HERE%\bin\Logs\perfrun.log
+
+if NOT EXIST %CORECLR_OVERLAY% (
+  echo Can't find test overlay directory '%CORECLR_OVERLAY%'
+  echo Please build and run Release CoreCLR tests
+  exit /B 1
+)
+
+:SETUP
+
+@echo --- setting up sandbox
+
+rd /s /q sandbox
+mkdir sandbox
+pushd sandbox
+
+@rem stage stuff we need
+
+@rem xunit and perf
+xcopy /sy %CORECLR_REPO%\packages\Microsoft.DotNet.xunit.performance.runner.Windows\1.0.0-alpha-build0035\tools\* . > %RUNLOG%
+xcopy /sy %CORECLR_REPO%\packages\Microsoft.DotNet.xunit.performance.analysis\1.0.0-alpha-build0035\tools\* . > %RUNLOG%
+xcopy /sy %CORECLR_REPO%\packages\xunit.console.netcore\1.0.2-prerelease-00101\runtimes\any\native\* . > %RUNLOG%
+xcopy /sy %CORECLR_REPO%\bin\tests\Windows_NT.x64.Release\Tests\Core_Root\* . > %RUNLOG%
+
+@rem find and stage the tests
+
+for /R %CORECLR_PERF% %%T in (*.exe) do (
+  call :DOIT %%T
+)
+
+goto :EOF
+
+:DOIT
+
+set BENCHNAME=%~n1
+set PERFOUT=perf-%BENCHNAME%
+set XMLOUT=%PERFOUT%-summary.xml
+
+echo --- Running %BENCHNAME%
+
+xcopy /s %1 . > %RUNLOG%
+
+set CORE_ROOT=%HERE%\sandbox
+
+xunit.performance.run.exe %BENCHNAME%.exe -runner xunit.console.netcore.exe -runnerhost corerun.exe -verbose -runid %PERFOUT% > %BENCHNAME%.out
+
+xunit.performance.analysis.exe %PERFOUT%.xml -xml %XMLOUT% > %BENCHNAME%-analysis.out
+
+type %XMLOUT% | findstr Duration