Skip to content

Instantly share code, notes, and snippets.

@wokamoto
Last active April 8, 2019 08:11
Show Gist options
  • Select an option

  • Save wokamoto/26a219818df0f78cf6784b15c42b716a to your computer and use it in GitHub Desktop.

Select an option

Save wokamoto/26a219818df0f78cf6784b15c42b716a to your computer and use it in GitHub Desktop.
[WordPress] 負荷がかかっている処理を見つけるのに wp profile がとても便利だった ref: https://qiita.com/wokamoto/items/3902278e658ba856f1a9
$ wp package install git@github.com:wp-cli/profile-command.git
Installing package wp-cli/profile-command (dev-master)
Updating /home/ec2-user/.wp-cli/packages/composer.json to require the package...
Registering git@github.com:wp-cli/profile-command.git as a VCS repository...
Using Composer to install the package...
---
Loading composer repositories with package information
Updating dependencies
Resolving dependencies through SAT
Dependency resolution completed in 0.212 seconds
Analyzed 5353 packages to resolve dependencies
Analyzed 311432 rules to resolve dependencies
Package operations: 1 install, 0 updates, 0 removals
Installs: wp-cli/profile-command:dev-master efb296b
- Installing wp-cli/profile-command (dev-master efb296b)
Writing lock file
Generating autoload files
---
Success: Package installed.
$ wp profile stage --fields=stage,time,cache_ratio
+------------+---------+-------------+
| stage | time | cache_ratio |
+------------+---------+-------------+
| bootstrap | 0.3982s | 99.79% |
| main_query | 0.0074s | 99.29% |
| template | 0.1109s | 99.82% |
+------------+---------+-------------+
| total (3) | 0.5165s | 99.63% |
+------------+---------+-------------+
$ wp profile stage bootstrap --fields=hook,callback_count,time,cache_ratio --spotlight
+--------------------------+----------------+---------+-------------+
| hook | callback_count | time | cache_ratio |
+--------------------------+----------------+---------+-------------+
| muplugins_loaded:before | | 0.1122s | 100% |
| plugins_loaded:before | | 0.1557s | 99.31% |
| plugins_loaded | 30 | 0.0616s | 100% |
| after_setup_theme:before | | 0.0134s | 100% |
| init | 50 | 0.0241s | 100% |
| wp_loaded:after | | 0.0292s | |
+--------------------------+----------------+---------+-------------+
| total (6) | 80 | 0.3961s | 99.86% |
+--------------------------+----------------+---------+-------------+
$ wp profile hook plugins_loaded --fields=callback,location,time --order=DESC --orderby=time
+------------------------------------------------------------------+-------------------------------------------------------------------+---------+
| callback | location | time |
+------------------------------------------------------------------+-------------------------------------------------------------------+---------+
| Jetpack::load_modules() | jetpack/class.jetpack.php:1749 | 0.0268s |
| Jetpack_Sync_Actions::init() | jetpack/sync/class.jetpack-sync-actions.php:17 | 0.0109s |
| Jetpack::plugin_textdomain() | jetpack/class.jetpack.php:928 | 0.0093s |
| wpcf7() | contact-form-7/settings.php:89 | 0.0069s |
| wp_maybe_load_widgets() | wp-includes/functions.php:3681 | 0.0042s |
| LogBook\plugins_loaded() | logbook/logbook.php:23 | 0.0017s |
| Jetpack->check_twitter_tags() | jetpack/class.jetpack.php:1997 | 0.0005s |
| TotalHacks->plugins_loaded() | wp-total-hacks/wp-total-hacks.php:125 | 0.0004s |
| BA_Edit_Author_Slug->load_textdomain() | edit-author-slug/includes/classes/class-edit-author-slug.php:330 | 0.0003s |
| NginxChampuru->plugins_loaded() | nginx-champuru/nginx-champuru.php:129 | 0.0002s |
| gist->plugins_loaded() | oembed-gist/oembed-gist.php:25 | 0.0002s |
| function(){} | mu-plugins/cloudfront-fix.php:2 | 0.0002s |
| wp_maybe_load_embeds() | wp-includes/embed.php:176 | 0.0001s |
| geoip_detect_load_textdomain() | geoip-detect/init.php:25 | 0.0001s |
| Jetpack->extra_oembed_providers() | jetpack/class.jetpack.php:1728 | 0.0001s |
| Jetpack_Sync_Actions::initialize_woocommerce() | jetpack/sync/class.jetpack-sync-actions.php:295 | 0.0001s |
| Amazonpolly_I18n->load_plugin_textdomain() | amazon-polly/includes/class-amazonpolly-i18n.php:34 | 0.0001s |
| Jetpack_Sync_Actions::initialize_wp_super_cache() | jetpack/sync/class.jetpack-sync-actions.php:308 | 0s |
| function(){} | hacks/hacks.php:255 | 0s |
| geoip_detect_defines() | geoip-detect/init.php:2 | 0s |
| _wp_customize_include() | wp-includes/theme.php:2772 | 0s |
| geoip_detect_maybe_upgrade_version() | geoip-detect/upgrade-plugin.php:73 | 0s |
| NginxChampuru_Caching->wp_cron_caching() | nginx-champuru/includes/caching.class.php:99 | 0s |
| Jetpack->check_rest_api_compat() | jetpack/class.jetpack.php:1844 | 0s |
| mycategoryorder_init() | my-category-order/mycategoryorder.php:12 | 0s |
| function(){} | c3-cloudfront-clear-cache/module/model/fixtures/avoid_preview_cac | 0s |
| | he.php:12 | |
| YellowTree\GeoipDetect\DataSources\Auto\AutoDataSource->on_plugi | geoip-detect/data-sources/auto.php:72 | 0s |
| ns_loaded() | | |
| Jetpack_3rd_Party_Domain_Mapping->attempt_to_hook_domain_mapping | jetpack/3rd-party/domain-mapping.php:41 | 0s |
| _plugins() | | |
| Nginx_Mobile_Theme->plugins_loaded() | nginx-mobile-theme/nginx-mobile-theme.php:48 | 0s |
| function(){} | hacks/hacks.php:23 | 0s |
+------------------------------------------------------------------+-------------------------------------------------------------------+---------+
| total (30) | | 0.0622s |
+------------------------------------------------------------------+-------------------------------------------------------------------+---------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment