in visualize/generate.py [0:0]
def extract_data_from_log_items(log_items: List[LogItem]) -> List:
data = []
count_dict = defaultdict(int)
# Count the occurrences of each (comm_type, msg_size, group) combination
for item in log_items:
if item.stage != 'init' and item.comm_type != CommType.epoch_end:
group = item.comm_group.name if item.comm_group else "unknown"
if item.msg_size > 0:
item.msg_size = item.msg_size #B
key = (item.comm_type.name, item.msg_size, group)
count_dict[key] += 1
# Construct the return data, including the busbw value
for item in log_items:
if item.stage != 'init' and item.comm_type != CommType.epoch_end:
group = item.comm_group.name if item.comm_group else "unknown"
if item.msg_size > 0:
key = (item.comm_type.name, item.msg_size, group)
count = count_dict[key]
data.append((item.comm_type.name, item.msg_size, group, item.busbw, count))
return data