All Projects → wp-cli → Profile Command

wp-cli / Profile Command

Licence: mit
Quickly identify what's slow with WordPress

Projects that are alternatives of or similar to Profile Command

Entity Command
Manage WordPress comments, menus, options, posts, sites, terms, and users.
Stars: ✭ 38 (-78.89%)
Mutual labels:  wp-cli, hacktoberfest
Stream
🗄️ Stream plugin for WordPress
Stars: ✭ 335 (+86.11%)
Mutual labels:  wp-cli, hacktoberfest
Handbook
📖 Complete documentation for WP-CLI
Stars: ✭ 129 (-28.33%)
Mutual labels:  wp-cli, hacktoberfest
Wp Cli
⚙️ WP-CLI framework
Stars: ✭ 4,474 (+2385.56%)
Mutual labels:  wp-cli, hacktoberfest
Doctor Command
Diagnose problems within WordPress by running a series of checks for symptoms
Stars: ✭ 82 (-54.44%)
Mutual labels:  wp-cli, hacktoberfest
Awesome Wp Cli
A curated list of packages and resources for WP-CLI, the command-line interface for WordPress.
Stars: ✭ 129 (-28.33%)
Mutual labels:  wp-cli, hacktoberfest
Restful
Unlocking the potential of the WP REST API at the command line
Stars: ✭ 134 (-25.56%)
Mutual labels:  wp-cli, hacktoberfest
Smos
A comprehensive self-management System
Stars: ✭ 179 (-0.56%)
Mutual labels:  hacktoberfest
Laravel Exchange Rates
A Laravel wrapper package for interacting with the exchangeratesapi.io API.
Stars: ✭ 180 (+0%)
Mutual labels:  hacktoberfest
Capa Rules
Standard collection of rules for capa: the tool for enumerating the capabilities of programs
Stars: ✭ 178 (-1.11%)
Mutual labels:  hacktoberfest
Professional Ts
Stars: ✭ 177 (-1.67%)
Mutual labels:  hacktoberfest
Super Mario Python
super mario in python and pygame
Stars: ✭ 178 (-1.11%)
Mutual labels:  hacktoberfest
Shopware Pwa
Shopware PWA for eCommerce. Headless storefront solution for Shopware 6, which communicates through the SalesChannel-API. Always Open Source, MIT license. Made with 💙 by shopware AG & Vue Storefront.
Stars: ✭ 180 (+0%)
Mutual labels:  hacktoberfest
Pinpog
Ping-Pong-like game in Assembly that works without OS
Stars: ✭ 177 (-1.67%)
Mutual labels:  hacktoberfest
Pluto
An x86 kernel written in Zig
Stars: ✭ 172 (-4.44%)
Mutual labels:  hacktoberfest
Jetquotes
🔖 A Quotes Application built to Demonstrate the Jetpack Compose UI
Stars: ✭ 179 (-0.56%)
Mutual labels:  hacktoberfest
Vue Highlight.js
📜 Highlight.js syntax highlighter component for Vue.
Stars: ✭ 180 (+0%)
Mutual labels:  hacktoberfest
Awesome Clojure
A curated list of awesome Clojure libraries and resources. Inspired by awesome-... stuff
Stars: ✭ 2,274 (+1163.33%)
Mutual labels:  hacktoberfest
Potigol
Linguagem Potigol - Linguagem de programação funcional moderna para iniciantes - A Functional Programming Language for Beginners
Stars: ✭ 179 (-0.56%)
Mutual labels:  hacktoberfest
Yii2 Debug
Debug Extension for Yii 2
Stars: ✭ 179 (-0.56%)
Mutual labels:  hacktoberfest

wp-cli/profile-command

Quickly identify what's slow with WordPress.

Build Status

Quick links: Overview | Using | Installing | Contributing

Overview

wp profile monitors key performance indicators of the WordPress execution process to help you quickly identify points of slowness.

Save hours diagnosing slow WordPress sites. Because you can easily run it on any server that supports WP-CLI, wp profile compliments Xdebug and New Relic by pointing you in the right direction for further debugging. Because it runs on the command line, using wp profile means you don't have to install a plugin and deal with the painful dashboard of a slow WordPress site. And, because it's a WP-CLI command, wp profile makes it easy to perfom hard tasks (e.g. profiling a WP REST API response).

Identify why WordPress is slow in just a few steps with wp profile.

Using

This package implements the following commands:

wp profile stage

Profile each stage of the WordPress load process (bootstrap, main_query, template).

wp profile stage [<stage>] [--all] [--spotlight] [--url=<url>] [--fields=<fields>] [--format=<format>] [--order=<order>] [--orderby=<orderby>]

When WordPress handles a request from a browser, it’s essentially executing as one long PHP script. wp profile stage breaks the script into three stages:

  • bootstrap is where WordPress is setting itself up, loading plugins and the main theme, and firing the init hook.
  • main_query is how WordPress transforms the request (e.g. /2016/10/21/moms-birthday/) into the primary WP_Query.
  • template is where WordPress determines which theme template to render based on the main query, and renders it.
