aclprofMark
功能介绍
功能
当用户需要定位应用程序或上层框架程序的性能瓶颈时,可在Profiling采集进程内(aclprofStart接口、aclprofStop接口之间)调用Profiling AscendCL API扩展接口(统称为msproftx功能),开启记录应用程序执行期间特定事件发生的时间跨度,并将数据写入Profiling数据文件,再使用Profiling工具解析该文件,并导出展示性能分析数据。
Profiling工具解析导出操作请参见《性能分析工具使用指南》下的“高级功能>数据解析与导出”。
接口调用方式:在aclprofStart和aclprofStop接口之间调用aclprofCreateStamp、aclprofSetStampTraceMessage、aclprofMark、aclprofPush、aclprofPop、aclprofRangeStart、aclprofRangeStop、aclprofDestroyStamp接口。该方式可获取应用程序执行期间特定时间发生的事件并记录事件发生的时间跨度。
一个进程内,可以根据需求多次调用这些接口。
接口约束说明
- 调用接口要求:msproftx功能相关接口须在aclprofStart接口与aclprofStop接口之间调用。其中配对使用的接口有:aclprofCreateStamp/aclprofDestroyStamp、aclprofPush/aclprofPop、aclprofRangeStart/aclprofRangeStop。
- 接口调用顺序:aclprofStart接口(指定Device 0和Device 1)-->aclprofCreateStamp接口-->aclprofSetStampTraceMessage接口-->aclprofMark接口-->(aclprofPush接口-->aclprofPop接口)或(aclprofRangeStart接口-->aclprofRangeStop接口)-->aclprofDestroyStamp接口-->aclprofStop接口(与aclprofStart接口的aclprofConfig数据保持一致)。
父主题: Profiling AscendCL API for Extension(Profiling AscendCL API扩展接口)
aclprofCreateStamp
函数功能
创建msproftx事件标记。后续调用aclprofMark、aclprofSetStampTraceMessage、aclprofPush和aclprofRangeStart接口时需要以描述该事件的指针作为输入,表示记录该事件发生的时间跨度。同步接口。
约束说明
与aclprofDestroyStamp接口配对使用,需提前调用aclprofStart接口。
函数原型
void *aclprofCreateStamp()
返回值说明
- 返回void类型的指针,表示成功。
- 返回nullptr,表示失败。
参考资源
接口调用示例,参见Profiling性能数据采集。
父主题: Profiling AscendCL API for Extension(Profiling AscendCL API扩展接口)
aclprofSetStampTraceMessage
函数功能
为msproftx事件标记携带字符串描述,在Profiling解析并导出结果中msprof_tx summary数据展示。同步接口。
Profiling解析并导出结果请参见《性能分析工具使用指南》下的“Profiling数据说明>msproftx数据说明”。
约束说明
在aclprofCreateStamp接口和aclprofDestroyStamp接口之间调用。
函数原型
aclError aclprofSetStampTraceMessage(void *stamp, const char *msg, uint32_t msgLen)
参数说明
| 参数名 | 输入/输出 | 说明 |
|---|---|---|
| stamp | 输入 | Stamp指针,指代msproftx事件标记。 指定aclprofCreateStamp接口的指针。 |
| msg | 输入 | 字符串内容。 |
| msgLen | 输入 | 字符串长度。 |
返回值说明
返回0表示成功,返回其它值表示失败。
参考资源
接口调用示例,参见Profiling性能数据采集。
父主题: Profiling AscendCL API for Extension(Profiling AscendCL API扩展接口)
aclprofMark
函数功能
msproftx标记瞬时事件。同步接口。
调用此接口后,Profiling自动在Stamp指针中加上当前时间戳,将Event type设置为Mark,表示开始一次msproftx采集。
约束说明
在aclprofCreateStamp接口和aclprofDestroyStamp接口之间调用。
函数原型
aclError aclprofMark(void *stamp)
参数说明
| 参数名 | 输入/输出 | 说明 |
|---|---|---|
| stamp | 输入 | Stamp指针,指代msproftx事件标记。 指定aclprofCreateStamp接口的指针。 |
返回值说明
返回0表示成功,返回其它值表示失败。
参考资源
接口调用示例,参见Profiling性能数据采集。
父主题: Profiling AscendCL API for Extension(Profiling AscendCL API扩展接口)
aclprofPush
函数功能
msproftx用于记录事件发生的时间跨度的开始时间。同步接口。
调用此接口后,Profiling自动在Stamp指针中记录开始的时间戳,将Event type设置为Push/Pop。
约束说明
- 与aclprofPop接口成对使用,表示时间跨度的开始和结束。
- 在aclprofCreateStamp接口和aclprofDestroyStamp接口之间调用。
- 不能跨线程调用,若需要跨线程可使用aclprofRangeStart/aclprofRangeStop接口。
函数原型
aclError aclprofPush(void *stamp)
参数说明
| 参数名 | 输入/输出 | 说明 |
|---|---|---|
| stamp | 输入 | Stamp指针,指代msproftx事件标记。 指定aclprofCreateStamp接口的指针。 |
返回值说明
返回0表示成功,返回其它值表示失败。
参考资源
接口调用示例,参见Profiling性能数据采集。
父主题: Profiling AscendCL API for Extension(Profiling AscendCL API扩展接口)
aclprofPop
函数功能
msproftx用于记录事件发生的时间跨度的结束时间。同步接口。
调用此接口后,Profiling自动在Stamp指针中记录采集结束的时间戳。
约束说明
- 与aclprofPush接口成对使用,表示时间跨度的开始和结束。
- 在aclprofCreateStamp接口和aclprofDestroyStamp接口之间调用。
- 不能跨线程调用。若需要跨线程可使用aclprofRangeStart/aclprofRangeStop接口。
函数原型
aclError aclprofPop()
返回值说明
返回0表示成功,返回其它值表示失败。
参考资源
接口调用示例,参见Profiling性能数据采集。
父主题: Profiling AscendCL API for Extension(Profiling AscendCL API扩展接口)
aclprofRangeStart
函数功能
msproftx用于记录事件发生的时间跨度的开始时间。同步接口。
调用此接口后,Profiling自动在Stamp指针记录采集开始的时间戳,将Event type设置为Start/Stop,生成一个进程唯一的id,并将Stamp保存在以进程粒度维护的一个map中。
约束说明
- 与aclprofRangeStop接口成对使用,表示时间跨度的开始和结束。
- 在aclprofCreateStamp接口和aclprofDestroyStamp接口之间调用。
- 可以跨线程调用。
函数原型
aclError aclprofRangeStart(void *stamp, uint32_t *rangeId)
参数说明
| 参数名 | 输入/输出 | 说明 |
|---|---|---|
| stamp | 输入 | Stamp指针,指代msproftx事件标记。 指定aclprofCreateStamp接口的指针。 |
| rangeId | 输出 | msproftx事件标记的唯一标识。用于在跨线程时区分。 |
返回值说明
返回0表示成功,返回其它值表示失败。
参考资源
接口调用示例,参见Profiling性能数据采集。
父主题: Profiling AscendCL API for Extension(Profiling AscendCL API扩展接口)
在线提单