Code Profiler – WordPress Performance Profiling and Debugging Made Easy

外掛說明

A profiler to measure the performance of your WordPress plugins and themes.

Code Profiler helps you to measure the performance of your plugins and themes at the PHP level and to quickly find any potential problem in your WordPress installation.

You can profile the frontend and backend of WordPress, a custom URL, or even send a POST payload and custom cookies to profile a contact form, a checkout process or an AJAX action among many other possibilities.

It generates an extremely detailed and easy to read analysis in the form of charts and tables that shows not only which plugin or theme, but also which PHP script, class, method and function is slowing down your website. It displays many useful additional information such as database queries, file I/O operations and disk I/O usage as well.

It makes it very simple to locate any bottleneck problem in your themes or plugins in order to solve it and speed up your website.
Install, activate it and you can start profiling your site right away.

Features

  • Plugins & themes performance profiling.
  • [Pro] Scripts performance profiling.
  • [Pro] Methods & functions performance profiling.
  • [Pro] Database queries performance.
  • [Pro] File I/O operations monitoring.
  • File I/O statistics.
  • Disk I/O monitoring.
  • WP-CLI integration.
  • Export charts in PNG image format.
  • GET/POST methods, custom cookies.
  • [Pro] Export all tables and charts in CSV file format.
  • [Pro] Filtering options

Learn more about Code Profiler Pro.

螢幕擷圖

  • Running the profiler.
  • Plugins and Themes performance section.
  • WP-CLI integration.
  • File I/O statistics.
  • Disk I/O statistics.
  • [Pro version]: Scripts performance.
  • [Pro version]: Methods and Functions performance.
  • [Pro version]: CSV Export.
  • [Pro version]: CSV Export.
  • [Pro version]: File I/O List
  • [Pro version]: Database queries performance.

安裝方式

  1. Upload the ZIP file from the WordPress “Plugins > Add New” menu.
  2. Activate the plugin.
  3. Plugin settings are located in the ‘Code Profiler’ menu.

常見問題集

What are the differences between Code Profiler and services such as Google PageSpeed or GTmetrix?

They are completely different: Code Profiler analyzes the code performance of your plugins and themes on your server, at the PHP level. Google PageSpeed and GTmetrix, instead, analyze the content of a web page from a browser’s perspective.

Will Code Profiler work if I have a caching plugin or a PHP opcode cache, or if my website is using a CDN service?

In most cases, Code Profiler will be able to bypass caching from plugins and CDN services, as well as your PHP opcode cache. If there were a problem, it would warn you about it.

Why do I see numbers such as “3E-06” or “1.2E-05” after opening the CSV file with my spreadsheet editor?

Spreadsheet editors such as LibreOffice Calc and Microsoft Excel can use scientific exponential notation to display very small numbers, for instance, 0.000025 will become 2.5e-5. Select the whole column of numbers and, in the toolbar of your spreadsheet editor, click the button to increase the number of decimals to 6.

Why do some scripts show an execution time of 0 second?

That can happen if your PHP version is 7.1 or 7.2. With those versions, Code Profiler can only use microseconds for its metrics, while with versions 7.3 and above it can use the system’s high resolution time in nanoseconds. It can also happen if a PHP script has only a couple of lines of code, its execution time is too quick to be measured, hence it will show 0.

Do I need to deactivate Code Profiler when I’m not using it ?

There’s no need to deactivate Code Profiler when you don’t use it, it has no performance impact on your site.

Why does Code Profiler Pro warn me that I have multiple plugins using Composer?

Composer, a tool for dependency management in PHP, is included in many popular plugins and themes. It is used to autoload PHP classes.
Code Profiler (Pro version only) will inform you if two or more activated plugins use it because you will need to take it into consideration when reading and interpreting the results. Let’s take an example:
Assuming you have 4 plugins: A, B, C and D. Both plugins A and D include and require Composer. WordPress will start and load plugin A, which will run an instance of Composer to load its classes. Immediately after, WordPress will load plugins B and C. Then, it will load plugin D, which too will need to load its classes. However, plugin D will not start a new instance of Composer but, instead, will rely on the one from plugin A to load its own classes.
As a result, the execution time of plugin A will increase (its instance of Composer is used to load classes for plugin C too), while the execution time of plugin C will decrease (it doesn’t need to start a new instance of Composer).
That is not a problem at all when you are profiling your website but, assuming you are a developer and just want to profile a plugin that you wrote and that includes Composer, you will need to disable any other plugin using Composer in order to get the most accurate results for your plugin only.

