All XRT related actions from the host application are automatically tracked for profiling, through either theOpenCL API calls, or the XRT API calls. However, you can also profile the host application beyond the XRT related events, capturing event data based on user-specified actions or events.
- User range
- Profiles the specified start/end times across a range of code. This captures the span of time within which an action occurs in the host application.
- User events
- Marks an event in the timeline. The user event is added to the timeline waveform at whatever point in time it occurs.
The user_range
and user_event
data can be captured to the Profile Summary and Timeline Trace reports for display in Vitis analyzer. As seen in the figure below, the
Profile Summary shows the
number of occurrences of a given event and the range. The User Ranges table also reports
the Min/Max/Avg/Total duration of the user-defined ranges in the host code. In the
Timeline Trace report
user_range
elements in the host code are displayed
in a separate row, and user_event
markers are added at
specific points on the timeline.
Using custom profiling requires a few changes in your host application
source code and build process. You must make use of C or C++ API in your code, as
described below, and you must include the xrt_coreutil
library when linking your host application.
- The C/C++ API are described below, but can also be found at the following URL: https://github.com/Xilinx/XRT/blob/master/src/runtime_src/core/include/experimental/xrt_profile.h.
- For both C and C++ you must add the following:
#include experimental/xrt_profile.h
- When linking host code, add
-lxrt_coreutil
to the compiler command line.