Multiplexing of PMU context
A thread can be profiled by more than one profiler process at a time. Performance Monitoring Unit (PMU) is shared between the contexts of the profiled thread.
A profiler context allows the sharing or multiplexing of PMU with the context which is at the same priority level or below if the profiler context is created in the shared Mode. The system will switch between the allowed thread contexts for every dispatch-in operation.
The priority of the context is as follows:
- Global profiler
- Process that profiles complete system is called global profiler.
Example: tprof.
- External Profiler
- Process that profiles a different process is called external profiler.
Example: hpmcount.
- Internal Profiler
- Process that profiles itself is called internal profiler.
Example: Java Run Time Optimizer.
The global system profiler does not allow sharing of the PMU and interrupt external and internal
profilers. If the external profiler creates a context in the shared mode, the external profiler can
share the PMU with internal profiler. If internal profiler context is created in the shared mode,
the internal profiler can share the PMU with the tools that have lesser priority.
Note: Only one
non-shared context for a priority level can exist at a time.
The number of contexts that a
thread can have is four, that is 1 internal profiler and 3 external profilers. The performance monitor API,
pm_get_data_generic subroutine retrieves the
current performance monitor data and time spent based on the input parameters.
pm_get_* functions can be used to retrieve the performance monitor data.Note: In
pm_set_* programs, the mode.b.shared flag is set to enable
multiplexing of PMU context.