Link Latency Detection Functions
The Link Latency Detection tool is a dynamic analysis tool designed to address performance issues in complex C/C++ applications. It can accurately capture the time consumption data of function calls without code modification or recompilation, helping you quickly locate performance hotspots. When the tool collects data, it can be loaded at startup or mounted while the application is running.
The tool supports three types of installation packages for Link Latency Detection. The usage of the full tool package is the same as that of the RPM package, while the usage of the standalone Link Latency Detection package is different.
- Standalone package (tracelib-collector-aarch64.tar.gz):
The standalone package contains dynamic libraries and data analysis binary files. By configuring environment variables, you can load the dynamic library to collect data during application runtime. This working mode is the Launch mode. If the application to be collected has not yet been started, it is recommended to use this mode. In this mode, the SO library is automatically loaded for data collection when the application starts.
- Full tool package (DevKit-CLI-x.x.x-Linux-Kunpeng.tar.gz) or RPM package (devkit-advisor-x.x.x-1.aarch64.rpm):
The DevKit-CLI-x.x.x-Linux-Kunpeng.tar.gz package includes Link Latency Detection within the Affinity Analyzer, providing the attach command for data collection and the compat command for data analysis. This working mode is the Attach mode. If the application to be collected is already running, it is recommended to use this mode, since restarting the application is not required.
Constraints
- To correctly identify and record function names, the target program must retain its symbol table. When compiling your C/C++ program, avoid using compilation options that strip the symbol table and debugging information (for example, do not use the -s flag).
- This tool provides function-level performance analysis, that is, collects statistics on the time spent entering and exiting a function. If you want to analyze a code snippet, reconstruct it into an independent function for analysis.
- Because instrumentation introduces a fixed overhead on the order of nanoseconds, analyzing functions with extremely short execution durations (for example, under 1 microsecond) and high call frequency may incur measurable performance impact. For this reason, it is recommended to focus on higher-latency service logic or I/O functions.
Launch mode:
- A dynamic library can run on Glibc 2.17 or later.
- The execution durations of inline functions cannot be collected.
Attach mode:
- It is available only on the Kunpeng platform.
- The application whose data is to be collected must be in a running state, and its PID must be provided when initiating data collection.
- Collection can be stopped by terminating the target process (for example, by pressing Ctrl+C).