Skip to content

Commit

Permalink
Issue ddev#5712: Make xhprof faster
Browse files Browse the repository at this point in the history
  • Loading branch information
LionsAd committed Jan 20, 2024
1 parent 9bd9054 commit 293f5a0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// Enable xhprof profiling if we're not on an xhprof page
if (extension_loaded('xhprof') && strpos($uri, '/xhprof') === false) {
// If this is too much information, just use xhprof_enable(), which shows CPU only
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
xhprof_enable(XHPROF_FLAGS_MEMORY);
register_shutdown_function('xhprof_completion');
}

Expand Down
2 changes: 1 addition & 1 deletion docs/content/users/debugging-profiling/xhprof-profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You can change the contents of the `xhprof_prepend` function in `.ddev/xhprof/xh

For example, you may want to add a link to the profile run to the bottom of the profiled web page. The provided `xhprof_prepend.php` has comments and a sample function to do that, which works with Drupal 7. If you change it, remove the `#ddev-generated` line from the top, and check it in (`git add -f .ddev/xhprof/xhprof_prepend.php`).

Another example: you could exclude memory profiling so there are fewer columns to study. Change `xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);` to `xhprof_enable(XHPROF_FLAGS_CPU);` in `.ddev/xhprof/xhprof_prepend.php` and remove the `#ddev-generated` at the top of the file. See the docs on [xhprof_enable()](https://www.php.net/manual/en/function.xhprof-enable.php).
Another example: you could exclude memory profiling so there are fewer columns to study. Change `xhprof_enable(XHPROF_FLAGS_MEMORY);` to `xhprof_enable();` in `.ddev/xhprof/xhprof_prepend.php` and remove the `#ddev-generated` at the top of the file. See the docs on [xhprof_enable()](https://www.php.net/manual/en/function.xhprof-enable.php).

## Information Links

Expand Down
2 changes: 1 addition & 1 deletion pkg/ddevapp/dotddev_assets/xhprof/xhprof_prepend.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// Enable xhprof profiling if we're not on an xhprof page
if (extension_loaded('xhprof') && strpos($uri, '/xhprof') === false) {
// If this is too much information, just use xhprof_enable(), which shows CPU only
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
xhprof_enable(XHPROF_FLAGS_MEMORY);
register_shutdown_function('xhprof_completion');
}

Expand Down

0 comments on commit 293f5a0

Please sign in to comment.