Change-Id: I2477932a4e537082179859640904450ba8be82f4


[ROCm/rocprofiler commit: 068e2b1c27]
Этот коммит содержится в:
Evgeny
2019-06-21 03:15:12 -05:00
родитель 82ee832bef
Коммит e6336aa4a8
4 изменённых файлов: 36 добавлений и 26 удалений
+1 -1
Просмотреть файл
@@ -25,7 +25,7 @@ def gen_api_json_trace(db, table, start_us, outfile):
db.execute('DROP VIEW B')
def gen_ops_json_trace(db, table, base_pid, start_us, outfile):
db.execute('create view B as select "Index", Name as name, ("gpu-id" + %d) as pid, tid, (BeginNs/1000 - %d) as ts, (DurationNs/1000) as dur from %s order by ts asc;' % (base_pid, start_us, table));
db.execute('create view B as select "Index", Name as name, ("dev-id" + %d) as pid, tid, (BeginNs/1000 - %d) as ts, (DurationNs/1000) as dur from %s order by ts asc;' % (base_pid, start_us, table));
db.dump_json('B', table, outfile)
db.execute('DROP VIEW B')
+8 -2
Просмотреть файл
@@ -198,6 +198,8 @@ run() {
fi
fi
mkdir -p "$ROCP_OUTPUT_DIR"
OUTPUT_LIST="$OUTPUT_LIST $ROCP_OUTPUT_DIR/results.txt"
fi
API_TRACE=""
@@ -214,12 +216,16 @@ run() {
if [ -n "$API_TRACE" ] ; then
API_TRACE=$(echo $API_TRACE | sed 's/all//')
if [ -n "$API_TRACE" ] ; then export ROCTRACER_DOMAIN=$API_TRACE; fi
export HSA_TOOLS_LIB="$RPL_PATH/libroctracer64.so $TLIB_PATH/libtracer_tool.so $HSA_TOOLS_LIB"
if [ "$API_TRACE" = "hip" ] ; then
export HSA_TOOLS_LIB="$RPL_PATH/libroctracer64.so $TLIB_PATH/libtracer_tool.so"
OUTPUT_LIST="$ROCP_OUTPUT_DIR/"
else
export HSA_TOOLS_LIB="$RPL_PATH/libroctracer64.so $TLIB_PATH/libtracer_tool.so $HSA_TOOLS_LIB"
fi
fi
redirection_cmd=""
if [ -n "$ROCP_OUTPUT_DIR" ] ; then
OUTPUT_LIST="$OUTPUT_LIST $ROCP_OUTPUT_DIR/results.txt"
redirection_cmd="2>&1 | tee $ROCP_OUTPUT_DIR/log.txt"
fi
+7 -6
Просмотреть файл
@@ -121,12 +121,13 @@ class SQLiteDB:
for ind in range(len(from_tid)):
if (len(corr_id_list) != 0): corr_id = corr_id_list[ind]
else: corr_id = ind
from_ts = from_us_list[ind] - start_us
to_ts = to_us_dict[corr_id] - start_us
if from_ts > to_ts: from_ts = to_ts
fd.write(',{"ts":%d,"ph":"s","cat":"DataFlow","id":%d,"pid":%s,"tid":%s,"name":"dep"}\n' % (from_ts, dep_id, str(from_pid), from_tid[ind]))
fd.write(',{"ts":%d,"ph":"t","cat":"DataFlow","id":%d,"pid":%s,"tid":0,"name":"dep"}\n' % (to_ts, dep_id, str(to_pid)))
dep_id += 1
if corr_id in to_us_dict:
from_ts = from_us_list[ind] - start_us
to_ts = to_us_dict[corr_id] - start_us
if from_ts > to_ts: from_ts = to_ts
fd.write(',{"ts":%d,"ph":"s","cat":"DataFlow","id":%d,"pid":%s,"tid":%s,"name":"dep"}\n' % (from_ts, dep_id, str(from_pid), from_tid[ind]))
fd.write(',{"ts":%d,"ph":"t","cat":"DataFlow","id":%d,"pid":%s,"tid":0,"name":"dep"}\n' % (to_ts, dep_id, str(to_pid)))
dep_id += 1
def dump_json(self, table_name, data_name, file_name):
if not re.search(r'\.json$', file_name):
+20 -17
Просмотреть файл
@@ -325,11 +325,12 @@ def fill_ops_db(table_name, db, indir):
return filtr
#############################################################
# main
if (len(sys.argv) < 3): fatal("Usage: " + sys.argv[0] + " <output CSV file> <input result files list>")
if (len(sys.argv) < 2): fatal("Usage: " + sys.argv[0] + " <output CSV file> <input result files list>")
outfile = sys.argv[1]
infiles = sys.argv[2:]
indir = re.sub(r'\/[^\/]*$', r'', infiles[0])
inext = re.sub(r'^[^\.]*', r'', infiles[0])
dbfile = ''
csvfile = ''
@@ -342,9 +343,10 @@ elif re.search(r'\.db$', outfile):
else:
fatal("Bad output file '" + outfile + "'")
for f in infiles: parse_res(f)
if len(var_table) == 0: sys.exit(1)
merge_table()
if inext == '.txt':
for f in infiles: parse_res(f)
if len(var_table) == 0: sys.exit(1)
merge_table()
if dbfile == '':
dump_csv(csvfile)
@@ -379,26 +381,27 @@ else:
for ind in range(0, int(max_gpu_id) + 1):
db.label_json(int(ind) + int(GPU_BASE_PID), "GPU" + str(ind), jsonfile)
dform.post_process_data(db, 'A', csvfile)
dform.gen_table_bins(db, 'A', statfile, 'KernelName', 'DurationNs')
if hsa_trace_found and 'BeginNs' in var_list:
dform.gen_kernel_json_trace(db, 'A', GPU_BASE_PID, START_US, jsonfile)
if len(var_table) != 0:
dform.post_process_data(db, 'A', csvfile)
dform.gen_table_bins(db, 'A', statfile, 'KernelName', 'DurationNs')
if hsa_trace_found and 'BeginNs' in var_list:
dform.gen_kernel_json_trace(db, 'A', GPU_BASE_PID, START_US, jsonfile)
if hsa_trace_found:
statfile = re.sub(r'stats', r'hsa_stats', statfile)
dform.post_process_data(db, 'HSA')
dform.gen_table_bins(db, 'HSA', statfile, 'Name', 'DurationNs')
dform.gen_api_json_trace(db, 'HSA', START_US, jsonfile)
dform.post_process_data(db, 'COPY')
dform.gen_api_json_trace(db, 'COPY', START_US, jsonfile)
if hsa_trace_found:
statfile = re.sub(r'stats', r'hsa_stats', statfile)
dform.post_process_data(db, 'HSA')
dform.gen_table_bins(db, 'HSA', statfile, 'Name', 'DurationNs')
dform.gen_api_json_trace(db, 'HSA', START_US, jsonfile)
dform.post_process_data(db, 'COPY')
dform.gen_api_json_trace(db, 'COPY', START_US, jsonfile)
if hip_trace_found:
statfile = re.sub(r'stats', r'hip_stats', statfile)
dform.post_process_data(db, 'HIP')
dform.gen_table_bins(db, 'HIP', statfile, 'Name', 'DurationNs')
dform.gen_api_json_trace(db, 'HIP', START_US, jsonfile)
dform.post_process_data(db, 'OPS')
dform.gen_ops_json_trace(db, 'OPS', GPU_BASE_PID, START_US, jsonfile)