From f34f47f4db4608eac399ebbae5a77a833e97bded Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Mon, 29 Aug 2016 07:20:58 -0700 Subject: [PATCH] Add installing and support details to README --- README.md | 117 +++++++++++++++---------- bin/readme/contributing-body.md | 3 + bin/readme/installing-body.md | 5 ++ bin/readme/package-description-post.md | 71 +++++++++++++++ composer.json | 13 ++- inc/class-command.php | 21 ----- 6 files changed, 163 insertions(+), 67 deletions(-) create mode 100644 bin/readme/contributing-body.md create mode 100644 bin/readme/installing-body.md create mode 100644 bin/readme/package-description-post.md diff --git a/README.md b/README.md index badc72f..a578afd 100644 --- a/README.md +++ b/README.md @@ -3,24 +3,11 @@ runcommand/profile Quickly identify what's slow with WordPress. -[![CircleCI](https://circleci.com/gh/runcommand/profile/tree/master.svg?style=svg&circle-token=d916e588bf7c8ac469a3bd01930cf9eed886debe)](https://circleci.com/gh/runcommand/profile/tree/master) +`wp profile` monitors key performance indicators of the WordPress execution process to help you quickly identify points of slowness. -Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) +Save tens of minutes diagnosing slow WordPress sites. Because you can install and run `wp profile` on any server that supports WP-CLI, it compliments Xdebug and New Relic by pointing you in the right direction for further debugging. And, because it's a WP-CLI command, using `wp profile` means you don't have to install a plugin and deal with the painful dashboard of a slow WordPress site. -## Using - -~~~ -wp profile [--url=] [--stage=] [--hook=] [--fields=] [--format=] -~~~ - -`wp profile` monitors key performance indicators of the WordPress -execution process to help you quickly identify where the slowness is -coming from. Because you can install and run it on any server that -supports WP-CLI, in 15 seconds or less, `wp profile` compliments Xdebug -and New Relic by pointing you in the right direction for further -debugging. And, because it's a WP-CLI command, using `wp profile` means -you don't have to install a plugin and deal with the painful dashboard -of a slow WordPress site. +First, run `wp profile` to see metrics for each stage of the WordPress load process: ``` $ wp profile @@ -35,6 +22,69 @@ $ wp profile +------------+---------+------------+-------------+-------------+------------+--------------+-----------+------------+--------------+---------------+ ``` +Then, use `--stage=` to dive into higher fidelity of a particular stage: + +``` +$ wp profile --stage=bootstrap ++-------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| hook | time | query_time | query_count | cache_ratio | cache_hits | cache_misses | request_time | request_count | ++-------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| | 0.3558s | 0.0014s | 1 | 25% | 1 | 3 | 0s | 0 | +| muplugins_loaded | 0.0002s | 0s | 0 | 50% | 1 | 1 | 0s | 0 | +| | 0.8075s | 0.0007s | 6 | 73.68% | 56 | 20 | 0s | 0 | +| plugins_loaded | 0.4271s | 0s | 0 | 100% | 138 | 0 | 0s | 0 | +| | 0.0046s | 0s | 0 | 100% | 6 | 0 | 0s | 0 | +| setup_theme | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | +| | 0.2401s | 0s | 0 | 100% | 26 | 0 | 0s | 0 | +| after_setup_theme | 0.0007s | 0s | 0 | 100% | 4 | 0 | 0s | 0 | +| | 0.0001s | 0s | 0 | 100% | 2 | 0 | 0s | 0 | +| init | 0.2922s | 0.0016s | 8 | 96.3% | 156 | 6 | 0s | 0 | +| | 0.0277s | 0s | 0 | 100% | 2 | 0 | 0s | 0 | +| wp_loaded | 0.01s | 0s | 0 | | 0 | 0 | 0s | 0 | ++-------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| total | 2.166s | 0.0037s | 15 | 84.5% | 392 | 30 | 0s | 0 | ++-------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +``` + +Lastly, when you've found a specific hook you'd like to assess, use `--hook=`: + +``` +$ wp profile --hook=plugins_loaded ++------------------------------------------------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| callback | time | query_time | query_count | cache_ratio | cache_hits | cache_misses | request_time | request_count | ++------------------------------------------------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| wp_maybe_load_widgets() | 0.0309s | 0s | 0 | | 0 | 0 | 0s | 0 | +| wp_maybe_load_embeds() | 0.0001s | 0s | 0 | | 0 | 0 | 0s | 0 | +| VaultPress_Hotfixes->protect_jetpack_402_from_oembed_xss() | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | +| _wp_customize_include() | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | +| Debug_Bar_Remote_Requests() | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | +| EasyRecipePlus->pluginsLoaded() | 0.0029s | 0s | 0 | 100% | 4 | 0 | 0s | 0 | +| Gamajo\GenesisHeaderNav\genesis_header_nav_i18n() | 0.0007s | 0s | 0 | | 0 | 0 | 0s | 0 | +| DS_Public_Post_Preview::init() | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | +| wpseo_load_textdomain() | 0.0006s | 0s | 0 | | 0 | 0 | 0s | 0 | +| load_yoast_notifications() | 0.003s | 0s | 0 | | 0 | 0 | 0s | 0 | +| wpseo_init() | 0.101s | 0s | 0 | 100% | 70 | 0 | 0s | 0 | +| wpseo_frontend_init() | 0.0003s | 0s | 0 | 100% | 2 | 0 | 0s | 0 | +| Black_Studio_TinyMCE_Plugin->load_compatibility() | 0.0122s | 0s | 0 | | 0 | 0 | 0s | 0 | +| Jetpack::load_modules() | 0.2706s | 0s | 0 | 100% | 62 | 0 | 0s | 0 | +| function(){} | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | ++------------------------------------------------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| total | 0.4226s | 0s | 0 | 100% | 138 | 0 | 0s | 0 | ++------------------------------------------------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +``` + +Et voila! You've identified some of the sources of slowness. + +[![CircleCI](https://circleci.com/gh/runcommand/profile/tree/master.svg?style=svg)](https://circleci.com/gh/runcommand/profile/tree/master) + +Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) + +## Using + +~~~ +wp profile [--url=] [--stage=] [--hook=] [--fields=] [--format=] +~~~ + **OPTIONS** [--url=] @@ -68,39 +118,16 @@ $ wp profile ## Installing -Installing this package requires WP-CLI v0.23.0 or greater. Update to the latest stable release with `wp cli update`. +Installing the `wp profile` command is a three-step process: -Once you've done so, you can install this package with `wp package install runcommand/profile`. +1. Download the package from the URL in the purchase email. +2. Extract the package files. +3. Run `wp --require=command.php profile` to execute the profiler. ## Contributing -We appreciate you taking the initiative to contribute to this project. +Support (bug reports, feature requests, and general usage questions) is available to those with an active runcommand subscription. -Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation. - -### Reporting a bug - -Think you’ve found a bug? We’d love for you to help us get it fixed. - -Before you create a new issue, you should [search existing issues](https://github.com/runcommand/profile/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version. - -Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/runcommand/profile/issues/new) with the following: - -1. What you were doing (e.g. "When I run `wp post list`"). -2. What you saw (e.g. "I see a fatal about a class being undefined."). -3. What you expected to see (e.g. "I expected to see the list of posts.") - -Include as much detail as you can, and clear steps to reproduce if possible. - -### Creating a pull request - -Want to contribute a new feature? Please first [open a new issue](https://github.com/runcommand/profile/issues/new) to discuss whether the feature is a good fit for the project. - -Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience: - -1. Create a feature branch for each contribution. -2. Submit your pull request early for feedback. -3. Include functional tests with your changes. [Read the WP-CLI documentation](https://wp-cli.org/docs/pull-requests/#functional-tests) for an introduction. -4. Follow the [WordPress Coding Standards](http://make.wordpress.org/core/handbook/coding-standards/). +Send an email to [support@runcommand.io](mailto:support@runcommand.io). *This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.* diff --git a/bin/readme/contributing-body.md b/bin/readme/contributing-body.md new file mode 100644 index 0000000..cf1a147 --- /dev/null +++ b/bin/readme/contributing-body.md @@ -0,0 +1,3 @@ +Support (bug reports, feature requests, and general usage questions) is available to those with an active runcommand subscription. + +Send an email to [support@runcommand.io](mailto:support@runcommand.io). diff --git a/bin/readme/installing-body.md b/bin/readme/installing-body.md new file mode 100644 index 0000000..15253f9 --- /dev/null +++ b/bin/readme/installing-body.md @@ -0,0 +1,5 @@ +Installing the `wp profile` command is a three-step process: + +1. Download the package from the URL in the purchase email. +2. Extract the package files. +3. Run `wp --require=command.php profile` to execute the profiler. diff --git a/bin/readme/package-description-post.md b/bin/readme/package-description-post.md new file mode 100644 index 0000000..998700e --- /dev/null +++ b/bin/readme/package-description-post.md @@ -0,0 +1,71 @@ +`wp profile` monitors key performance indicators of the WordPress execution process to help you quickly identify points of slowness. + +Save tens of minutes diagnosing slow WordPress sites. Because you can install and run `wp profile` on any server that supports WP-CLI, it compliments Xdebug and New Relic by pointing you in the right direction for further debugging. And, because it's a WP-CLI command, using `wp profile` means you don't have to install a plugin and deal with the painful dashboard of a slow WordPress site. + +First, run `wp profile` to see metrics for each stage of the WordPress load process: + +``` +$ wp profile ++------------+---------+------------+-------------+-------------+------------+--------------+-----------+------------+--------------+---------------+ +| stage | time | query_time | query_count | cache_ratio | cache_hits | cache_misses | hook_time | hook_count | request_time | request_count | ++------------+---------+------------+-------------+-------------+------------+--------------+-----------+------------+--------------+---------------+ +| bootstrap | 2.0408s | 0.0365s | 15 | 93.21% | 412 | 30 | 0.9299s | 3097 | 0s | 0 | +| main_query | 0.0123s | 0.0004s | 3 | 94.29% | 33 | 2 | 0.0098s | 79 | 0s | 0 | +| template | 0.305s | 0.0175s | 179 | 91.02% | 2636 | 260 | 0.1125s | 7777 | 0s | 0 | ++------------+---------+------------+-------------+-------------+------------+--------------+-----------+------------+--------------+---------------+ +| total | 2.3582s | 0.0544s | 197 | 92.84% | 3081 | 292 | 1.0522s | 10953 | 0s | 0 | ++------------+---------+------------+-------------+-------------+------------+--------------+-----------+------------+--------------+---------------+ +``` + +Then, use `--stage=` to dive into higher fidelity of a particular stage: + +``` +$ wp profile --stage=bootstrap ++-------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| hook | time | query_time | query_count | cache_ratio | cache_hits | cache_misses | request_time | request_count | ++-------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| | 0.3558s | 0.0014s | 1 | 25% | 1 | 3 | 0s | 0 | +| muplugins_loaded | 0.0002s | 0s | 0 | 50% | 1 | 1 | 0s | 0 | +| | 0.8075s | 0.0007s | 6 | 73.68% | 56 | 20 | 0s | 0 | +| plugins_loaded | 0.4271s | 0s | 0 | 100% | 138 | 0 | 0s | 0 | +| | 0.0046s | 0s | 0 | 100% | 6 | 0 | 0s | 0 | +| setup_theme | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | +| | 0.2401s | 0s | 0 | 100% | 26 | 0 | 0s | 0 | +| after_setup_theme | 0.0007s | 0s | 0 | 100% | 4 | 0 | 0s | 0 | +| | 0.0001s | 0s | 0 | 100% | 2 | 0 | 0s | 0 | +| init | 0.2922s | 0.0016s | 8 | 96.3% | 156 | 6 | 0s | 0 | +| | 0.0277s | 0s | 0 | 100% | 2 | 0 | 0s | 0 | +| wp_loaded | 0.01s | 0s | 0 | | 0 | 0 | 0s | 0 | ++-------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| total | 2.166s | 0.0037s | 15 | 84.5% | 392 | 30 | 0s | 0 | ++-------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +``` + +Lastly, when you've found a specific hook you'd like to assess, use `--hook=`: + +``` +$ wp profile --hook=plugins_loaded ++------------------------------------------------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| callback | time | query_time | query_count | cache_ratio | cache_hits | cache_misses | request_time | request_count | ++------------------------------------------------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| wp_maybe_load_widgets() | 0.0309s | 0s | 0 | | 0 | 0 | 0s | 0 | +| wp_maybe_load_embeds() | 0.0001s | 0s | 0 | | 0 | 0 | 0s | 0 | +| VaultPress_Hotfixes->protect_jetpack_402_from_oembed_xss() | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | +| _wp_customize_include() | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | +| Debug_Bar_Remote_Requests() | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | +| EasyRecipePlus->pluginsLoaded() | 0.0029s | 0s | 0 | 100% | 4 | 0 | 0s | 0 | +| Gamajo\GenesisHeaderNav\genesis_header_nav_i18n() | 0.0007s | 0s | 0 | | 0 | 0 | 0s | 0 | +| DS_Public_Post_Preview::init() | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | +| wpseo_load_textdomain() | 0.0006s | 0s | 0 | | 0 | 0 | 0s | 0 | +| load_yoast_notifications() | 0.003s | 0s | 0 | | 0 | 0 | 0s | 0 | +| wpseo_init() | 0.101s | 0s | 0 | 100% | 70 | 0 | 0s | 0 | +| wpseo_frontend_init() | 0.0003s | 0s | 0 | 100% | 2 | 0 | 0s | 0 | +| Black_Studio_TinyMCE_Plugin->load_compatibility() | 0.0122s | 0s | 0 | | 0 | 0 | 0s | 0 | +| Jetpack::load_modules() | 0.2706s | 0s | 0 | 100% | 62 | 0 | 0s | 0 | +| function(){} | 0s | 0s | 0 | | 0 | 0 | 0s | 0 | ++------------------------------------------------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +| total | 0.4226s | 0s | 0 | 100% | 138 | 0 | 0s | 0 | ++------------------------------------------------------------+---------+------------+-------------+-------------+------------+--------------+--------------+---------------+ +``` + +Et voila! You've identified some of the sources of slowness. diff --git a/composer.json b/composer.json index f7a3f57..5c2012c 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,17 @@ "extras": { "commands": [ "profile" - ] + ], + "readme": { + "package_description": { + "post": "bin/readme/package-description-post.md" + }, + "installing": { + "body": "bin/readme/installing-body.md" + }, + "contributing": { + "body": "bin/readme/contributing-body.md" + } + } } } diff --git a/inc/class-command.php b/inc/class-command.php index e609172..c93c998 100644 --- a/inc/class-command.php +++ b/inc/class-command.php @@ -17,27 +17,6 @@ class Command { /** * Quickly identify what's slow with WordPress. * - * `wp profile` monitors key performance indicators of the WordPress - * execution process to help you quickly identify where the slowness is - * coming from. Because you can install and run it on any server that - * supports WP-CLI, in 15 seconds or less, `wp profile` compliments Xdebug - * and New Relic by pointing you in the right direction for further - * debugging. And, because it's a WP-CLI command, using `wp profile` means - * you don't have to install a plugin and deal with the painful dashboard - * of a slow WordPress site. - * - * ``` - * $ wp profile - * +------------+----------------+-------------+------------+------------+-----------+ - * | stage | execution_time | query_count | query_time | hook_count | hook_time | - * +------------+----------------+-------------+------------+------------+-----------+ - * | total | 2.6685s | 196 | 0.0274s | 10723 | 0.2173s | - * | bootstrap | 2.2609s | 15 | 0.0037s | 2836 | 0.1166s | - * | main_query | 0.0126s | 3 | 0.0004s | 78 | 0.0014s | - * | template | 0.3941s | 178 | 0.0234s | 7809 | 0.0993s | - * +------------+----------------+-------------+------------+------------+-----------+ - * ``` - * * ## OPTIONS * * [--url=]