Files
rocm-systems/plugin/att/att_to_csv.py
T

20 строки
618 B
Python
Исходник Обычный вид История

2023-07-13 03:46:03 -03:00
#!/usr/bin/env python3
import numpy as np
import csv
import os
2023-10-04 14:27:55 -03:00
def dump_csv(code, trace_instance_name):
2023-07-13 03:46:03 -03:00
outpath = os.getenv("OUT_FILE_NAME")
if outpath is None:
2023-10-04 14:27:55 -03:00
outpath = "att_output"
elif os.path.dirname(outpath) != '':
os.makedirs(os.path.dirname(outpath), exist_ok=True)
outpath += '_' + os.path.basename(trace_instance_name) + '.csv'
2023-07-13 03:46:03 -03:00
with open(outpath, 'w') as f:
writer = csv.writer(f)
writer.writerow(['Line', 'Instruction', 'Hitcount', 'Cycles', 'Addr', 'C++ Reference'])
[writer.writerow([m[5], m[0], m[7], m[8], hex(m[6]), m[3]]) for m in code]