Hybrid Profiling Technique for Application Method Calls

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional instrumentation-based profiling techniques incur high overhead due to the computational expense of recording exact timestamps for function calls, making them inefficient for call-intensive applications, while stack sampling lacks information on the number of calls and may miss short, infrequent calls.

Innovation Solution

A hybrid instrumentation-sampling profiling technique that injects calls to methodEntry and methodExit methods, using a separate sampling thread to set a flag periodically, allowing timestamps to be taken only when the flag is true, thereby reducing overhead and capturing the number of invocations and timing data with minimal disturbance.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If instrumentation-based profiling records exact timestamps for every function call, then measurement precision of timing data is improved, but profiling overhead increases significantly

Engineering Contradiction:
Improvetiming data precisionVSAvoidprofiling overhead
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The patent implements periodic sampling where a dedicated thread wakes up at predetermined intervals to set a sampling flag, rather than continuously monitoring every function call. This periodic action reduces the frequency of timestamp operations while still capturing representative timing data, directly resolving the contradiction between measurement precision and profiling overhead.

Inventive Principle:
Principle #19Periodic action

Solution Approach 2:

The patent takes a partial action approach by recording timestamps only for a subset of function calls that occur during sampling intervals, rather than every single call. The instrumentation code checks a flag to determine whether to record timing data, performing the expensive timestamp operation only partially, thus reducing overhead while maintaining acceptable measurement precision.

Inventive Principle:
Principle #16Partial or excessive action

2Loss of information

If instrumentation-based profiling records exact number of calls and timestamps, then call context information is improved, but computational expense increases

Engineering Contradiction:
Improvecall context informationVSAvoidcomputational expense
Core Design Contradiction:
Loss of informationVSUse of energy by moving object

Solution Approach 1:

The sampling mechanism periodically activates the timing recording function rather than continuously, reducing computational expense while still gathering call context information. The instrumentation code increments call counts for all calls (low cost) but only records timestamps during sampling intervals (higher cost), balancing information quality with energy consumption.

Inventive Principle:
Principle #19Periodic action

Solution Approach 2:

The patent segments the profiling functionality into two distinct operations: call counting (performed for every call with minimal overhead) and timestamp recording (performed only during sampling intervals with higher overhead). This segmentation allows the system to maintain comprehensive call context information while controlling computational expense by applying the expensive operation only selectively.

Inventive Principle:
Principle #1Segmentation

3Productivity

If stack sampling is used to reduce overhead, then profiling overhead is reduced, but information on number of calls and short infrequent calls is lost

Engineering Contradiction:
Improveprofiling overheadVSAvoidcall count information
Core Design Contradiction:
ProductivityVSLoss of information

Solution Approach 1:

The patent merges two profiling approaches into a hybrid system: instrumentation-based call counting (which tracks every call) and sampling-based timing (which reduces overhead). The instrumentation code continuously increments call counts for all function calls, while a separate sampling thread periodically triggers timestamp recording. This combination preserves call count information that pure stack sampling loses, while maintaining the low overhead benefit of sampling for timing data.

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentUS7519959B1Hybrid profiling technique
Publication Date: 2009.04.14 ORACLE AMERICAN INC
  • US7519959B1 patent drawing
  • US7519959B1 patent drawing
  • US7519959B1 patent drawing

AI summary

A scheme for profiling function calls for an application is provided. The scheme includes tracking invocations of the application methods and executing a sampling thread concurrently with the application. The executing includes periodically activating the sampling thread to set a flag to a true state and checking if the flag is true for the tracked invocations for the application methods. If the flag is true, then the scheme includes recording a current timestamp for the application method and charging a time difference between the current timestamp and a previous timestamp to the application method. A computer readable media and a system for performing profiling for an application are also provided.