Skip to content

Add --plugin grouping to wp profile hook resource output#220

Open
Copilot wants to merge 11 commits into
mainfrom
copilot/profile-plugin-resource-usage
Open

Add --plugin grouping to wp profile hook resource output#220
Copilot wants to merge 11 commits into
mainfrom
copilot/profile-plugin-resource-usage

Conversation

Copilot AI commented May 28, 2026

Copy link
Copy Markdown
Contributor

wp profile could not report resource usage at plugin granularity when profiling hooks. This change adds a plugin-level view so callback metrics can be aggregated per plugin via a first-class CLI flag.

  • Hook command surface

    • Added --plugin to wp profile hook options.
    • Updated command synopsis/docs (README.md, feature usage output) to include the new flag.
  • Plugin-level aggregation

    • Added grouping path in Command::hook() to aggregate callback metrics by plugin when --plugin is set.
    • Aggregates time, query/cache/request counters and durations, and computes aggregate cache_ratio.
    • Supports both standard plugins and mu-plugins by deriving plugin slug from callback location.
  • Behavior constraints

    • --plugin is only valid when profiling callbacks (wp profile hook <hook> or --all).
    • Returns a clear error if used on hook summary mode.
  • Acceptance coverage

    • Added Behat scenario validating plugin-grouped output for a test plugin on init.
wp profile hook init --plugin --fields=plugin,cache_hits,cache_misses

Example output shape:

+---------------+------------+--------------+
| plugin        | cache_hits | cache_misses |
+---------------+------------+--------------+
| resource-test | 0          | 1            |
+---------------+------------+--------------+
| total (1)     | 0          | 1            |
+---------------+------------+--------------+

Copilot AI linked an issue May 28, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 28, 2026 11:08
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add table of plugin resource usage with --plugin Add --plugin grouping to wp profile hook resource output May 28, 2026
Copilot AI requested a review from swissspidy May 28, 2026 11:12
Comment thread features/profile-hook.feature
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI requested a review from swissspidy May 28, 2026 11:25
@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

Copilot AI and others added 2 commits June 2, 2026 09:40
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.83117% with 24 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Command.php 68.83% 24 Missing ⚠️

📢 Thoughts on this report? Let us know!

This comment was marked as resolved.

swissspidy and others added 3 commits June 2, 2026 14:58
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@swissspidy swissspidy marked this pull request as ready for review June 5, 2026 09:45
@swissspidy swissspidy requested a review from a team as a code owner June 5, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Profile plugin resource usage with --plugin

3 participants