Dynamic Library Profiling via Breakpoint PMU Counting

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional library function profiling methods are intrusive, require recompiling, and produce inaccurate results due to context switching in time sharing systems, especially when profiling dynamically loaded library functions or functions called from other library functions.

Innovation Solution

A dynamic library profiling method that sets break points at the start and return addresses of library functions to measure Performance Measurement Unit (PMU) event counts, allowing for accurate and non-intrusive profiling of dynamic library functions, including those loaded at runtime and called from other library functions, by using a process scheduler to manage PMU counts independently for each process.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If conventional library function profiling methods are used, then profiling coverage is achieved, but the methods are intrusive and require recompiling

Engineering Contradiction:
Improveprofiling accuracyVSAvoidimplementation complexity
Core Design Contradiction:
ReliabilityVSEase of manufacture

Solution Approach 1:

The patent introduces a dynamic linker as an intermediary component that sits between the executable file and the dynamic library functions. The dynamic linker intercepts function calls and redirects them through profiling code, enabling non-intrusive profiling without requiring modifications to the target library functions or recompilation. This mediator approach allows the profiling system to collect performance data while maintaining the original execution flow.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If conventional profiling methods are used, then some performance data is collected, but results are inaccurate due to context switching in time sharing systems

Engineering Contradiction:
ImprovePMU count accuracyVSAvoidprofiling reliability
Core Design Contradiction:
Measurement precisionVSReliability

Solution Approach 1:

The patent performs preliminary actions by saving the current PMU counter values at the entry point of library functions and restoring them at the return point. This preliminary saving and restoration mechanism ensures that context switching during the function execution does not corrupt the performance measurement. The system captures the PMU state before the function call and restores it after, effectively isolating the measurement from external interruptions.

Inventive Principle:
Principle #10Preliminary action

3Adaptability or versatility

If dynamic library functions are profiled, then runtime flexibility is achieved, but profiling becomes more difficult due to dynamic loading

Engineering Contradiction:
Improvedynamic library supportVSAvoidprofiling difficulty
Core Design Contradiction:
Adaptability or versatilityVSDifficulty of detecting and measuring

Solution Approach 1:

The patent creates a universal profiling solution that handles multiple types of function calls through a single dynamic linker interface. The dynamic linker is designed to work with any dynamically loaded library function, regardless of when it is loaded or what type of function it is. This multi-functional approach unifies the profiling mechanism to handle both statically linked and dynamically linked functions through the same interception and redirection framework.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentEP2735970B1Dynamic library profiling method
Publication Date: 2020.01.01 SAMSUNG ELECTRONICS CO LTD
  • EP2735970B1 patent drawingFigure 1
  • EP2735970B1 patent drawingFigure 2
  • EP2735970B1 patent drawingFigure 3

AI summary

A dynamic library profiling method and a dynamic library profiling system including writing a first break point instruction at a start address of a dynamic library function, recording a first event count value that is a process performance management unit (PMU) count when a target process executes the first break point instruction, writing a second break point instruction to a return address of the dynamic library function, and calculating a PMU count generated in a processor core while the dynamic library function is executed, by comparing the recorded first event count value with a second event count value that is a process PMU count when the target process executes the second break point instruction, wherein the process PMU count is a cumulative value of PMU counts generated in the processor core while the target process is executed.