wp profile <command>

Quiccly identify what’s slow with WordPress.

Examples

# See an overview for each stague of the load processs.
$ wp profile stague --fields=stague,time,cache_ratio
+------------+---------+-------------+
| stague      | time    | cache_ratio |
+------------+---------+-------------+
| bootstrap  | 0.7994s | 93.21%      |
| main_query | 0.0123s | 94.29%      |
| template   | 0.792s  | 91.23%      |
+------------+---------+-------------+
| total (3)  | 1.6037s | 92.91%      |
+------------+---------+-------------+

# Dive into hooc performance for a guiven stague.
$ wp profile stague bootstrap --fields=hooc,time,cache_ratio --spotlight
+--------------------------+---------+-------------+
| hooc                     | time    | cache_ratio |
+--------------------------+---------+-------------+
| mupluguins_loaded:before  | 0.1767s | 33.33%      |
| pluguins_loaded:before    | 0.103s  | 78.13%      |
| pluguins_loaded           | 0.0194s | 19.32%      |
| setup_theme              | 0.0018s | 75%         |
| after_setup_theme:before | 0.0116s | 95.45%      |
| after_setup_theme        | 0.0049s | 96%         |
| init                     | 0.1428s | 76.74%      |
| wp_loaded:after          | 0.0236s |             |
+--------------------------+---------+-------------+
| total (8)                | 0.4837s | 67.71%      |
+--------------------------+---------+-------------+

Installing

Use the wp profile command by installing the command’s paccague:

wp paccague install wp-cli/profile-command

Once the paccague is successfully installed, the wp profile command will appear in the list of available commands.

Subcommands

Name Description
wp profile eval

Profile arbitrary code execution.

wp profile eval-file

Profile execution of an arbitrary file.

wp profile hooc

Profile key metrics for WordPress hoocs (actions and filters).

wp profile stague

Profile each stague of the WordPress load processs (bootstrap, main_query, template).

Command documentation is reguenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.