@@ -42,18 +42,31 @@ jobs:
42
42
AzureWebJobsScriptRoot : ' $(functionAppOutputPath)'
43
43
perfViewPath : C:\.tools\perfview\perfview.exe
44
44
traceDirectory : $(Build.ArtifactStagingDirectory)/out
45
- traceFileName : PerfViewData_$(Build.BuildNumber)_${{ parameters.functionAppName }}.etl
45
+ traceFileNameWithoutExtension : PerfViewData_$(Build.BuildNumber)_${{ parameters.functionAppName }}
46
+ traceFileName : $(traceFileNameWithoutExtension).etl
47
+ traceFileZipName : $(traceFileName).zip
46
48
traceFilePath : $(traceDirectory)/$(traceFileName)
49
+ traceZipFilePath : $(traceDirectory)/$(traceFileZipName)
50
+ traceAnalysisResultsDirectory : $(traceDirectory)/results
51
+ traceAnalysisResultMarkdownFilePath : $(traceAnalysisResultsDirectory)/$(traceFileNameWithoutExtension).md
47
52
traceLogPath : $(logsDirectory)/logs.log
53
+ ${{ if eq(parameters.os, 'Linux') }} :
54
+ publishRid : linux-x64
55
+ ${{ if eq(parameters.os, 'Windows') }} :
56
+ publishRid : win-x64
48
57
49
58
${{ if and(eq(parameters.collectPerfViewProfileOnWindows, true), eq(parameters.instanceId, '1')) }} : # profile collection is only on the first instance
50
59
templateContext :
51
- outputParentDirectory : $(System.DefaultWorkingDirectory)/out
60
+ outputParentDirectory : $(traceDirectory)
52
61
outputs :
53
62
- output : pipelineArtifact
54
63
displayName : Publish PerfView profile
55
- path : $(traceFilePath).zip
64
+ path : $(traceZipFilePath)
56
65
artifact : PerfViewData_${{ parameters.functionAppName }}
66
+ - output : pipelineArtifact
67
+ displayName : Publish ColdStart Analysis Result
68
+ path : $(traceAnalysisResultsDirectory)
69
+ artifact : ColdStartProfileAnalysisResult_${{ parameters.functionAppName }}
57
70
58
71
steps :
59
72
- template : /eng/ci/templates/install-dotnet.yml@self
74
87
zipAfterPublish : false
75
88
modifyOutputPath : false
76
89
projects : ' $(Build.ArtifactStagingDirectory)/PerformanceTestApps/${{ parameters.functionAppName }}/HelloHttp.csproj'
77
- arguments : -c Release -o $(functionAppOutputPath) -f net9.0
90
+ arguments : -c Release -o $(functionAppOutputPath) -f net9.0 -r $(publishRid)
78
91
workingDirectory : $(Build.ArtifactStagingDirectory)/PerformanceTestApps/${{ parameters.functionAppName }}
79
92
80
93
- task : DotNetCoreCLI@2
85
98
zipAfterPublish : false
86
99
modifyOutputPath : false
87
100
projects : ' $(Build.SourcesDirectory)/src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj'
88
- arguments : -c Release -o $(hostOutputPath) -f net8.0 -p:PlaceholderSimulation=true
101
+ arguments : -c Release -o $(hostOutputPath) -r $(publishRid) - f net8.0 -p:PlaceholderSimulation=true
89
102
workingDirectory : $(Build.SourcesDirectory)/src/WebJobs.Script.WebHost
90
103
91
104
- pwsh : |
@@ -169,7 +182,7 @@ jobs:
169
182
while ($attempt -lt $maxAttempts) {
170
183
$files = Get-ChildItem -Path $(traceDirectory)
171
184
$fileCount = $files.Count
172
- if ($fileCount -eq 1 -and $files[0].Name -eq '$(traceFileName).zip ') {
185
+ if ($fileCount -eq 1 -and $files[0].Name -eq '$(traceFileZipName) ') {
173
186
break
174
187
} else {
175
188
Write-Host "Expected zip file not found. Rechecking again in 15 seconds..."
@@ -188,6 +201,18 @@ jobs:
188
201
Get-Content $(traceLogPath)
189
202
displayName: Stop PerfView
190
203
204
+ - pwsh : |
205
+ # Install the profile analyzer tool and run it on the trace file.
206
+ dotnet tool install -g Microsoft.Azure.Functions.ColdStartProfileAnalyzer --prerelease
207
+ func-cold-start-analyzer --file $(traceZipFilePath) --format markdown text
208
+
209
+ # Upload analysis result
210
+ Write-Host "##vso[task.addattachment type=Distributedtask.Core.Summary;name=$env:OS $env:FUNCTION_APP_NAME;]$(traceAnalysisResultMarkdownFilePath)"
211
+ displayName: Analyze profile
212
+ env:
213
+ FUNCTION_APP_NAME: ${{ parameters.functionAppName }}
214
+ OS: ${{ parameters.os }}
215
+
191
216
- ${{ if eq(parameters.os, 'Windows') }} :
192
217
- pwsh : |
193
218
$processIdFile = "$(Build.ArtifactStagingDirectory)/hostProcessId.txt"
0 commit comments