Skip to content

Commit

Permalink
Fix backtrace resolution and ordering in UI (#1)
Browse files Browse the repository at this point in the history
* Fix backtrace resolution for non-omnitrace libraries

* Nicer Perfetto UI on long backtraces

* Make Perfetto annotation consistent

* clang-format
  • Loading branch information
tbennun authored Jan 10, 2024
1 parent cb8ef84 commit e5945aa
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions source/lib/omnitrace/library/roctracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ hip_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, void*
{
if(itr)
{
if(auto _val = binary::lookup_ipaddr_entry<true>(itr->address());
if(auto _val = binary::lookup_ipaddr_entry<false>(itr->address());
_val)
{
_bt_data->emplace_back(std::move(*_val));
Expand Down Expand Up @@ -816,12 +816,23 @@ hip_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, void*
(itr.name.empty()) ? &_unk : &itr.name;
const auto* _loc =
(itr.location.empty()) ? &_unk : &itr.location;
auto _line = (itr.lineno == 0) ? std::string{ "?" }
: join("", itr.lineno);
tracing::add_perfetto_annotation(
ctx, join("", "frame#", _bt_cnt++),
join("", demangle(*_func), " @ ",
join(':', *_loc, _line)));
auto _line = (itr.lineno == 0) ? std::string{ "?" }
: join("", itr.lineno);
auto _entry = join("", demangle(*_func), " @ ",
join(':', *_loc, _line));
if(_bt_cnt < 10)
{
// Prepend zero for better ordering in UI.
// Only one zero is ever necessary since stack depth
// is limited to 16.
tracing::add_perfetto_annotation(
ctx, join("", "frame#0", _bt_cnt++), _entry);
}
else
{
tracing::add_perfetto_annotation(
ctx, join("", "frame#", _bt_cnt++), _entry);
}
}
}
}
Expand Down

0 comments on commit e5945aa

Please sign in to comment.