diff --git a/projects/rocprofiler/bin/tblextr.py b/projects/rocprofiler/bin/tblextr.py index a82deb2f55..ebcd83df00 100755 --- a/projects/rocprofiler/bin/tblextr.py +++ b/projects/rocprofiler/bin/tblextr.py @@ -256,6 +256,8 @@ def fill_copy_db(table_name, db, indir): ptrn_val = re.compile(r'(\d+):(\d+) (.*)$') ptrn_id = re.compile(r'^async-copy(\d+)$') + if not os.path.isfile(file_name): return 0 + if not COPY_PID in dep_dict: dep_dict[COPY_PID] = {} dep_to_us_dict = {} @@ -357,8 +359,7 @@ else: db = SQLiteDB(dbfile) hsa_trace_found = fill_api_db('HSA', db, indir, 'hsa', HSA_PID, COPY_PID, kern_dep_list, {}, 0) - if hsa_trace_found: - fill_copy_db('COPY', db, indir) + hsa_activity_found = fill_copy_db('COPY', db, indir) ops_filtr = fill_ops_db('OPS', db, indir) hip_trace_found = fill_api_db('HIP', db, indir, 'hip', HIP_PID, OPS_PID, [], ops_filtr, 1) @@ -371,6 +372,7 @@ else: if hsa_trace_found: db.label_json(HSA_PID, "CPU HSA API", jsonfile) + if hsa_activity_found: db.label_json(COPY_PID, "COPY", jsonfile) if hip_trace_found: @@ -392,6 +394,7 @@ else: dform.gen_table_bins(db, 'HSA', statfile, 'Name', 'DurationNs') dform.gen_api_json_trace(db, 'HSA', START_US, jsonfile) + if hsa_activity_found: dform.post_process_data(db, 'COPY') dform.gen_api_json_trace(db, 'COPY', START_US, jsonfile) @@ -416,12 +419,15 @@ else: dep_id = 0 for (to_pid, dep_str) in dep_dict.items(): if 'inv' in dep_str: continue + if not 'to' in dep_str: continue + + to_us_dict = dep_str['to'] + from_us_list = dep_str['from'] from_pid = dep_str['pid'] tid_list = dep_str['tid'] - from_us_list = dep_str['from'] - to_us_dict = dep_str['to'] corr_id_list = [] if 'id' in dep_str: corr_id_list = dep_str['id'] + db.flow_json(dep_id, from_pid, tid_list, from_us_list, to_pid, to_us_dict, corr_id_list, START_US, jsonfile) dep_id += len(tid_list)