Is Code Profiler multisite compatible?

Code Profiler is multisite compatible. Note however that for security reasons, only the superadmin can run it.

What are the requirements for running Code Profiler?

  • WordPress >=5.0.
  • PHP >=7.1 or 8.x.

What is your Privacy Policy?

Code Profiler does not collect any private data from you or your visitors. It does not use cookies either. Your website can run Code Profiler and be compliant with the General Data Protection Regulation (GDPR) or other similar privacy laws.

使用者評論

2022 年 6 月 4 日
The free version fulfils its main function of helping to determine the time required for the different plugins (and theme) to load, I hope the developer keeps this fantastic plugin up to date!
2022 年 5 月 17 日
The plugin runtime chart is cool -> 2 stars for it. But all other useful profiling tools are part of the pro version and missing in the standard version. The Standard version is not useful.
2022 年 5 月 11 日
I was one step away from giving it 5 stars, since until two weeks ago it was working great. But now, it returns the following error "The website returned the following HTTP status code: "500 Internal Server Error. By default, the profiler will always abort and throw an error if the server did not return a 200 HTTP status code. You can change that behavior in the Settings section if the page you are profiling needs to return a different code (3xx, 4xx or 5xx)". And my website is not down, quite the opposite, it works perfectly. I have tried stopping the plugins and security systems, but it keeps giving me that error. Nor have I made too relevant changes in the structure that influence its operation.
2022 年 1 月 21 日
Thanks for writing this free plugin, I was looking for such plugin since years, since the P3 plugin is not maintained and makes websites crashing. It's simple, fast, and easy to use!
閱讀全部 6 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Code Profiler – WordPress Performance Profiling and Debugging Made Easy〉的開發相關工作。

參與者

變更記錄

1.4.4

(July 28, 2022)

  • Mu-plugins are now processed by the profiler. They will have the “MU” abbreviation displayed beside their name on all graphs and tables.
  • We added a new “Support” tab in the profiler’s page that displays a system information report. When contacting the support for help, please copy and paste it in your ticket.
  • [Pro version] : Code Profiler will temporarily disable any “wp-content/db.php” script found on your site to prevent it from interfering with the profiler and database queries. That option can be changed in the “Settings” page.
  • Fixed a potential “Serialization of Closure is not allowed” PHP error.
  • Small fixes and adjustments.

1.4.3 (July 02, 2022)

  • When running the profiler as an authenticated user, you can now enter the name of that user.
  • [Pro version] : Fixed a bug in the “File I/O List” section where files located outside the ABSPATH had their name truncated.
  • Updated Charts.js libraries.
  • [Pro version] : Updated Code Mirror libraries.
  • Small fixes and adjustments.

1.4.2 (June 02, 2022)

  • The profiler will memorize the settings used for the last profile.
  • In the “Profiles List” section, the “Filter” input field will also apply to the profiles name.
  • Added Edge browser to the user-agent signatures list box.
  • [Pro version] : You can export the list of profiles. Click on the “Download as a CSV file” button below the table in the “Profiles List” section.
  • Updated Charts.js libraries.
  • [Pro version] : Updated Code Mirror libraries.
  • Small fixes and adjustments.

1.4.1 (April 26, 2022)

  • Added an “Advanced Options” button in the profiler’s main page that allows you to select the HTTP method (GET or POST), send a POST payload as well as custom cookies. Those features are helpful if, for instance, you want to profile a contact form, a checkout process or an AJAX action etc.
  • Small fixes and adjustments.
  • [Pro version]: Updated Code Mirror libraries.

