parameters: (trace_event: list)
return_statement: return [rdma_communication_time, rdma_communication_size, rdma_bandwidth, rdma_communication_wait_time]
docstring: Calculate RDMA link info.
  
          When the link is RDMA,it is necessary to match three consecutive operators RDMASend, RDMASend \
          and Notify Wait,and take the sum of the time of the three operators as one communication time.
docstring_summary: Calculate RDMA link info.
docstring_tokens: Calculate RDMA link info .
function: def _calculate_adma_link_info(trace_event: list):
          """
          Calculate RDMA link info.
  
          When the link is RDMA,it is necessary to match three consecutive operators RDMASend, RDMASend \
          and Notify Wait,and take the sum of the time of the three operators as one communication time.
          """
          rdma_communication_time = 0
          rdma_communication_size = 0
          rdma_communication_wait_time = 0
          start_index = 0
          end_index = len(trace_event) - 1
          while start_index < end_index:
              first_task_type = trace_event[start_index].get("args").get("task type")
              if first_task_type == CommunicationInfo.RDMASEND.value and start_index < end_index - 1:
                  second_task_type = trace_event[start_index + 1].get("args").get("task type")
                  third_task_type = trace_event[start_index + 2].get("args").get("task type")
                  if second_task_type == CommunicationInfo.RDMASEND.value and \
                          third_task_type == CommunicationInfo.NOTIFY_WAIT.value:
                      rdma_send_cost = trace_event[start_index].get("dur", 0)
                      notify_record_cost = trace_event[start_index + 1].get("dur", 0)
                      notify_wait_cost = trace_event[start_index + 2].get("dur", 0)
                      rdma_communication_time += rdma_send_cost + notify_record_cost + notify_wait_cost
                      rdma_communication_wait_time += notify_wait_cost
                      rdma_size = trace_event[start_index].get("args").get("size")
                      if rdma_size:
                          rdma_size = rdma_size if isinstance(rdma_size, int) else int(rdma_size, 16)
                      else:
                          rdma_size = 0
                      notify_record_size = trace_event[start_index + 1].get("args").get("size")
                      if notify_record_size:
                          notify_record_size = notify_record_size if isinstance(notify_record_size, int) \
                              else int(notify_record_size, 16)
                      else:
                          notify_record_size = 0
                      rdma_communication_size += rdma_size + notify_record_size
                      start_index += 2
              start_index += 1
  
          # The unit of rdma_communication_wait_time is ms.
          # The unit of rdma_bandwidth is KB/s.
          # The unit of rdma_communication_size is k_byte and The unit of rdma_communication_time is ms.
          rdma_communication_wait_time = rdma_communication_wait_time / 1e3
          rdma_communication_size = rdma_communication_size / 1e3
          rdma_communication_time = rdma_communication_time / 1e3
          rdma_bandwidth = rdma_communication_size / (rdma_communication_time / 1e3) \
              if rdma_communication_size else 0
  
          return [rdma_communication_time, rdma_communication_size, rdma_bandwidth, rdma_communication_wait_time]
function_tokens: def _calculate_adma_link_info ( trace_event : list ) : rdma_communication_time = 0 rdma_communication_size = 0 rdma_communication_wait_time = 0 start_index = 0 end_index = len ( trace_event ) - 1 while start_index < end_index : first_task_type = trace_event [ start_index ] . get ( "args" ) . get ( "task type" ) if first_task_type == CommunicationInfo . RDMASEND . value and start_index < end_index - 1 : second_task_type = trace_event [ start_index + 1 ] . get ( "args" ) . get ( "task type" ) third_task_type = trace_event [ start_index + 2 ] . get ( "args" ) . get ( "task type" ) if second_task_type == CommunicationInfo . RDMASEND . value and third_task_type == CommunicationInfo . NOTIFY_WAIT . value : rdma_send_cost = trace_event [ start_index ] . get ( "dur" , 0 ) notify_record_cost = trace_event [ start_index + 1 ] . get ( "dur" , 0 ) notify_wait_cost = trace_event [ start_index + 2 ] . get ( "dur" , 0 ) rdma_communication_time += rdma_send_cost + notify_record_cost + notify_wait_cost rdma_communication_wait_time += notify_wait_cost rdma_size = trace_event [ start_index ] . get ( "args" ) . get ( "size" ) if rdma_size : rdma_size = rdma_size if isinstance ( rdma_size , int ) else int ( rdma_size , 16 ) else : rdma_size = 0 notify_record_size = trace_event [ start_index + 1 ] . get ( "args" ) . get ( "size" ) if notify_record_size : notify_record_size = notify_record_size if isinstance ( notify_record_size , int ) else int ( notify_record_size , 16 ) else : notify_record_size = 0 rdma_communication_size += rdma_size + notify_record_size start_index += 2 start_index += 1 # The unit of rdma_communication_wait_time is ms. # The unit of rdma_bandwidth is KB/s. # The unit of rdma_communication_size is k_byte and The unit of rdma_communication_time is ms. rdma_communication_wait_time = rdma_communication_wait_time / 1e3 rdma_communication_size = rdma_communication_size / 1e3 rdma_communication_time = rdma_communication_time / 1e3 rdma_bandwidth = rdma_communication_size / ( rdma_communication_time / 1e3 ) if rdma_communication_size else 0 return [ rdma_communication_time , rdma_communication_size , rdma_bandwidth , rdma_communication_wait_time ]