forked from dotnet/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uploadperftobenchview.cmd
92 lines (76 loc) · 4.77 KB
/
uploadperftobenchview.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
@echo on
setlocal EnableDelayedExpansion
REM The intent of this script is upload produced performance results to BenchView in a CI context.
REM There is no support for running this script in a dev environment.
if "%perfWorkingDirectory%" == "" (
echo EnvVar perfWorkingDirectory should be set; exiting...
exit /b %1)
if "%configuration%" == "" (
echo EnvVar configuration should be set; exiting...
exit /b 1)
if "%architecture%" == "" (
echo EnvVar architecture should be set; exiting...
exit /b 1)
if "%OS%" == "" (
echo EnvVar OS should be set; exiting...
exit /b 1)
if "%TestFullMSBuild%" == "" (
set TestFullMSBuild=false
)
if /I not "%runType%" == "private" if /I not "%runType%" == "rolling" (
echo EnvVar runType should be set; exiting...
exit /b 1)
if /I "%runType%" == "private" if "%BenchviewCommitName%" == "" (
echo EnvVar BenchviewCommitName should be set; exiting...
exit /b 1)
if /I "%runType%" == "rolling" if "%GIT_COMMIT%" == "" (
echo EnvVar GIT_COMMIT should be set; exiting...
exit /b 1)
if "%GIT_BRANCH%" == "" (
echo EnvVar GIT_BRANCH should be set; exiting...
exit /b 1)
if not exist %perfWorkingDirectory%\nul (
echo $perfWorkingDirectory does not exist; exiting...
exit 1)
set pythonCmd=py
if exist "C:\Python35\python.exe" set pythonCmd=C:\Python35\python.exe
powershell -NoProfile -NoLogo wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile "%perfWorkingDirectory%\nuget.exe"
if exist "%perfWorkingDirectory%\Microsoft.BenchView.JSONFormat" rmdir /s /q "%perfWorkingDirectory%\Microsoft.BenchView.JSONFormat"
"%perfWorkingDirectory%\nuget.exe" install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory "%perfWorkingDirectory%" -Prerelease -ExcludeVersion
REM Do this here to remove the origin but at the front of the branch name as this is a problem for BenchView
if "%GIT_BRANCH:~0,7%" == "origin/" (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH:origin/=%) else (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH%)
for /f %%x in ('powershell -NoProfile -NoLogo -Command "Get-Date -Date (Get-Date).ToUniversalTime() -UFormat '%%Y-%%m-%%dT%%H:%%M:%%SZ'"') do (set timeStamp=%%x)
set benchViewName=SDK perf %OS% %architecture% %configuration% TestFullMSBuild-%TestFullMSBuild% %runType% %GIT_BRANCH_WITHOUT_ORIGIN%
if /I "%runType%" == "private" (set benchViewName=%benchViewName% %BenchviewCommitName%)
if /I "%runType%" == "rolling" (set benchViewName=%benchViewName% %GIT_COMMIT%)
echo BenchViewName: "%benchViewName%"
echo Creating: "%perfWorkingDirectory%\submission-metadata.json"
%pythonCmd% "%perfWorkingDirectory%\Microsoft.BenchView.JSONFormat\tools\submission-metadata.py" --name "%benchViewName%" --user-email "[email protected]" -o "%perfWorkingDirectory%\submission-metadata.json"
echo Creating: "%perfWorkingDirectory%\build.json"
%pythonCmd% "%perfWorkingDirectory%\Microsoft.BenchView.JSONFormat\tools\build.py" git --branch "%GIT_BRANCH_WITHOUT_ORIGIN%" --type "%runType%" --repository "https://github.com/dotnet/sdk" --source-timestamp "%timeStamp%" -o "%perfWorkingDirectory%\build.json"
echo Creating: "%perfWorkingDirectory%\machinedata.json"
%pythonCmd% "%perfWorkingDirectory%\Microsoft.BenchView.JSONFormat\tools\machinedata.py" -o "%perfWorkingDirectory%\machinedata.json"
echo Creating: "%perfWorkingDirectory%\measurement.json"
pushd "%perfWorkingDirectory%"
for /f "tokens=*" %%a in ('dir /b/a-d *.xml') do (
echo Processing: "%%a"
%pythonCmd% "%perfWorkingDirectory%\Microsoft.BenchView.JSONFormat\tools\measurement.py" xunitscenario "%%a" --better desc --drop-first-value --append -o "%perfWorkingDirectory%\measurement.json"
)
popd
echo Creating: "%perfWorkingDirectory%\submission.json"
%pythonCmd% "%perfWorkingDirectory%\Microsoft.BenchView.JSONFormat\tools\submission.py" "%perfWorkingDirectory%\measurement.json" ^
--build "%perfWorkingDirectory%\build.json" ^
--machine-data "%perfWorkingDirectory%\machinedata.json" ^
--metadata "%perfWorkingDirectory%\submission-metadata.json" ^
--group "SDK Perf Tests" ^
--type "%runType%" ^
--config-name "%configuration%" ^
--config Configuration "%configuration%" ^
--config TestFullMSBuild "%TestFullMSBuild%" ^
--config OS "%OS%" ^
--architecture "%architecture%" ^
--machinepool "perfsnake" ^
-o "%perfWorkingDirectory%\submission.json"
echo Uploading: "%perfWorkingDirectory%\submission.json"
%pythonCmd% "%perfWorkingDirectory%\Microsoft.BenchView.JSONFormat\tools\upload.py" "%perfWorkingDirectory%\submission.json" --container coreclr
exit /b %ErrorLevel%