Repository navigation
338 lines (331 loc) · 17.2 KB
/
Copy pathperf_probe.yml
File metadata and controls
338 lines (331 loc) · 17.2 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
name: Performance probe tools
on:
pull_request:
paths:
- 'tool/perf_probe/**'
- 'lib/core/diagnostics/**'
- 'lib/plugins/services/plugin_webview_diagnostics.dart'
- 'lib/plugins/services/webview_backend_observation.dart'
- 'lib/plugins/view/plugin_webview_host.dart'
- 'pubspec.yaml'
- 'pubspec.lock'
- 'test/core/diagnostics/**'
- 'test/plugins/services/plugin_webview_diagnostics_test.dart'
- 'test/plugins/services/webview_backend_observation_test.dart'
- 'test/tool/perf_probe/webview_probe_metrics_test.dart'
- 'test/tool/perf_probe/pdf_reader_probe*'
- 'test/tool/perf_probe/pdf_reader_case_test.dart'
- 'test/tool/perf_probe/pdf_case_fixture_test.dart'
- 'test/tool/perf_probe/pdf_book_reader_probe*'
- 'test/tool/perf_probe/perf_fixture_test.dart'
- 'test/tool/perf_probe/report_test.dart'
- 'test/tool/perf_probe/pdf_image_budget_test.dart'
- 'test/tool/perf_probe/perf_recorder_test.dart'
- 'test/tool/perf_probe/probe_binding_test.dart'
- 'test/tool/perf_probe/probe_engine_test.dart'
- 'test/tool/perf_probe/pdf_multi_window_test.dart'
- 'integration_test/support/perf_pdf_multi_window.dart'
- 'lib/core/windowing/**'
- 'integration_test/support/webview_probe_fixture.dart'
- 'integration_test/support/webview_probe_metrics.dart'
- 'integration_test/support/webview_probe_window.dart'
- 'integration_test/support/perf_recorder.dart'
- 'integration_test/support/perf_resource_workload.dart'
- 'integration_test/support/perf_framework_scheduler.dart'
- 'integration_test/support/perf_fixture.dart'
- 'integration_test/support/perf_pdf_reader.dart'
- 'integration_test/support/perf_pdf_book_reader.dart'
- 'integration_test/support/perf_probe_wait.dart'
- 'lib/pdf_book/models/pdf_book_render_observation.dart'
- 'lib/pdf_book/view/pdf_book_screen.dart'
- 'integration_test/support/perf_pdf_image_budget.dart'
- 'integration_test/perf_resource_probe_test.dart'
- 'integration_test/webview_resource_probe_test.dart'
- 'test_driver/webview_resource_probe.dart'
- '.github/workflows/perf_probe.yml'
workflow_dispatch:
inputs:
mode:
description: Build mode (results are never compared across modes)
type: choice
options: [profile, release, debug]
default: profile
cache_state:
description: Application data state (OS caches are not cleared)
type: choice
options: [cold, warm]
default: cold
launches:
description: Measured process launches
type: number
default: 3
repetitions:
description: Measured repetitions per action and launch
type: number
default: 5
scenario_set:
description: Actions after startup (multi-window uses a fixed cold 10-page smoke)
type: choice
options: [all, pdf-reader, pdf-book-view, pdf-multi-window]
default: all
binding_mode:
description: Scheduler identity (framework accepts PDF scenarios only)
type: choice
options: [integration, framework]
default: integration
pdf_page_count:
description: Generated PDF size (real PDF inputs stay local)
type: choice
options: ['10', '100', '600', '1000', '10000']
default: '600'
permissions:
contents: read
# A new push to a PR supersedes its previous run; a manual measurement is never cancelled.
concurrency:
group: perf-probe-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
gate:
uses: ./.github/workflows/ci_gate.yml
permissions:
contents: read
pull-requests: read
contracts:
name: Sampler contracts (no performance thresholds)
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7.0.1
- name: Validate process identity and invariant CSV formatting
shell: pwsh
run: ./tool/perf_probe/test_sample_resources.ps1
- name: Validate binding identity and native scheduling evidence
shell: pwsh
run: ./tool/perf_probe/test_probe_binding.ps1
- name: Validate the bundled Windows engine and patch identity
shell: pwsh
run: ./tool/perf_probe/test_probe_engine.ps1
- name: Validate backend correlation and comparison readiness
shell: pwsh
run: ./tool/perf_probe/test_webview_hosting_probe.ps1
- name: Validate WebView fixture state and bounded observers
run: node --test tool/perf_probe/test_webview_probe_fixture.mjs
- name: Validate POSIX process ownership, native units and PDF smoke evidence
run: python3 -B -m unittest tool.perf_probe.test_perf_probe_posix -v
webview:
name: Live WebView2 resource scenario (profile)
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: windows-2025
timeout-minutes: 45
steps:
- uses: actions/checkout@v7.0.1
- uses: ./.github/actions/setup-flutter
with:
flutter-version: 3.47.9
- name: Resolve pinned dependencies
shell: pwsh
run: |
git config --global core.longpaths true
flutter pub get --enforce-lockfile
- name: Validate process coverage with the real Windows host sampler
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path '${{ runner.temp }}/webview-probe' | Out-Null
flutter test --no-pub --reporter expanded `
test/core/diagnostics/process_tree_sampler_test.dart `
test/core/diagnostics/process_tree_coverage_test.dart `
test/core/diagnostics/frame_stats_overlay_test.dart `
test/plugins/services/plugin_webview_diagnostics_test.dart `
test/plugins/services/webview_backend_observation_test.dart `
test/tool/perf_probe/webview_probe_metrics_test.dart `
test/tool/perf_probe/pdf_image_budget_test.dart `
test/tool/perf_probe/perf_recorder_test.dart `
test/tool/perf_probe/probe_binding_test.dart `
test/tool/perf_probe/probe_engine_test.dart `
test/tool/perf_probe/pdf_multi_window_test.dart `
2>&1 | Tee-Object -FilePath '${{ runner.temp }}/webview-probe/process-coverage-tests.log'
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Run the native scenario without performance thresholds
shell: pwsh
env:
WEBVIEW_PROBE_REPORTS: ${{ runner.temp }}/webview-probe/host
WEBVIEW_PROBE_DEVICE_OUTPUT: ${{ runner.temp }}/webview-probe/device
FLUTTER_INAPPWEBVIEW_WINDOWS_FORCE_HWND: '0'
run: |
New-Item -ItemType Directory -Force -Path '${{ runner.temp }}/webview-probe' | Out-Null
flutter drive --profile -d windows --no-pub `
--driver=test_driver/webview_resource_probe.dart `
--target=integration_test/webview_resource_probe_test.dart `
--dart-define=WEBVIEW_PROBE_FLUTTER_VERSION=3.47.9 `
--dart-define=WEBVIEW_PROBE_COMMIT=${{ github.sha }} `
--dart-define=WEBVIEW_PROBE_IDLE_MS=1000 `
2>&1 | Tee-Object -FilePath '${{ runner.temp }}/webview-probe/run.log'
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Run forced HWND in a fresh native process
if: ${{ !cancelled() }}
shell: pwsh
env:
WEBVIEW_PROBE_REPORTS: ${{ runner.temp }}/webview-probe/host-hwnd
WEBVIEW_PROBE_DEVICE_OUTPUT: ${{ runner.temp }}/webview-probe/device-hwnd
FLUTTER_INAPPWEBVIEW_WINDOWS_FORCE_HWND: '1'
run: |
flutter drive --profile -d windows --no-pub `
--driver=test_driver/webview_resource_probe.dart `
--target=integration_test/webview_resource_probe_test.dart `
--dart-define=WEBVIEW_PROBE_FLUTTER_VERSION=3.47.9 `
--dart-define=WEBVIEW_PROBE_COMMIT=${{ github.sha }} `
--dart-define=WEBVIEW_PROBE_IDLE_MS=1000 `
2>&1 | Tee-Object -FilePath '${{ runner.temp }}/webview-probe/run-hwnd.log'
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Preserve native observations and partial failures
if: always()
uses: actions/upload-artifact@v7.0.2
with:
name: webview-resource-probe-windows-profile
if-no-files-found: warn
retention-days: 14
path: |
${{ runner.temp }}/webview-probe/run.log
${{ runner.temp }}/webview-probe/run-hwnd.log
${{ runner.temp }}/webview-probe/process-coverage-tests.log
${{ runner.temp }}/webview-probe/host/**/*.json
${{ runner.temp }}/webview-probe/device/**/phases.jsonl
${{ runner.temp }}/webview-probe/device/**/report.json
${{ runner.temp }}/webview-probe/host-hwnd/**/*.json
${{ runner.temp }}/webview-probe/device-hwnd/**/phases.jsonl
${{ runner.temp }}/webview-probe/device-hwnd/**/report.json
desktop:
name: Windows app measurements (${{ matrix.scenario }}, ${{ matrix.binding_mode }}, ${{ matrix.mode || inputs.mode || 'profile' }})
strategy:
fail-fast: false
matrix:
scenario: ${{ fromJSON(github.event_name == 'pull_request' && '["pdf-reader","pdf-book-view"]' || format('["{0}"]', inputs.scenario_set || 'all')) }}
binding_mode: ${{ fromJSON(github.event_name == 'pull_request' && '["framework"]' || format('["{0}"]', inputs.binding_mode || 'integration')) }}
include: ${{ fromJSON(github.event_name == 'pull_request' && '[{"scenario":"pdf-multi-window","binding_mode":"framework","mode":"profile"},{"scenario":"pdf-multi-window","binding_mode":"framework","mode":"release"}]' || '[]') }}
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: windows-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v7.0.1
- uses: ./.github/actions/setup-flutter
with:
flutter-version: 3.47.9
- uses: dtolnay/rust-toolchain@stable
- name: Resolve pinned dependencies
shell: pwsh
run: |
git config --global core.longpaths true
flutter pub get --enforce-lockfile
- name: Install the existing patched release engine
if: matrix.scenario == 'pdf-multi-window' && (matrix.mode || inputs.mode || 'profile') == 'release'
uses: ./.github/actions/patched-flutter-engine
with:
arch: x64
- name: Run isolated measurements
shell: pwsh
env:
PROBE_MODE: ${{ matrix.mode || inputs.mode || 'profile' }}
PROBE_CACHE: ${{ matrix.scenario == 'pdf-multi-window' && 'cold' || inputs.cache_state || 'cold' }}
PROBE_LAUNCHES: ${{ matrix.scenario == 'pdf-multi-window' && 1 || inputs.launches || 1 }}
PROBE_REPETITIONS: ${{ matrix.scenario == 'pdf-multi-window' && 1 || inputs.repetitions || 1 }}
PROBE_SCENARIOS: ${{ matrix.scenario }}
PROBE_BINDING: ${{ matrix.binding_mode }}
PROBE_WARMUP: ${{ matrix.scenario != 'pdf-multi-window' && github.event_name == 'workflow_dispatch' && 1 || 0 }}
PROBE_PDF_PAGES: ${{ matrix.scenario == 'pdf-multi-window' && '10' || inputs.pdf_page_count || '600' }}
run: |
if ($env:PROBE_SCENARIOS -eq 'pdf-multi-window' -and ($env:PROBE_BINDING -ne 'framework' -or $env:PROBE_MODE -notin @('profile', 'release'))) {
throw 'Native multi-window smoke requires framework binding and profile or release mode.'
}
$expectedEngine = ''
if ($env:PROBE_SCENARIOS -eq 'pdf-multi-window' -and $env:PROBE_MODE -eq 'release') {
if ($env:PATCHED_FLUTTER_DLL_SHA256 -notmatch '^[a-f0-9]{64}$') { throw 'The patched release action did not provide its verified DLL hash.' }
$expectedEngine = $env:PATCHED_FLUTTER_DLL_SHA256
}
$pdfCase = Join-Path $env:RUNNER_TEMP 'pdf-reader-case.json'
@{
schemaVersion = 1
source = @{ kind = 'generated'; pageCount = [int]$env:PROBE_PDF_PAGES; mixedPageSizes = $true }
} | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $pdfCase -Encoding utf8
./tool/perf_probe/run_perf_probe.ps1 -Mode $env:PROBE_MODE `
-CacheState $env:PROBE_CACHE -Launches ([int]$env:PROBE_LAUNCHES) `
-Repetitions ([int]$env:PROBE_REPETITIONS) `
-ScenarioSet $env:PROBE_SCENARIOS -BindingMode $env:PROBE_BINDING -Warmup ([int]$env:PROBE_WARMUP) `
-PdfCase $pdfCase -ExpectedEngineSha256 $expectedEngine `
-OutputDirectory (Join-Path $env:RUNNER_TEMP 'perf-results') `
-HardwareId "github-hosted-$env:GITHUB_RUN_ID-$env:GITHUB_RUN_ATTEMPT"
- name: Require PDF budget and post-close observations from the actual app
if: matrix.scenario != 'pdf-multi-window'
shell: pwsh
env:
PROBE_SCENARIOS: ${{ matrix.scenario }}
PROBE_BINDING: ${{ matrix.binding_mode }}
run: |
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$report = Get-Content -LiteralPath (Join-Path $env:RUNNER_TEMP 'perf-results/report.json') -Raw | ConvertFrom-Json
if ($report.successful -ne $true) { throw 'The app measurement run did not pass.' }
if ($report.metadata.settings.resourceObservationVersion -ne 1) { throw 'PDF resource observation version is missing.' }
Import-Module ./tool/perf_probe/probe_binding.psm1 -Force
Assert-PerfBindingIdentity $report.metadata.settings $env:PROBE_BINDING
if ($report.metadata.bindingMode -ne $env:PROBE_BINDING) { throw 'The app ran under the wrong binding.' }
if ($env:PROBE_BINDING -eq 'framework') {
Assert-PerfFrameworkScheduler $report.notes $report.metadata.launchCount
}
if ($report.metadata.settings.scenarioSet -ne $env:PROBE_SCENARIOS) { throw 'The app ran the wrong PDF scenario set.' }
$prefixes = switch ($env:PROBE_SCENARIOS) {
'pdf-reader' { @('pdf.reader') }
'pdf-book-view' { @('pdf.book_view') }
'all' { @('pdf.reader', 'pdf.book_view') }
default { throw 'Unknown PDF scenario set.' }
}
foreach ($prefix in $prefixes) {
$names = @("$prefix.open", "$prefix.close", "$prefix.idle_after_close")
if ($prefix -eq 'pdf.book_view') {
$names += @('pdf.book_view.thumbnails_first_image', 'pdf.book_view.jump_forward', 'pdf.book_view.jump_backward', 'pdf.book_view.prepare_reversals', 'pdf.book_view.rapid_reversals')
}
foreach ($name in $names) {
$rows = @($report.scenarios | Where-Object name -eq $name)
if ($rows.Count -ne 1 -or $rows[0].status -ne 'passed' -or $rows[0].measured -lt 1) { throw "Missing measured phase: $name" }
foreach ($point in @('before', 'after')) {
if ($rows[0].imageBudget.$point.complete -ne $true) { throw "Incomplete PDF budget coverage: $name / $point" }
}
}
$idle = $report.scenarios | Where-Object name -eq "$prefix.idle_after_close"
if ($idle.measurementKind -ne 'resource-observation' -or $idle.observationWindowMs -ne 3000 -or $null -ne $idle.latencyMs) { throw "PDF post-close window was not a fixed resource observation: $prefix" }
}
- name: Require actual native PDF windows and verified release engine
if: matrix.scenario == 'pdf-multi-window'
shell: pwsh
env:
PROBE_MODE: ${{ matrix.mode || inputs.mode || 'profile' }}
run: |
$arguments = @('tool/perf_probe/validate_pdf_multi_window.dart', '--root', (Join-Path $env:RUNNER_TEMP 'perf-results'), '--commit', $env:GITHUB_SHA, '--platform', 'windows', '--mode', $env:PROBE_MODE)
if ($env:PROBE_MODE -eq 'release') {
$arguments += @('--expected-engine-sha256', $env:PATCHED_FLUTTER_DLL_SHA256)
}
dart @arguments 2>&1 | Tee-Object -FilePath (Join-Path $env:RUNNER_TEMP 'perf-results/native-windows-verified.json')
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Upload observations, including partial failures
if: always()
uses: actions/upload-artifact@v7.0.2
with:
name: perf-${{ matrix.mode || inputs.mode || 'profile' }}-${{ matrix.scenario == 'pdf-multi-window' && 'cold' || inputs.cache_state || 'cold' }}-${{ matrix.scenario }}-${{ matrix.binding_mode }}
if-no-files-found: warn
retention-days: 14
path: |
${{ runner.temp }}/perf-results/*.json
${{ runner.temp }}/perf-results/*.jsonl
${{ runner.temp }}/perf-results/*.csv
${{ runner.temp }}/perf-results/*.md
${{ runner.temp }}/perf-results/*.log
${{ runner.temp }}/perf-results/launch-*/*.json*
${{ runner.temp }}/perf-results/launch-*/*.log
${{ runner.temp }}/perf-results/launch-*/pdf-multi-window-*/*.json
${{ runner.temp }}/perf-results/launch-*/pdf-multi-window-*/*.pdf
${{ runner.temp }}/perf-results/launch-*/pdf-multi-window-*/*.png
${{ runner.temp }}/perf-results/prepare-*/*.json
${{ runner.temp }}/perf-results/prepare-*/*.log