Skip to content

Patchable JProfiler thread pool infrastructure - #24598

Draft
r30shah wants to merge 10 commits into
eclipse-openj9:masterfrom
r30shah:JProfilerThreadPoolPR
Draft

Patchable JProfiler thread pool infrastructure#24598
r30shah wants to merge 10 commits into
eclipse-openj9:masterfrom
r30shah:JProfilerThreadPoolPR

Conversation

@r30shah

@r30shah r30shah commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Introduces the infrastructure for a patchable JProfiler: a thread-pool-based
design that separates profiling analysis from the mechanical work of patching
compiled method bodies to disable/enable data collection.

The core of the change is three cooperating components — a patching work-unit,
an analysis work-unit, and a thread-pool dispatcher — along with the JIT options
needed to tune their behavior at runtime. Together they allow the JProfiler to
offload patching to dedicated worker threads while keeping analysis on a single
coordinator thread.

r30shah added 10 commits July 31, 2026 16:07
Changes in this commit adds TR_JProfBlockFrequencyCounterSites for
Patching BlockFrequencyInfo is patching of JProfiling is enabled.
Counters emitted for the block frequency info in low opt compilations
through JProfiling would need to be patched to turn-off data
collection and potentially turn-on.
TR_JProfBlockFrequencyCounterSites to facilitate back and forth
patching.

Signed-off-by: Rahil Shah <rahil@ca.ibm.com>
This commit adds JProfValueSites that contains the information about the
instruction and location pair that controls execution of the Value Profiling
using JProfiling. This assumption can be used to turn-off or turn-on profiling.

Signed-off-by: Rahil Shah <rahil@ca.ibm.com>
Adds three static JIT options to J9Options that control the behaviour
of the patchable JProfiler:

  _patchableJProfilingRecompilationFreq  (default: 2000)
    Maximum raw block-frequency count at which a method is considered
    a candidate for warm recompilation rather than patching.

  _patchableJProfilingPatchingAgeCutOff  (default: 50000000)
    Minimum elapsed time (in milliseconds) that must pass since a
    method began collecting profiling data before it is eligible to
    have its profiling instrumentation patched out.

  _numOfMethodsToTriggerPatching  (default: 10000)
    Number of methods that must accumulate in the patch-pending list
    before the dispatcher signals worker threads to begin a patching
    phase.

Each option is declared as a static member in J9Options.hpp,
initialised to its default in J9Options.cpp, and exposed as a
command-line-settable option via the _feOptions table:

  -Xjit:patchableJProfilingRecompilationFreq=<n>
  -Xjit:patchableJProfilingPatchingAgeCutOff=<n>
  -Xjit:numOfMethodsToTriggerPatching=<n>

Signed-off-by: Rahil Shah <rahil@ca.ibm.com>
A work-unit class that contains the list of compiled methods that needs
their profiling code patches and performs patching. Depending number of
worker threads created for Patchable JProfiler, functionality provided
by this task allows infrastructure to differentiate analaysis and code
patching execution.

Signed-off-by: Rahil Shah <rahil@ca.ibm.com>
A work-unit that analyzes the frequency information of various methods
and based on the information takes one of the following decision for the
method.
1. If it is executed a lot (can be decided based on high max-raw count)
   by the application, recompile it at warm
2. If it is not executed a lot and application has already spend good
   amount of CPU Time since the method is compiled, patch the method to disable
   the profiling data collection as at this point, recompilation is not needed.
3. If application has not executed enough since the method started profiling
   data collection, let it profile and check other methods.

Signed-off-by: Rahil Shah <rahil@ca.ibm.com>
Central coordinator for the JProfiler thread pool which manages set of
native JVM threads which collectively performs following two distinct
jobs.
1. Analysis - Main thread designed to perform analyze the profiling data
   and decide if it requires recompilation or patched to enable or
   disable the data collection.
2. Patching - Worker threads desinged to carry out mechanical work of
   patching the methods.

Signed-off-by: Rahil Shah <rahil@ca.ibm.com>
@r30shah
r30shah force-pushed the JProfilerThreadPoolPR branch from ee12d64 to 9a9fbdd Compare August 20, 2026 14:43
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.

1 participant