128std::invoke_result_t<Func, Args...>
Profile(std::string
const& zoneName, Func&& f, Args&&... args)
130#ifdef PBAT_CAN_USE_TRACY_CPP
131 static auto constexpr line = (uint32_t)TracyLine;
132 struct SourceLocationData
134 SourceLocationData(std::string_view zoneNameView)
135 : name(zoneNameView), function(TracyFunction), file(TracyFile), data()
137 data.name = name.data();
138 data.function = function.data();
139 data.file = file.data();
144 std::string function;
146 tracy::SourceLocationData data;
148 static std::map<std::string, SourceLocationData> zones{};
149 auto it = zones.find(zoneName);
150 if (it == zones.end())
152 bool inserted{
false};
153 std::tie(it, inserted) = zones.insert({zoneName, SourceLocationData(zoneName)});
156 SourceLocationData
const& data = it->second;
157 tracy::ScopedZone zone(&(data.data));
159 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:128