Function: event_elapsed_time

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

Computes the elapsed time between two events.

Prototype

  • C Prototype
    1
    aclError aclrtEventElapsedTime(float *ms, aclrtEvent startEvent, aclrtEvent endEvent)
    
  • Python Function
    1
    ms, ret = acl.rt.event_elapsed_time(start, end)
    

Parameter Description

Parameter

Description

start

Int, pointer address of the start event object.

end

Int, pointer address of the end event object.

Return Value Description

Return Value

Description

ms

Float, elapsed time between two events, in milliseconds.

ret

Int, error code: 0 on success; else, failure.

Restrictions

The API call sequence is as follows: call acl.rt.create_event/acl.rt.create_event_with_flag to create an event -> call acl.rt.record_event to record the start event and end event in the same stream -> call acl.rt.synchronize_stream to block app execution until all tasks in the specified stream are complete -> call acl.rt.event_elapsed_time to collect statistics on the elapsed time between two events.