函数:start
函数:destroy_config
| C函数原型 | aclError aclprofDestroyConfig(const aclprofConfig *profilerConfig) |
|---|---|
| Python函数 | ret = acl.prof.destroy_config(profiler_config) |
| 函数功能 | 销毁aclprofConfig类型的数据,只能销毁通过acl.prof.create_config接口创建的aclprofConfig类型。 |
| 输入说明 | profiler_config:待销毁的aclprofConfig类型的指针地址。 |
| 返回值说明 | ret:int,错误码。 - 返回0表示成功。 - 返回其它值表示失败。 |
| 约束说明 | - 与acl.prof.create_config接口配对使用,先调用acl.prof.create_config接口再调用aclprofDestroyConfig接口。 - 同一aclprofConfig数据重复调用acl.prof.destroy_config接口,会出现重复释放内存的报错。 |
父主题: Profiling pyACL API(通过Profiling pyACL API采集并落盘性能数据)
函数:init
| C函数原型 | aclError aclprofInit(const char *profilerResultPath, size_t length) |
|---|---|
| Python函数 | ret = acl.prof.init(profiler_result_path) |
| 函数功能 | 初始化Profiling,目前用于设置保存性能数据的文件的路径。同步接口。 |
| 输入说明 | profiler_result_path:str,指定保存性能数据的文件的路径,此路径为绝对路径。 |
| 返回值说明 | ret:int,错误码。 - 返回0表示成功。 - 返回其它值表示失败。 |
| 参考资源 | 接口调用示例,参见Profiling性能数据采集。 |
父主题: Profiling pyACL API(通过Profiling pyACL API采集并落盘性能数据)
函数:start
| C函数原型 | aclError aclprofStart(aclprofConfig *profilerConfig) |
|---|---|
| Python函数 | ret = acl.prof.start(profiler_config) |
| 函数功能 | 下发Profiling请求,使能对应数据的采集。同步接口。 用户可根据需要,在模型执行过程中按需调用acl.prof.start接口,Profling采集到的数据为调用该接口之后的数据。 |
| 输入说明 | profiler_config:int,指定Profiling配置数据。 需提前调用acl.prof.create_config接口创建aclprofConfig类型的数据。 |
| 返回值说明 | ret:int,错误码。 - 返回0表示成功。 - 返回其它值表示失败。 |
| 约束说明 | 与acl.prof.stop接口配对使用,先调用acl.prof.start接口再调用acl.prof.stop接口。 |
| 参考资源 | 接口调用示例,参见Profiling性能数据采集。 |
父主题: Profiling pyACL API(通过Profiling pyACL API采集并落盘性能数据)
函数:stop
| C函数原型 | aclError **aclprofStop(**aclprofConfig *profilerConfig) |
|---|---|
| Python函数 | ret = acl.prof.stop(profiler_config) |
| 函数功能 | 停止Profiling数据采集。同步接口。 |
| 输入说明 | profiler_config:int,指定停止Profiling数据采集的配置的指针地址。 与acl.prof.start接口中的aclprofConfig类型数据保持一致。 |
| 返回值说明 | ret:int,错误码。 - 返回0表示成功。 - 返回其它值表示失败。 |
| 约束说明 | 与acl.prof.start接口配对使用,先调用acl.prof.start接口再调用acl.prof.stop接口。 |
| 参考资源 | 接口调用示例,参见Profiling性能数据采集。 |
父主题: Profiling pyACL API(通过Profiling pyACL API采集并落盘性能数据)
函数:finalize
| C函数原型 | aclError aclprofFinalize() |
|---|---|
| Python函数 | ret = acl.prof.finalize() |
| 函数功能 | 结束Profiling。同步接口。 |
| 输入说明 | 无。 |
| 返回值说明 | ret:int,错误码。 - 返回0表示成功。 - 返回其它值表示失败。 |
| 约束说明 | 与acl.prof.init接口配对使用,先调用acl.prof.init接口再调用acl.prof.finalize接口。 |
| 参考资源 | 接口调用示例,参见Profiling性能数据采集。 |
父主题: Profiling pyACL API(通过Profiling pyACL API采集并落盘性能数据)
功能介绍
功能
当用户需要定位应用程序或上层框架程序的性能瓶颈时,可在Profiling采集进程内(acl.prof.start接口、acl.prof.stop接口之间)调用Profiling pyACL API扩展接口(统称为msproftx功能),开启记录应用程序执行期间特定事件发生的时间跨度,并将数据写入Profiling数据文件,再使用Profiling工具解析该文件,并导出展示性能分析数据。
Profiling工具解析导出操作请参见《性能分析工具使用指南》下的“Profiling数据解析”和“Profiling数据导出”。
接口调用方式:在acl.prof.start和acl.prof.stop接口之间调用acl.prof.create_stamp、acl.prof.set_stamp_trace_message、acl.prof.mark、acl.prof.push、acl.prof.pop、acl.prof.range_start、acl.prof.range_stop、acl.prof.destroy_stamp接口。该方式可获取应用程序执行期间特定时间发生的事件并记录事件发生的时间跨度。
一个进程内,可以根据需求多次调用这些接口。
接口约束说明
- 调用接口要求:msproftx功能相关接口须在acl.prof.start接口与acl.prof.stop接口之间调用。其中配对使用的接口有:acl.prof.create_stamp/acl.prof.destroy_stamp、acl.prof.push/acl.prof.pop、acl.prof.range_start/acl.prof.range_stop。
- 接口调用顺序:acl.prof.start接口(指定Device 0和Device 1)-->acl.prof.create_stamp接口-->acl.prof.set_stamp_trace_message接口-->acl.prof.mark接口-->(acl.prof.push接口-->acl.prof.pop接口)或(acl.prof.range_start接口-->acl.prof.range_stop接口)-->acl.prof.destroy_stamp接口-->acl.prof.stop接口(与acl.prof.start接口的aclprofConfig数据保持一致)。
父主题: Profiling pyACL API for Extension(Profiling pyACL API扩展接口)
在线提单