10#include <tracy/Tracy.hpp>
11#include <unordered_map>
39template <OperationLabel op1, OperationLabel op2>
constexpr auto concat()
42 char result_cstr[op1.size() + op2.size() - 1] = {};
43 std::copy(op1.value, op1.value + op1.size() - 1, result_cstr);
44 std::copy(op2.value, op2.value + op2.size(), result_cstr + op1.size() - 1);
124 if (
raw_track(current_parent, time_val) || (
next &&
next->raw_track(current_parent, time_val))) {
142 if (
parent != expected_parent) {
190#ifdef TRACY_INSTRUMENTED
191#define BB_TRACY() ZoneScopedN(__func__)
192#define BB_TRACY_NAME(name) ZoneScopedN(name)
193#define BB_BENCH_TRACY() ZoneScopedN(__func__)
194#define BB_BENCH_TRACY_NAME(name) ZoneScopedN(name)
195#define BB_BENCH_ONLY_NAME(name) (void)0
196#define BB_BENCH_ENABLE_NESTING() (void)0
197#define BB_BENCH_ONLY() (void)0
198#elif defined __wasm__
199#define BB_TRACY() (void)0
200#define BB_TRACY_NAME(name) (void)0
201#define BB_BENCH_TRACY() (void)0
202#define BB_BENCH_TRACY_NAME(name) (void)0
203#define BB_BENCH_ONLY_NAME(name) (void)0
204#define BB_BENCH_ENABLE_NESTING() (void)0
205#define BB_BENCH_ONLY() (void)0
207#define BB_TRACY() (void)0
208#define BB_TRACY_NAME(name) (void)0
209#define BB_BENCH_TRACY() BB_BENCH_ONLY_NAME(__func__)
210#define BB_BENCH_TRACY_NAME(name) BB_BENCH_ONLY_NAME(name)
211#define BB_BENCH_ONLY_NAME(name) \
212 bb::detail::BenchReporter _bb_bench_reporter((bb::detail::ThreadBenchStats<name>::ensure_stats().get()))
213#define BB_BENCH_ENABLE_NESTING() \
214 if (_bb_bench_reporter.stats) \
215 bb::detail::GlobalBenchStatsContainer::parent = _bb_bench_reporter.stats
216#define BB_BENCH_ONLY() BB_BENCH_ONLY_NAME(__func__)
218#define BB_BENCH_NAME(name) \
219 BB_BENCH_TRACY_NAME(name); \
220 BB_BENCH_ENABLE_NESTING()
224 BB_BENCH_ENABLE_NESTING()
GlobalBenchStatsContainer GLOBAL_BENCH_STATS
std::unordered_map< OperationKey, std::map< OperationKey, AggregateEntry > > AggregateData
std::string_view OperationKey
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
void add_thread_time_sample(const TimeAndCount &stats)
double get_std_dev() const
void print_stats_recursive(const OperationKey &key, const TimeStats *stats, const std::string &indent) const
void print_aggregate_counts_hierarchical(std::ostream &) const
void print_aggregate_counts(std::ostream &, size_t) const
AggregateData aggregate() const
void add_entry(const char *key, const std::shared_ptr< TimeStatsEntry > &entry)
std::vector< std::shared_ptr< TimeStatsEntry > > entries
~GlobalBenchStatsContainer()
static thread_local TimeStatsEntry * parent
static constexpr std::size_t size()
constexpr OperationLabel(const char(&str)[N])
static std::shared_ptr< TimeStatsEntry > ensure_stats()
static void init_entry(TimeStatsEntry &entry)
static thread_local std::shared_ptr< TimeStatsEntry > stats
bool raw_track(TimeStatsEntry *expected_parent, std::size_t time_val)
std::unique_ptr< TimeStats > next
TimeStats(TimeStatsEntry *parent_ptr, std::size_t count_val, std::size_t time_val)
void track(TimeStatsEntry *current_parent, std::size_t time_val)