Function Description
Overview
This section describes how to collect profile data by using the profiling pyACL APIs for subscription to operator information. The purpose is to parse the collected profile data and write the data to pipelines. You need to read the data to the memory, and then call the related pyACL API to obtain the profile data.
API calling: acl.prof.model_subscribe, acl.prof.get*, and acl.prof.model_unsubscribe. The profile data of operators in the model can be obtained, including the operator name, operator type name, and operator execution time.
General Restrictions
The APIs in this section cannot be called with Profiling pyACL APIs (Collecting and Flushing Profile Data) together. acl.prof.init, acl.prof.start, acl.prof.stop, and acl.prof.finalize cannot be called between acl.prof.model_subscribe and acl.prof.model_unsubscribe.
API Constraints
- API call requirements
- Call acl.prof.model_subscribe before the model is executed. If acl.prof.model_subscribe is called during model execution, only profile data after the acl.prof.model_subscribe call is collected, which may be incomplete.
- acl.prof.model_subscribe must be used together with acl.prof.model_unsubscribe. Before acl.prof.model_unsubscribe is called, acl.prof.model_subscribe cannot be called repeatedly to subscribe to the same model.
- It is not allowed to pass a non-existent model ID to the acl.prof.model_subscribe call.
- It is not allowed to pass a non-existent or unsubscribed model ID to the acl.prof.model_unsubscribe call.
- If multiple models are loaded to the same device, the subscription configurations delivered to the models are the same.
- API call sequence
- Recommendation
Load a model --> acl.prof.model_subscribe-->acl.prof.get_op_desc_size-->acl.prof.get_op_num-->acl.prof.get_op_type/acl.prof.get_op_name/acl.prof.get_op_start/acl.prof.get_op_end/acl.prof.get_op_duration/acl.prof.get_model_id-->acl.prof.model_unsubscribe
- The following is an example of an incorrect call sequence. In this example, the same model is repeatedly subscribed:
Load model 1-->acl.prof.model_subscribe (specify model 1)-->acl.prof.model_subscribe (specify model 1)-->acl.prof.model_unsubscribe
- Recommendation