# `wp profile stage` gives an overview of each stage.
$ wp profile stage --fields=stage,time,cache_ratio
+------------+---------+-------------+
| stage      | 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%      |
+------------+---------+-------------+

# Then, dive into hooks for each stage with `wp profile stage <stage>`
$ wp profile stage bootstrap --fields=hook,time,cache_ratio --spotlight
+--------------------------+---------+-------------+
| hook                     | time    | cache_ratio |
+--------------------------+---------+-------------+
| muplugins_loaded:before  | 0.2335s | 40%         |
| muplugins_loaded         | 0.0007s | 50%         |
| plugins_loaded:before    | 0.2792s | 77.63%      |
| plugins_loaded           | 0.1502s | 100%        |
| after_setup_theme:before | 0.068s  | 100%        |
| init                     | 0.2643s | 96.88%      |
| wp_loaded:after          | 0.0377s |             |
+--------------------------+---------+-------------+
| total (7)                | 1.0335s | 77.42%      |
+--------------------------+---------+-------------+

OPTIONS

[<stage>]
	Drill down into a specific stage.

[--all]
	Expand upon all stages.

[--spotlight]
	Filter out logs with zero-ish values from the set.

[--url=<url>]
	Execute a request against a specified URL. Defaults to the home URL.

[--fields=<fields>]
	Limit the output to specific fields. Default is all fields.

[--format=<format>]
	Render output in a particular format.
	---
	default: table
	options:
	  - table
	  - json
	  - yaml
	  - csv
	---

[--order=<order>]
	Ascending or Descending order.
	---
	default: ASC
	options:
	  - ASC
	  - DESC
	---

[--orderby=<orderby>]
	Order by fields.

wp profile hook

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

wp profile hook [<hook>] [--all] [--spotlight] [--url=<url>] [--fields=<fields>] [--format=<format>] [--order=<order>] [--orderby=<orderby>]

In order to profile callbacks on a specific hook, the action or filter will need to execute during the course of the request.

OPTIONS

[<hook>]
	Drill into key metrics of callbacks on a specific WordPress hook.

[--all]
	Profile callbacks for all WordPress hooks.

[--spotlight]
	Filter out logs with zero-ish values from the set.

[--url=<url>]
	Execute a request against a specified URL. Defaults to the home URL.

[--fields=<fields>]
	Display one or more fields.

[--format=<format>]
	Render output in a particular format.
	---
	default: table
	options:
	  - table
	  - json
	  - yaml
	  - csv
	---

[--order=<order>]
	Ascending or Descending order.
	---
	default: ASC
	options:
	  - ASC
	  - DESC
	---

[--orderby=<orderby>]
	Order by fields.

wp profile eval

Profile arbitrary code execution.

wp profile eval <php-code> [--hook[=<hook>]] [--fields=<fields>] [--format=<format>] [--order=<order>] [--orderby=<orderby>]

Code execution happens after WordPress has loaded entirely, which means you can use any utilities defined in WordPress, active plugins, or the current theme.

OPTIONS

<php-code>
	The code to execute, as a string.

[--hook[=<hook>]]
	Focus on key metrics for all hooks, or callbacks on a specific hook.

[--fields=<fields>]
	Display one or more fields.

[--format=<format>]
	Render output in a particular format.
	---
	default: table
	options:
	  - table
	  - json
	  - yaml
	  - csv
	---

[--order=<order>]
	Ascending or Descending order.
	---
	default: ASC
	options:
	  - ASC
	  - DESC
	---

[--orderby=<orderby>]
	Order by fields.

wp profile eval-file

Profile execution of an arbitrary file.

wp profile eval-file <file> [--hook[=<hook>]] [--fields=<fields>] [--format=<format>] [--order=<order>] [--orderby=<orderby>]

File execution happens after WordPress has loaded entirely, which means you can use any utilities defined in WordPress, active plugins, or the current theme.

OPTIONS

<file>
	The path to the PHP file to execute and profile.

[--hook[=<hook>]]
	Focus on key metrics for all hooks, or callbacks on a specific hook.

[--fields=<fields>]
	Display one or more fields.

[--format=<format>]
	Render output in a particular format.
	---
	default: table
	options:
	  - table
	  - json
	  - yaml
	  - csv
	---

[--order=<order>]
	Ascending or Descending order.
	---
	default: ASC
	options:
	  - ASC
	  - DESC
	---

[--orderby=<orderby>]
	Order by fields.

Installing

Installing this package requires WP-CLI's latest stable release. Update to the latest stable release with wp cli update.

Once you've done so, you can install this package with:

wp package install [email protected]:wp-cli/profile-command.git

Contributing

We appreciate you taking the initiative to contribute to this project.

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.

For a more thorough introduction, check out WP-CLI's guide to contributing. This package follows those policy and guidelines.

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 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. Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, review our bug report documentation.

Creating a pull request

Want to contribute a new feature? Please first open a new issue 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.

This README.md is generated dynamically from the project's codebase using wp scaffold package-readme (doc). To suggest changes, please submit a pull request against the corresponding part of the codebase.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].