|
5 | 5 | use WP_CLI; |
6 | 6 | use WP_CLI\Utils; |
7 | 7 |
|
| 8 | +/** |
| 9 | + * Quickly identify what's slow with WordPress. |
| 10 | + * |
| 11 | + * ## EXAMPLES |
| 12 | + * |
| 13 | + * # See an overview for each stage of the load process. |
| 14 | + * $ wp profile stage --fields=stage,time,cache_ratio |
| 15 | + * +------------+---------+-------------+ |
| 16 | + * | stage | time | cache_ratio | |
| 17 | + * +------------+---------+-------------+ |
| 18 | + * | bootstrap | 0.7994s | 93.21% | |
| 19 | + * | main_query | 0.0123s | 94.29% | |
| 20 | + * | template | 0.792s | 91.23% | |
| 21 | + * +------------+---------+-------------+ |
| 22 | + * | total (3) | 1.6037s | 92.91% | |
| 23 | + * +------------+---------+-------------+ |
| 24 | + * |
| 25 | + * # Dive into hook performance for a given stage. |
| 26 | + * $ wp profile stage bootstrap --fields=hook,time,cache_ratio --spotlight |
| 27 | + * +--------------------------+---------+-------------+ |
| 28 | + * | hook | time | cache_ratio | |
| 29 | + * +--------------------------+---------+-------------+ |
| 30 | + * | muplugins_loaded:before | 0.2335s | 40% | |
| 31 | + * | muplugins_loaded | 0.0007s | 50% | |
| 32 | + * | plugins_loaded:before | 0.2792s | 77.63% | |
| 33 | + * | plugins_loaded | 0.1502s | 100% | |
| 34 | + * | after_setup_theme:before | 0.068s | 100% | |
| 35 | + * | init | 0.2643s | 96.88% | |
| 36 | + * | wp_loaded:after | 0.0377s | | |
| 37 | + * +--------------------------+---------+-------------+ |
| 38 | + * | total (7) | 1.0335s | 77.42% | |
| 39 | + * +--------------------------+---------+-------------+ |
| 40 | + */ |
8 | 41 | class Command { |
9 | 42 |
|
10 | 43 | /** |
|
0 commit comments