Profiling PHP Code Running with HHVM*

This recipe provides configuration steps to enable Intel® VTune™ Amplifier performance analysis for your PHP code running in the HHVM* environment.


Advanced Hotspots analysis was integrated into the generic Hotspots analysis starting with VTune Amplifier 2019, and is available via the Hardware Event-based Sampling collection mode.


This section lists the hardware and software tools used for the performance analysis scenario.

  • Application: test.php. The application is used as a demo and not available for download.

  • Virtual machine: HHVM*

  • Performance analysis tools:

    • Intel VTune Amplifier 2018: Advanced Hotspots analysis


    • For trial VTune Amplifier downloads and product support, visit

    • All the Cookbook recipes are scalable and can be applied to VTune Amplifier 2018 and higher. Slight version-specific configuration changes are possible.

  • Operating system: Linux*, Ubuntu* 16.04

  • CPU: Intel® processor code named Skylake

Enable the VTune Amplifier Support with HHVM and Run the App

Prerequisites: Make sure the script (attached) used for this analysis provides the correct path to the VTune Amplifier installation directory on your machine. By default, the path is specified as AGENT_DIR=/opt/intel/vtune/. This script creates a directory for JIT files and sets paths to the VTune Amplifier agents.

  1. Source

    source ./
  2. Run the hhvm process with the test application specified:

    ./hhvm -v "Eval.JitUseVtuneAPI=true" ./test.php

    The Eval.JitUseVtuneAPI=true option is used to enable the VTune Amplifier support for HHVM profiling.

Configure and Run the VTune Amplifier for the HHVM Profiling


This recipe explores a scenario with the VTune Amplifier attaching to a running PHP application for the analysis, which is also similar to the system-wide profiling. Performance profiling for an application in the Launch Application mode is not HHVM specific and does not require any additional configuration.

  1. Launch the VTune Amplifier:

  2. Click the New Project icon on the toolbar to create a new project.

  3. In the Analysis Target tab, select the Attach to Process target type and specify hhvm as a Process name:

    1. From the right pane, expand the Advanced section and specify path to the script as a Custom collector option:

      At the moment, the script is required to automatically copy the collected data to the result directory as soon as the application run is terminated:

      if [ "$AMPLXE_COLLECT_CMD" = "stop" ]; then
         cp $JIT_DIR/* $AMPLXE_DATA_DIR


    Make sure the JIT_DIR value specified in the file matches the JIT_DIR value in the script.

  4. Switch to the Analysis Type tab and select the Advance Hotspots analysis type from the left pane and click Start to run the analysis.

To launch the analysis from the command line, enter:

./amplxe-cl -collect advanced-hotspots -custom-collector=/var/local/ --target-process=hhvm

For system-wide collection, enter:

./amplxe-cl -collect advanced-hotspots -custom-collector=/var/local/ --analyze-system -duration 10

Identify Hotspots

When the analysis is complete, the VTune Amplifier opens the result in the Summary view:

Click the top hotspot branchy function to switch to the Bottom-up window for further analysis:

Double-click the hotspot function to view the source code and identify the hottest code line.

For more complete information about compiler optimizations, see our Optimization Notice.