Function tracing in Linux is used to monitor and analyze the execution of functions. It provides insights into the functions called by an application and functions' execution time. Function tracing introduces an additional overhead, which results in longer profiling times for an application.
Prerequisites
- Linux kernel 4.15 or later is required.
- From the AMDuProf installed directory, run the script AMDuProfSetup.sh with
rootaccess.sudo ./AMDuProfSetup.sh
If you install AMD uProf using DEB installer, the script is run by the installer and the info about eBPF (Extended Berkeley Packet Filter) support on the host and function tracing support is provided.
Data Collection
GUI
- Click Profile an Application on the Welcome page.
- Provide application path, application options, working directory, and environment variables, if any. Click Next.
- From Custom Configs, select Function Tracing.
- Provide the functions to trace. Set Threshold, if required.
- Click Profile to start the profiling.
CLI
- Function
Tracing
AMDuProfCLI collect --trace func --func <module:pattern> -o <output-dir> <application> - Trace functions of size 256 bytes or
more
AMDuProfCLI collect --trace func --func <module:pattern> --func-size 256 -o <output-dir> <application> - Trace functions with threshold of 50000
ns
AMDuProfCLI collect --trace func --func <module:pattern> --func-threshold 50000 -o <output-dir> <application> - Trace kernel
functions
AMDuProfCLI collect --trace func --func kernel:vfs_* -o <output-dir> <application>
After the profile data collection is complete, a session directory will be generated. Use session directory to generate the csv report (or) to import the session in GUI.
Refer Table 1 for all supported options.
[amd@uprof-ethanolx5 bin]$ ./AMDuProfCLI collect --trace func --func /tmp/ScimarkStable:* -o /tmp/ /tmp/ScimarkStable
………
Profiling (data collection) completed
Generated data files path: /tmp/AMDuProf-ScimarkStable-CpuTrace_Sep-06-2024_03-38-23
Here, the generated session directory is /tmp/AMDuProf-ScimarkStable-CpuTrace_Sep-06-2024_03-38-23 .
Options
| Option | Description |
|---|---|
--func-threshold <value>
|
By default, function threshold value set to 1000000 ns. If you want to trace functions execution time less than default threshold, use this option to set function threshold value. |
--func-size <size>
|
By default, AMDuProf traces functions of size 128 bytes, if you want to trace functions of size more than or equals to 128 bytes, use this option to set the function size. |
--func <module:function-
pattern>
|
Specify functions to trace from the library or executable:
Note: It is recommended to provide the absolute/full
path of a module.
|
--exclude-func <module:function-
pattern>
|
Specify functions to exclude from the library or executable:
Note: It is recommended to provide the absolute path
of a module.
|
Analyze the Data
CLI
GUI
Limitations
- System wide data collection is not supported by function tracing.
- Function tracing is not supported for non-ELF executable.
- Function tracing is not supported when a shared library loaded using
dlopen(). - Analyzing 32-bit applications is not supported.
- The total time is not accurate for recursive functions.