Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
tracy.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <cstddef>
8#include <cstdint>
9#include <optional>
10#include <source_location>
11#include <span>
12#include <string_view>
13
14namespace helios::profile {
15
16/// @brief Tracy profiler backend adapter.
17class TracyBackend final : public Backend {
18public:
19 [[nodiscard]] size_t ZoneStorageSize() const noexcept override;
20
21 void BeginZone(const ZoneSpec& spec,
22 std::span<std::byte> storage) noexcept override;
23
24 void EndZone(std::span<std::byte> storage) noexcept override;
25
26 void ZoneText(std::span<std::byte> storage,
27 std::string_view text) noexcept override;
28
29 void ZoneValue(std::span<std::byte> storage,
30 uint64_t value) noexcept override;
31
32 void ZoneName(std::span<std::byte> storage,
33 std::string_view name) noexcept override;
34
35 void FrameMark() noexcept override;
36
37 void FrameMark(CStringView name) noexcept override;
38
39 void FrameMarkStart(CStringView name) noexcept override;
40
41 void FrameMarkEnd(CStringView name) noexcept override;
42
43 void Message(std::string_view text, uint32_t color) noexcept override;
44
45 void SetThreadName(CStringView name) noexcept override;
46
47 void Plot(CStringView name, double value) noexcept override;
48
49 void PlotConfig(CStringView name, PlotFormat type, bool step, bool fill,
50 uint32_t color) noexcept override;
51
52 void Alloc(const void* ptr, size_t size, std::optional<CStringView> name,
53 int depth, std::source_location loc) noexcept override;
54
55 void Free(const void* ptr, std::optional<CStringView> name, int depth,
56 std::source_location loc) noexcept override;
57
58 void MemoryDiscard(CStringView name) noexcept override;
59
60 void MemoryDiscard(CStringView name, int depth) noexcept override;
61
62 [[nodiscard]] std::string_view Name() const noexcept override {
63 return "tracy";
64 }
65};
66
67} // namespace helios::profile
Abstract profiler backend interface.
Definition backend.hpp:30
Tracy profiler backend adapter.
Definition tracy.hpp:17
void FrameMark() noexcept override
Marks the end of the current frame.
Definition tracy.cpp:91
void Free(const void *ptr, std::optional< CStringView > name, int depth, std::source_location loc) noexcept override
Records a memory deallocation.
Definition tracy.cpp:154
size_t ZoneStorageSize() const noexcept override
Returns the per-zone storage required by this backend.
Definition tracy.cpp:54
void Plot(CStringView name, double value) noexcept override
Records a plot sample.
Definition tracy.cpp:122
std::string_view Name() const noexcept override
Returns the backend name.
Definition tracy.hpp:62
void SetThreadName(CStringView name) noexcept override
Sets the current thread name.
Definition tracy.cpp:118
void Alloc(const void *ptr, size_t size, std::optional< CStringView > name, int depth, std::source_location loc) noexcept override
Records a memory allocation.
Definition tracy.cpp:132
void FrameMarkEnd(CStringView name) noexcept override
Marks the end of a named frame region.
Definition tracy.cpp:104
void ZoneValue(std::span< std::byte > storage, uint64_t value) noexcept override
Attaches a numeric value to the active zone.
Definition tracy.cpp:81
void EndZone(std::span< std::byte > storage) noexcept override
Ends a profiling zone.
Definition tracy.cpp:72
void FrameMarkStart(CStringView name) noexcept override
Marks the start of a named frame region.
Definition tracy.cpp:99
void PlotConfig(CStringView name, PlotFormat type, bool step, bool fill, uint32_t color) noexcept override
Configures a plot channel.
Definition tracy.cpp:126
void Message(std::string_view text, uint32_t color) noexcept override
Emits a timeline message.
Definition tracy.cpp:109
void ZoneText(std::span< std::byte > storage, std::string_view text) noexcept override
Attaches text to the active zone.
Definition tracy.cpp:76
void BeginZone(const ZoneSpec &spec, std::span< std::byte > storage) noexcept override
Begins a profiling zone.
Definition tracy.cpp:58
void MemoryDiscard(CStringView name) noexcept override
Discards tracked memory for a named pool.
Definition tracy.cpp:174
void ZoneName(std::span< std::byte > storage, std::string_view name) noexcept override
Renames the active zone.
Definition tracy.cpp:86
PlotFormat
Plot value format for timeline plots.
Definition common.hpp:10
BasicCStringView< char > CStringView
A view of a null-terminated C string.
Immutable zone description for a single instrumentation site.
Definition common.hpp:22