Title: Profiling a WP-CLI command
Last modified: July 8, 2026

---

# Profiling a WP-CLI command

 *  [jmslbam](https://wordpress.org/support/users/jmslbam/)
 * (@jmslbam)
 * [5 days, 21 hours ago](https://wordpress.org/support/topic/profiling-a-wp-cli-command/)
 * Hi! How are you?
   I tried to find a way to profile a custom WP-CLI command, but
   that’s kind of hard.
 * As in, maybe a Trait one could `use` in your custom Command and call `$this->
   start_profiling('profile-name');` before you logic starts and optional a `$this-
   >end_profiling();` ?
   Example of a simple, but effective Trait I built a while
   ago [https://github.com/jmslbam/wp-cli-base-command/blob/main/src/Bulk_Task.php](https://github.com/jmslbam/wp-cli-base-command/blob/main/src/Bulk_Task.php)
 * Kind regards,
 * Jaime Martinez

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [jmslbam](https://wordpress.org/support/users/jmslbam/)
 * (@jmslbam)
 * [5 days, 21 hours ago](https://wordpress.org/support/topic/profiling-a-wp-cli-command/#post-18959175)
 * Or something like this? [https://github.com/perftools/php-profiler#advanced-usage](https://github.com/perftools/php-profiler#advanced-usage)
 * ->start() ->end() etc
 *  Plugin Author [bruandet](https://wordpress.org/support/users/bruandet/)
 * (@bruandet)
 * [4 days, 14 hours ago](https://wordpress.org/support/topic/profiling-a-wp-cli-command/#post-18960797)
 * Thanks for the suggestion. I will check if that’s something that could be implemented.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fprofiling-a-wp-cli-command%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/code-profiler/assets/icon-256x256.png?rev=3143506)
 * [Code Profiler - WordPress Performance Profiling and Debugging Made Easy](https://wordpress.org/plugins/code-profiler/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-profiler/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-profiler/)
 * [Active Topics](https://wordpress.org/support/plugin/code-profiler/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-profiler/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-profiler/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [bruandet](https://wordpress.org/support/users/bruandet/)
 * Last activity: [4 days, 14 hours ago](https://wordpress.org/support/topic/profiling-a-wp-cli-command/#post-18960797)
 * Status: not resolved