1.4 (March 30, 2022)

  • [Pro version]: We added a new section: “Database queries performances”. It shows all database queries for the plugins and the theme, their processing time and a backtrace that lists the scripts and function calls that lead to the query.
  • [Pro version]: All “Name” columns were renamed to “Component”.
  • Fixed an issue in the “Plugins and Theme” graph where special characters were wrongly replaced with their HTML entities.
  • WP-CLI: Fixed an issue where all error and warning messages were json-encoded.
  • The cURL timeout was increased from 90 to 180 seconds.
  • Updated Charts.js libraries.
  • [Pro version]: Updated Code Mirror libraries.
  • Small fixes and adjustments.

1.3.1 (February 26, 2022)

  • Fixed some bugs with right-to-left (RTL) WordPress sites: the tooltip in the profiler main page and the checkboxes below the log were all messed up.
  • By default, the profiler will always abort and throw an error if the server didn’t return a “200 OK” HTTP status code. You can change that behaviour in the “Settings” section if the page you are profiling needs to return a different code (3xx, 4xx or 5xx).
  • WP-CLI: Added support for HTTP basic authentication with the --u and --p parameters. Run wp code-profiler help for more details.
  • WP-CLI: Added support for WordPress user authentication with the --user parameter. Run wp code-profiler help for more details.
  • [Pro version]: WP-CLI: You can now profile any page/post with the --dest parameter. Run wp code-profiler-pro help for more details.
  • When disabling the plugin, it will delete its MU plugin.
  • The list of posts has been removed from the dropdown menu. To profile a post, please use the new “Custom post” input field that was introduced in v1.2.
  • [Pro version]: Fixed a bug in the “Method & Function” table where the action links were not working on smartphones because of a wrong value used for the colspan attribute.
  • [Pro version] : Replaced strcmp() with strnatcmp() to sort some table columns with a “natural order” algorithm.
  • You can exclude a plugin during the profiling by using the “Freesoul Deactivate Plugins” plugin available in the WordPress.org repo. See “Is it possible to exclude a plugin during the profiling?” in the “FAQ” section.
  • Small fixes and adjustments.

1.3 (February 21, 2022)

  • The “Profiles List” table has now 5 new sortable columns that will display several important metrics: “Items” (number of plugins + the current theme), “Time” (execution time in seconds), “Memory” (peak memory in megabytes), “File I/O” (sum of all file I/O operations) and “SQL” (number of database queries). Note that those metrics will be displayed on profiles created with this new version of Code Profiler, not on older profiles. The same metrics can be seen on each profile’s page (click on the tooltip beside the profile’s name) and also when running the profiler from the WP-CLI command line tool.
  • [Pro version] : The “Methods & Functions Performance” section now shows all callers of a function. Clicking on the “View Call” action link opens a new row with the list of callers and, for each one, the full path and line number.
  • [Pro version] : Fixed a bug in the “File I/O List” section where it was not possible to open a renamed file in the file viewer.
  • [Pro version] : It’s possible to enter your license from WP-CLI command line (wp code-profiler-pro license).
  • Fixed a bug where temporary files were not deleted after an HTTP error.
  • Fixed a bug where the columns sorting order was not remembered after deleting a profile in the “Profiles List” table.
  • Small fixes and adjustments.

1.2 (January 30, 2022)

  • Added the possibility to profile custom post types and custom URI.
  • Added support for HTTP Basic authentication. If you’re running Code Profiler on a staging site that is password protected, the profiler should automatically detect it.
  • Added an option to disable WordPress WP-Cron when running the profiler. This option will prevent WP-Cron to run scheduled tasks in the background that could affect the results of the profiler. It is enabled by default.
  • Small fixes and adjustments.

1.1.1 (January 12, 2022)

  • Fixed a potential error when running the profiler.

1.1 (January 11, 2022)

  • Added support for WP-CLI: you can run the profiler from a terminal. Enter wp code-profiler help to display the available command line options. WP-CLI integration can be turned on/off in the plugin “Settings” page.
  • Updated Chart.js library.
  • [Pro version]: Updated Codemirror libraries.
  • Small fixes and adjustments.

1.0.1 (December 26, 2021)

  • Added compatibility with blogs that have permalinks disabled (e.g., ?page_id=1 or ?p=1).
  • Added compatibility with child pages (e.g., /foo/bar/).
  • Added some extra HTTP headers to prevent aggressive caching.

1.0 (December 12, 2021)

  • Initial release.