74std::invoke_result_t<Func, Args...>
Profile(std::string
const& zoneName, Func&& f, Args&&... args)
76#ifdef PBAT_CAN_USE_TRACY_CPP
77 static auto constexpr line = (uint32_t)TracyLine;
78 struct SourceLocationData
80 SourceLocationData(std::string_view zoneNameView)
81 : name(zoneNameView), function(TracyFunction), file(TracyFile), data()
83 data.name = name.data();
84 data.function = function.data();
85 data.file = file.data();
92 tracy::SourceLocationData data;
94 static std::map<std::string, SourceLocationData> zones{};
95 auto it = zones.find(zoneName);
96 if (it == zones.end())
99 std::tie(it, inserted) = zones.insert({zoneName, SourceLocationData(zoneName)});
102 SourceLocationData
const& data = it->second;
103 tracy::ScopedZone zone(&(data.data));
105 return f(std::forward<Args>(args)...);
std::invoke_result_t< Func, Args... > Profile(std::string const &zoneName, Func &&f, Args &&... args)
Profile a function as a Tracy named zone.
Definition Profiling.h:74