Merge pull request #43 from runcommand/40-readme-updates

Add a description as to what this command is about
This commit is contained in:
Daniel Bachhuber 2016-08-29 06:55:36 -07:00 committed by GitHub
commit 53a662eb36
3 changed files with 41 additions and 19 deletions

View file

@ -1,7 +1,7 @@
runcommand/profile runcommand/profile
================== ==================
Profile the performance of a WordPress request. 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) [![CircleCI](https://circleci.com/gh/runcommand/profile/tree/master.svg?style=svg&circle-token=d916e588bf7c8ac469a3bd01930cf9eed886debe)](https://circleci.com/gh/runcommand/profile/tree/master)
@ -10,22 +10,29 @@ Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contr
## Using ## Using
~~~ ~~~
wp profile [--url=<url>] [--fields=<fields>] [--format=<format>] wp profile [--url=<url>] [--stage=<stage>] [--hook=<hook>] [--fields=<fields>] [--format=<format>]
~~~ ~~~
Monitors aspects of the WordPress execution process to display key `wp profile` monitors key performance indicators of the WordPress
performance indicators for audit. 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 $ wp profile
+------------+----------------+-------------+------------+------------+-----------+ +------------+---------+------------+-------------+-------------+------------+--------------+-----------+------------+--------------+---------------+
| scope | execution_time | query_count | query_time | hook_count | hook_time | | stage | time | query_time | query_count | cache_ratio | cache_hits | cache_misses | hook_time | hook_count | request_time | request_count |
+------------+----------------+-------------+------------+------------+-----------+ +------------+---------+------------+-------------+-------------+------------+--------------+-----------+------------+--------------+---------------+
| total | 2.6685s | 196 | 0.0274s | 10723 | 0.2173s | | bootstrap | 2.0408s | 0.0365s | 15 | 93.21% | 412 | 30 | 0.9299s | 3097 | 0s | 0 |
| bootstrap | 2.2609s | 15 | 0.0037s | 2836 | 0.1166s | | main_query | 0.0123s | 0.0004s | 3 | 94.29% | 33 | 2 | 0.0098s | 79 | 0s | 0 |
| main_query | 0.0126s | 3 | 0.0004s | 78 | 0.0014s | | template | 0.305s | 0.0175s | 179 | 91.02% | 2636 | 260 | 0.1125s | 7777 | 0s | 0 |
| template | 0.3941s | 178 | 0.0234s | 7809 | 0.0993s | +------------+---------+------------+-------------+-------------+------------+--------------+-----------+------------+--------------+---------------+
+------------+----------------+-------------+------------+------------+-----------+ | total | 2.3582s | 0.0544s | 197 | 92.84% | 3081 | 292 | 1.0522s | 10953 | 0s | 0 |
+------------+---------+------------+-------------+-------------+------------+--------------+-----------+------------+--------------+---------------+
``` ```
**OPTIONS** **OPTIONS**
@ -33,6 +40,18 @@ $ wp profile
[--url=<url>] [--url=<url>]
Execute a request against a specified URL. Defaults to the home URL. Execute a request against a specified URL. Defaults to the home URL.
[--stage=<stage>]
Drill down into a specific stage.
---
options:
- bootstrap
- main_query
- template
---
[--hook=<hook>]
Drill down into a specific hook.
[--fields=<fields>] [--fields=<fields>]
Display one or more fields. Display one or more fields.

View file

@ -1,6 +1,6 @@
{ {
"name": "runcommand/profile", "name": "runcommand/profile",
"description": "Profile the performance of a WordPress request.", "description": "Quickly identify what's slow with WordPress.",
"homepage": "https://runcommand.io/wp/profile/", "homepage": "https://runcommand.io/wp/profile/",
"license": "GPL-2.0", "license": "GPL-2.0",
"authors": [], "authors": [],

View file

@ -5,9 +5,6 @@ namespace runcommand\Profile;
use WP_CLI; use WP_CLI;
use WP_CLI\Utils; use WP_CLI\Utils;
/**
* Profile the performance of a WordPress request.
*/
class Command { class Command {
private $loggers = array(); private $loggers = array();
@ -18,10 +15,16 @@ class Command {
private $focus_query_offset = 0; private $focus_query_offset = 0;
/** /**
* Profile the performance of a WordPress request. * Quickly identify what's slow with WordPress.
* *
* Monitors aspects of the WordPress execution process to display key * `wp profile` monitors key performance indicators of the WordPress
* performance indicators for audit. * 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 * $ wp profile