PrintTimeStamp
Product Support
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
x |
|
x |
|
x |
Function
Provides the timestamp logging function to mark key execution points in the operator kernel code. After the function is called, the following information is displayed:
- descId: user-defined identifier, which is used to distinguish different logging positions.
- rsv: reserved value. The default value is 0. You do not need to focus on it.
- timeStamp: number of cycles in the current system, which is used to compute the time difference. For details about the time conversion rule, see GetSystemCycle(ISASI).
- pcPtr: PC pointer value. You do not need to focus on it unless otherwise specified.
- entry: reserved field. You do not need to focus on it.
The following is an example:
1 | descId is 65577, rsv is 0, timeStamp is 13806084506158, pcPtr is 20619064414544, entry is 0. |
This function is mainly used for debugging and performance analysis. Enabling this function will affect the operator performance. You are advised to disable this function in the production environment.
By default, this function is disabled. You can enable the logging function by adding the -DASCENDC_TIME_STAMP_ON compilation option as required.
Prototype
1 | __aicore__ inline void PrintTimeStamp(uint32_t descId) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
descId |
Input |
User-defined identifier (user-defined number), which is used to distinguish different logging positions. CAUTION:
[0, 0xffff] is reserved for the IDs used by internal Ascend C modules. You are advised to set the user-defined descId to a value greater than 0xffff. |
Returns
None
Restrictions
- This function is used only for board debugging on the NPU.
- Currently, printing is not supported in the scenario of operator integration into a graph.
- The total amount of data printed by a single call to this API cannot exceed 1 MB (including a small amount of header and footer information required by the framework, which can usually be ignored). If this limit is exceeded, the data will not be printed. When a custom operator project is used for operator development, the total amount of data dumped by all dump APIs of an operator on each core cannot exceed 1 MB. You need to control the amount of data to be printed. If the limit is exceeded, no content will be printed.
Example
1 | AscendC::PrintTimeStamp(65577); |
The printed result is as follows (the dump information header is printed only when a custom operator project is used):
1 2 3 | opType=AddCustom, DumpHead: AIV-0, CoreType=AIV, block dim=8, total_block_num=8, block_remain_len=1047136, block_initial_space=1048576, rsv=0, magic=5aa5bccd ...// Some internal logging information of the framework. descId is 65577, rsv is 0, timeStamp is 13806084506158, pcPtr is 20619064414544, entry is 0. |