Using KUPL PROF for Full-Scale Function Timeline Profiling
KUPL provides two tools, profile and trace, to provide runtime timeline analysis. The profile and trace capabilities are enabled by dynamically linking to the corresponding prof shared library.
- Install HPCkit by following the instructions in Kunpeng HPCKit 26.1.RC1 Installation Guide.
- Run the setvars.sh --kupl_mode=prof command to link to the prof shared library.
- When running the program, configure the environment variable KUPL_PROF_LEVEL=statistic to enable cumulative time profiling for specific functions, and configure the environment variable KUPL_PROF_LEVEL=trace to enable full-scale function timeline tracing.
- Upon application completion, if KUPL_PROF_LEVEL is set to either statistic or trace, a cumulative time profile report for functions will be printed at the end of the execution output (see Table 1 Header fields in the cumulative time profile report for functions for details). If KUPL_PROF_LEVEL=trace is specified, a ptrace file (in JSON format) capturing the per-process and per-thread execution traces will be generated in the application's working directory. This file can be imported into the chrome://tracing UI (Chrome 94 or later is required) for visual timeline analysis.
Table 1 Header fields in the cumulative time profile report for functions Field
Description
thread_id
Execution thread ID
msg_id
Function event number
msg
Function event name
sum(ms)
Total function duration (in milliseconds)
count
Total number of function executions
avg(ns)
Average function duration (in nanoseconds)
max(ns)
Maximum execution time for a single function call (in nanoseconds)
min(ns)
Minimum execution time for a single function call (in nanoseconds)
Table 2 msg fields in the cumulative time profile report for functions msg Field
Function Behavior
task_execute
Duration of executing tasks submitted to KUPL
task_finish
Duration of releasing resources after tasks submitted to KUPL complete execution
sched_add_taskbase
Duration of submitting tasks to the underlying KUPL scheduler (Sched)
sched_get_taskbase
Duration of retrieving tasks from the underlying KUPL Sched
It is advised to use Google Chrome to view the visualized report.