Skip to content

Commit

Permalink
Isolate flushing instructions for HIP activity
Browse files Browse the repository at this point in the history
Instructions for flushing HIP activities informations into hcc_ops_trace.txt have been put into a wrapping function
  • Loading branch information
yoann-heitz committed Sep 22, 2021
1 parent f06ef8d commit 035a498
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/tool/tracer_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,15 @@ void hip_act_flush_cb(hip_act_trace_entry_t* entry) {

// Activity tracing callback
// hipMalloc id(3) correlation_id(1): begin_ns(1525888652762640464) end_ns(1525888652762877067)

void hip_activity_flush_cb(const roctracer_record_t *record, const char *name, uint32_t pid){
fprintf(hcc_activity_file_handle, "%lu:%lu %d:%lu %s:%lu:%u\n",
record->begin_ns, record->end_ns,
record->device_id, record->queue_id,
name, record->correlation_id, pid);
fflush(hcc_activity_file_handle);
}

void pool_activity_callback(const char* begin, const char* end, void* arg) {
const roctracer_record_t* record = reinterpret_cast<const roctracer_record_t*>(begin);
const roctracer_record_t* end_record = reinterpret_cast<const roctracer_record_t*>(end);
Expand All @@ -676,11 +685,7 @@ void pool_activity_callback(const char* begin, const char* end, void* arg) {
entry->correlation_id = record->correlation_id;
entry->valid.store(roctracer::TRACE_ENTRY_COMPL, std::memory_order_release);
} else {
fprintf(hcc_activity_file_handle, "%lu:%lu %d:%lu %s:%lu:%u\n",
record->begin_ns, record->end_ns,
record->device_id, record->queue_id,
name, record->correlation_id, my_pid);
fflush(hcc_activity_file_handle);
hip_activity_flush_cb(record, name, my_pid);
}
break;
case ACTIVITY_DOMAIN_HSA_OPS:
Expand Down

0 comments on commit 035a498

Please sign in to comment.