12#include <tracy/Tracy.hpp>
13#include <unordered_map>
45template <OperationLabel op1, OperationLabel op2>
constexpr auto concat()
48 char result_cstr[op1.size() + op2.size() - 1] = {};
49 std::copy(op1.value, op1.value + op1.size() - 1, result_cstr);
50 std::copy(op2.value, op2.value + op2.size(), result_cstr + op1.size() - 1);
164 if (
raw_track(current_parent, time_val) || (
next &&
next->raw_track(current_parent, time_val))) {
182 if (
parent != expected_parent) {
236#ifdef TRACY_INSTRUMENTED
237#define BB_TRACY() ZoneScopedN(__func__)
238#define BB_TRACY_NAME(name) ZoneScopedN(name)
239#define BB_BENCH_TRACY() ZoneScopedN(__func__)
240#define BB_BENCH_TRACY_NAME(name) ZoneScopedN(name)
241#define BB_BENCH_ONLY_NAME(name) (void)0
242#define BB_BENCH_ENABLE_NESTING() (void)0
243#define BB_BENCH_ONLY() (void)0
244#elif defined __wasm__ && !defined ENABLE_WASM_BENCH
245#define BB_TRACY() (void)0
246#define BB_TRACY_NAME(name) (void)0
247#define BB_BENCH_TRACY() (void)0
248#define BB_BENCH_TRACY_NAME(name) (void)0
249#define BB_BENCH_ONLY_NAME(name) (void)0
250#define BB_BENCH_ENABLE_NESTING() (void)0
251#define BB_BENCH_ONLY() (void)0
253#define BB_TRACY() (void)0
254#define BB_TRACY_NAME(name) (void)0
255#define BB_BENCH_TRACY() BB_BENCH_ONLY_NAME(__func__)
256#define BB_BENCH_TRACY_NAME(name) BB_BENCH_ONLY_NAME(name)
257#define BB_BENCH_ONLY_NAME(name) \
258 bb::detail::BenchReporter _bb_bench_reporter((bb::detail::ThreadBenchStats<name>::ensure_stats().get()))
259#define BB_BENCH_ENABLE_NESTING() \
260 if (_bb_bench_reporter.stats) \
261 bb::detail::GlobalBenchStatsContainer::parent = _bb_bench_reporter.stats
262#define BB_BENCH_ONLY() BB_BENCH_ONLY_NAME(__func__)
264#define BB_BENCH_NAME(name) \
265 BB_BENCH_TRACY_NAME(name); \
266 BB_BENCH_ENABLE_NESTING()
270 BB_BENCH_ENABLE_NESTING()
GlobalBenchStatsContainer GLOBAL_BENCH_STATS
ThreadEventBuffer & get_thread_event_buffer()
std::atomic< bool > capture_per_call_events
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 serialize_trace_events_json(std::ostream &) const
void print_aggregate_counts(std::ostream &, size_t) const
void serialize_aggregate_data_json(std::ostream &) const
AggregateData aggregate() const
void add_entry(const char *key, const std::shared_ptr< TimeStatsEntry > &entry)
std::vector< std::unique_ptr< ThreadEventBuffer > > thread_event_buffers
std::vector< std::shared_ptr< TimeStatsEntry > > entries
~GlobalBenchStatsContainer()
void serialize_aggregate_trace_json(std::ostream &) const
ThreadEventBuffer & register_thread_event_buffer(uint64_t tid)
static thread_local TimeStatsEntry * parent
static constexpr std::size_t size()
constexpr OperationLabel(const char(&str)[N])
static std::shared_ptr< TimeStatsEntry > & get_stats()
static std::shared_ptr< TimeStatsEntry > ensure_stats()
static void init_entry(TimeStatsEntry &entry)
std::vector< PerCallEvent > events
bool raw_track(TimeStatsEntry *expected_parent, uint64_t time_val)
TimeStats(TimeStatsEntry *parent_ptr, uint64_t count_val, uint64_t time_val)
void track(TimeStatsEntry *current_parent, uint64_t time_val)
std::unique_ptr< TimeStats > next