Introduction to mstx APIs
The mstx API is performance analysis APIs provided by MindStudio. Users can insert specific tags into applications so that the key code area can be accurately located during performance analysis. For details, see Table 1. The msProf tool allows users to use the mstx API to tune specific operators, customize the start time and end time of the code segment or specified key functions, identify key functions or computing APIs, and quickly demarcate performance issues.
By default, the mstx APIs are disabled. If the mstx API is called in the application, the mstx dotting function is enabled based on the actual application scenario. For example, when using the msProf tool to collect data in the CLI, you can configure --mstx=on to enable the mstx API used in the user code program or use --mstx-include to specify the mstx API. For details, see Commands.
- Add the library file libms_tools_ext.so to the ${git_clone_path}/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AclNNInvocation/src/CMakeLists.txt directory. The address is ${INSTALL_DIR}/lib64/libms_tools_ext.so.
1 2 3 4 5 6 7 8 9 10
# Header path include_directories( ... ${CUST_PKG_PATH}/include ) ... target_link_libraries( ... dl )
- In the ${git_clone_path}/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AclNNInvocation/src/main.cpp directory, compile and link the user program to the dl library. The corresponding header file ms_tools_ext.h is stored in ${INSTALL_DIR}/include/mstx.
1 2 3
... #include "mstx/ms_tools_ext_h" ...
Replace ${INSTALL_DIR} with the actual CANN component directory. If the Ascend-CANN-Toolkit package is installed as the root user, the CANN component directory is /usr/local/Ascend/ascend-toolkit/latest.