Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable sampling interval and call-stack tracing depth #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

janpapenbrock
Copy link

This is basically just a rebase of #34. All implementation credit goes to @turchanov.

Reason for this rebase: The original PR contained some additional, unrelated changes.

This PR adds two options to configure xhprof_sample_* functions behavior:

  1. xhprof.sampling_interval - Configure the sampling interval in microseconds, i.e. the time between two samples being taken. Defaults to the current hard-coded default of 100 miliseconds (=100,000 microseconds).
  2. xhprof.sampling_depth - Configure the call stack depth being sampled, i.e. when set to 10, only the 10 deepest method calls are recorded. Defaults to INT_MAX.

Both additions are great for in-depth performance analysis of requests with short response times, where the original sampling interval of 100 miliseconds is not useful at all.

Exemplary usage in the wild:

    ini_set('xhprof.sampling_interval', 50000); // sample twice as often
    ini_set('xhprof.sampling_depth', 50);
    xhprof_sample_enable();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants