Migrate tracer performance fixes from roctracer

Change-Id: If9e1349537cce23b7be1d8530d795744a8cd07b1


[ROCm/rocprofiler commit: cb190b72f1]
This commit is contained in:
Benjamin Welton committed 2023-10-19 20:34:12 +00:00
1 parent 87654ec8b2
commit 1e6d394c7a
2 files changed
+86 -80

No files matched your search

+10 -3
View File
@@ -197,18 +197,25 @@ struct hip_api_trace_entry_t {
}
};
size_t GetBufferSize() {
auto bufSize = getenv("ROCPROFILER_BUFFER_SIZE");
// Default size if not set
if (!bufSize) return 0x200000;
return std::stoll({bufSize});
}
rocprofiler::TraceBuffer<hip_api_trace_entry_t> hip_api_buffer(
"HIP API", 0x200000, [](hip_api_trace_entry_t* entry) {
"HIP API", GetBufferSize(), [](hip_api_trace_entry_t* entry) {
assert(plugin && "plugin is not initialized");
plugin->write_callback_record(entry->record);
});
rocprofiler::TraceBuffer<hsa_api_trace_entry_t> hsa_api_buffer(
"HSA API", 0x200000, [](hsa_api_trace_entry_t* entry) {
"HSA API", GetBufferSize(), [](hsa_api_trace_entry_t* entry) {
assert(plugin && "plugin is not initialized");
plugin->write_callback_record(entry->record);
});
rocprofiler::TraceBuffer<roctx_trace_entry_t> roctx_trace_buffer(
"rocTX API", 0x200000, [](roctx_trace_entry_t* entry) {
"rocTX API", GetBufferSize(), [](roctx_trace_entry_t* entry) {
assert(plugin && "plugin is not initialized");
plugin->write_callback_record(entry->record);
});