Skip to content

enhancement: add a shutdown row to the phases - #119

Merged
mukeshpanchal27 merged 4 commits into
trunkfrom
enhancement/111-shutdown-phase
Nov 18, 2026
Merged

mukeshpanchal27 merged 4 commits into
trunkfrom
enhancement/111-shutdown-phase

Conversation

@mukeshpanchal27

Copy link
Copy Markdown
Owner

Fixes #111.

Stacked on #118.

Problem

In an early review, the saved total was 7 to 12 ms higher than the phases on every run, for example 86.0 vs 75.9 ms. The gap was work during shutdown, such as Query Monitor's output, and no phase row showed it. The "Share of total" column added up to about 88%.

Change

Phase_Timer::record_shutdown() runs on shutdown at PHP_INT_MAX - 1, just before the report is saved. It adds a shutdown phase, from the shutdown mark to that moment. The row shows as shutdown → report.

The header: Server-Timing goes out at the start of shutdown, before the page is flushed, so it cannot include this phase. It is unchanged. Only the saved report has the shutdown row.

Testing

On the wp-env dev site, the phases now add up to the saved total within 0.1 ms:

Page Total Phase sum Shutdown row
/ 59.42 ms 59.37 ms 0.16 ms
/sample-page/ 56.34 ms 56.28 ms 0.15 ms
/wp-admin/ 909.73 ms 909.63 ms 0.21 ms
/sample-page/, with a test plugin that waits 7 ms on shutdown 58.89 ms 58.86 ms 8.51 ms

The header still lists the phases up to wp_loaded or template_redirect, plus lp-overhead, and no shutdown metric.

PHPCS passes.

🤖 Generated with Claude Code

mukeshpanchal27 and others added 4 commits November 18, 2026 20:17
All sites of a network share mu-plugins, so deactivating the plugin on
one site removed the loader for every site. Keep the file while the
plugin is network-active or active on another site.

Fixes #108

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Show the seconds and the total time in each option, so reports of the
same page saved in the same minute look different.

Fixes #109

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a table of the 20 slowest hook callbacks by self time, with the
hook, priority, source, file and line, and calls.

Fixes #110

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record a shutdown phase from the shutdown mark until the report is
saved, so the phases add up to the saved total.

Fixes #111

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@mukeshpanchal27
mukeshpanchal27 changed the base branch from enhancement/110-slowest-callbacks to trunk November 18, 2026 14:55
@mukeshpanchal27
mukeshpanchal27 merged commit b903a23 into trunk Nov 18, 2026
14 checks passed
@mukeshpanchal27
mukeshpanchal27 deleted the enhancement/111-shutdown-phase branch November 18, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a shutdown row to the phases

1 participant