Profile Container Targets from the Host
Launch Intel® VTune™ Profiler from the host and profile native or Java* applications running in an LXC*, Docker, Mesos*, or Singularity* container on a Linux system.
VTune Profiler automatically detects an application running in the container. No container configuration specific for performance analysis is required. But to run user-mode sampling analysis types (Hotspots or Threading), make sure to run the container with the ptrace support enabled:
host> docker run --cap-add=SYS_PTRACE -td myimage
or launch the container in the privileged mode:
host> docker run --privileged -td myimage
Configure and Run an Analysis for a Container Target
Set up your analysis for a target running in the container, using the following supported target and analysis types:
Create a VTune Profiler project on the host system.
From the WHERE pane of the Configure Analysis window, select the Local Host system to start analysis from your host Linux system or Remote Linux (SSH) to start analysis from a remote Linux system connected to your host system via SSH. For the remote Linux targets, make sure to configure SSH connection.
From the WHAT section, specify your analysis target. For container target analysis, the following target types are supported: Attach to Process and Profile System.
Configure your process or system target as usual using available configuration options.NOTE:
In the Profile System mode, VTune Profiler profiles all applications running in the same container or in different containers simultaneously. So, the standard limitation for the system-wide profiling of the managed code is not applicable to Java applications running in the containers.
You can attach the VTune Profiler running under the superuser account to a Java process or a C/C++ application with embedded JVM instance running under a low-privileged user account. For example, you may attach the VTune Profiler to Java based daemons or services.NOTE:
The dynamic attach mechanism is supported only with the Java Development Kit (JDK).
From the HOW section, select an analysis and customize the analysis options, if required.
Click Start to launch the analysis.
Alternatively, you may configure and run any of these analyses using the VTune Profiler command line interface (vtune). For example, to run a system-wide Hotspots analysis locally, enter:
host> vtune -collect hs -knob sampling-mode=hw -analyze-system -d 60
To run Hotspots analysis in the Attach to Process mode on a remote system, enter:
host> vtune -target-system=ssh:email@example.com -collect hs -knob sampling-mode=hw -target-process=java -d 60
The collected result opens in the default Hotspots viewpoint, where paths to container modules show up with prefixes (for instance, docker or lxc):