Generating Callgraph Traces
If you want to generate a trace for either a webpage or a PHP script, there are three different possibilities for achieving this.
With the Chrome extension, you only have to be logged in to the Profiler to make it work. After that, select the project that you want to generate a trace with, start the profiling, refresh the page, and then stop profiling.
To get the hash for using the GET parameter, log into the Profiler and go to the Settings section of the project you want to trace. Copy the parameter and append it to the page you want to trace.
You can generate traces for REST-APIs by sending an additional header.
The easy way to do this is using the Profiler command line client, as it automatically passes the necessary HTTP Headers to either
http (httpie) programs, without you having to bother.
After installing the Tideways command line tool, run it, as in the following example.
tideways run acme/myapp42 curl http://myapp42/api/call
To generate a trace for a command-line PHP script, there are two options. The easier one is using the command line client, that will automatically pass the necessary environment variables without you having to bother. After installing the Tideways command line tool, run it, as in the following example.
tideways run acme/myapp42 php app/console slow:command
It you disabled auto-start, you should look into the PHP Library documentation for how to setup the Profiler.
Ajax requests cannot be easily traced directly. This is because they usually require both an active/authenticated session and are called asynchronously in your project.
This makes it hard to generate a trace with cURL. However, it is possible to generate traces for Ajax requests using the Chrome Extension.
The extension sets a cookie for a domain and forces all your requests to that domain to be collected for a limited amount of time. To use it, refresh a page which triggers the AJAX request(s) which you want to trace.