[rocprofiler-systems] Add cached demangler and replace old demangle (#2135)

* Add cached demangler and replace old

* Add unit tests

* Applied suggestions from code review

* Applied suggestions from code review
This commit is contained in:
Milan Radosavljevic
2025-12-16 08:32:18 +01:00
committed by GitHub
parent 21afa807a9
commit 666e76deac
27 changed files with 450 additions and 84 deletions
@@ -22,6 +22,7 @@
#pragma once
#include "core/demangler.hpp"
#include "defines.hpp"
#include <timemory/settings/macros.hpp>
@@ -273,7 +274,7 @@ TIMEMORY_CEREAL_SAVE_FUNCTION_NAME(SettingsTextArchive& ar, const NameValuePair<
}
else
{
ar.setNextType(tim::demangle<T>().c_str());
ar.setNextType(rocprofsys::utility::demangle<T>().c_str());
}
ar(t.value);
}
@@ -45,7 +45,6 @@
namespace regex_const = ::std::regex_constants; // NOLINT
namespace comp = ::tim::component; // NOLINT
using settings = ::tim::settings; // NOLINT
using tim::demangle; // NOLINT
using tim::type_list; // NOLINT
//--------------------------------------------------------------------------------------//
@@ -23,6 +23,7 @@
#pragma once
#include "common.hpp"
#include "core/demangler.hpp"
#include "defines.hpp"
#include <timemory/components/types.hpp>
@@ -51,7 +52,7 @@ struct component_categories
(void) _cleanup; // unused but set if sizeof...(Tp) == 0
TIMEMORY_FOLD_EXPRESSION(_v.emplace(TIMEMORY_JOIN(
"::", "component", _cleanup(tim::try_demangle<Tp>(), "tim::"))));
"::", "component", _cleanup(rocprofsys::utility::demangle<Tp>(), "tim::"))));
}
void operator()(std::set<std::string>& _v) const
@@ -23,6 +23,7 @@
#pragma once
#include "common.hpp"
#include "core/demangler.hpp"
#include <timemory/utility/demangle.hpp>
#include <timemory/utility/type_list.hpp>
@@ -43,7 +44,7 @@ get_categories(type_list<Tp...>)
};
(void) _cleanup; // unused but set if sizeof...(Tp) == 0
auto _vec = str_vec_t{ _cleanup(demangle<Tp>(), "tim::")... };
auto _vec = str_vec_t{ _cleanup(rocprofsys::utility::demangle<Tp>(), "tim::")... };
std::sort(_vec.begin(), _vec.end(), [](const auto& lhs, const auto& rhs) {
// prioritize project category
auto lpos = lhs.find("project::");