Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy-to-use performance and memory .NET profiler for Windows, Linux and macOS.
Secure and easy profiling in cloud, containers and clustered environments.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

Command line tool to control profiling

Command line tool is another way to control profiling, in addition to the profiler UI, HTTP API and Java API.

It has much in common with API and may also be used for automated profiling. You may prefer the command line as an easier solution not requiring any Java code to be written. The command line tool may be useful in remote profiling when you only have console access to the remote machine and no UI is available.

To use the command line tool you need to have installed Java 8 or newer. Please note, that you can always use java executable located at <Profiler Installation Directory>/jre64/bin directory.

Usage:

java -jar <Profiler Installation Directory>/lib/yjp-controller-api-redist.jar [--host=<host>] [--port=<port>] [--reverse-proxy-path=<path>] <command>

Options

Option Description
--host IP address or name of the host where the profiler agent runs. By default IP address of the loopback interface is used, which is usually resolved to 127.0.0.1 address.
--port Port which the profiler agent listens. Default value is 10001.
--reverse-proxy-path

Specify this option if the profiler agent is behind HTTP reverse proxy.

For example, if you have a reverse HTTP proxy, which forwards /my_agent/* requests to the profiler agent port, then the --reverse-proxy-path option should be /my_agent/.

Commands

Command Description
status

Print profiled application's name, PID, agent's host and port and which profiling modes are running.

capture-memory-snapshot

Capture memory snapshot.

capture-hprof-snapshot

Capture HPROF snapshot.

capture-performance-snapshot

Capture performance snapshot.

start-sampling

Start CPU profiling in the sampling mode.

start-async-sampling-cpu

Start CPU profiling in the asynchronous CPU sampling mode.

start-async-sampling-periodic

Start CPU profiling in the asynchronous periodic sampling mode.

start-tracing

Start CPU profiling in the tracing mode.

start-call-counting

Start CPU profiling in the call counting mode.

stop-cpu-profiling

Stop CPU profiling.

clear-cpu-data

Clear CPU profiling results and continue profiling.

start-alloc-heap-sampling=<S>

Start object allocation recording with heap sampling. The heap sampling interval is S bytes.

For example, use start-alloc-heap-sampling=131072 to sample each 128 KB of allocations.

start-alloc-recording=<N>,<B> [alloc-sampled]

Start object allocation recording and record all objects with size >= B bytes, and only each N-th smaller object.

Pass alloc-sampled to record estimated stacks instead of exact stacks.

start-alloc-recording-all [alloc-sampled]

Start object allocation recording and record all objects.

The same as start-alloc-recording=1,1.

Pass alloc-sampled to record estimated stacks instead of exact stacks.

start-alloc-recording-adaptive [alloc-sampled]

Start object allocation recording and record all objects with size >= 4 KB, and only each 10th smaller object.

The same as start-alloc-recording=10,4096.

Pass alloc-sampled to record estimated stacks instead of exact stacks.

start-alloc-object-counting Start object allocation recording in the object counting mode.
stop-alloc-recording

Stop object allocation recording.

clear-alloc-data

Clear recorded object allocations.

print-alloc-object-count

Get total count of all objects created during object allocation recording. The returned value grows monotonically: the underlying counter is not zeroed when allocation recording is re-started or allocation results are cleared.

print-alloc-object-size

Get total size in bytes of all objects created during object allocation recording. The returned value grows monotonically: the underlying counter is not zeroed when allocation recording is re-started or allocation results are cleared. Note: the value is only updated in the full recording mode, it is not updated in the object counting mode.

start-monitor-profiling

Start monitor profiling.

stop-monitor-profiling

Stop monitor profiling.

clear-monitor-data

Clear monitor profiling data.

start-stack-telemetry

Start collecting thread stack and state telemetry.

stop-stack-telemetry

Stop collecting thread stack and state telemetry.

force-gc

Forces garbage collection in the profiled application.

clear-charts

Clear all charts.

Examples

Capture memory snapshot. Agent is onlocalhost, and listens default port 10001:

java -jar yjp-controller-api-redist.jar capture-memory-snapshot

Start CPU sampling. Agent is on localhost, and listens port 10100:

java -jar yjp-controller-api-redist.jar --host=localhost --port=10100 start-sampling

Print agent status. The agent is behind HTTP proxy www.foobar.com, which forwards /my_agent/* requests to the profiler agent.

java -jar yjp-controller-api-redist.jar --host=www.foobar.com --port=443 --reverse-proxy-path=/my_agent/ status

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.