ludus::foundation::profiling¶
Ludus Wiki · API overview · Browse API
Namespace
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/clock.hpp
Related declarations¶
- ludus::foundation::profiling::GpuTraceCoverage
- ludus::foundation::profiling::GpuTraceSample
- ludus::foundation::profiling::ProfileCategory
- ludus::foundation::profiling::ScopedZone
- ludus::foundation::profiling::TraceHealth
- ludus::foundation::profiling::ZoneDescriptor
Constants and variables¶
CALLER_FLOW_ID_BIT¶
constexpr uint64 ludus::foundation::profiling::CALLER_FLOW_ID_BIT = uint64{1} << 63
Related types: uint64
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/integration.hpp
PROFILE_CATEGORY_NONE¶
constexpr ProfileCategory ludus::foundation::profiling::PROFILE_CATEGORY_NONE {0u, std::string_view{}}
Related types: ProfileCategory
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/zone.hpp
Functions¶
NowTicks¶
uint64 ludus::foundation::profiling::NowTicks() noexcept
Related types: uint64
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/clock.hpp
TicksPerNanosecondDenominator¶
uint64 ludus::foundation::profiling::TicksPerNanosecondDenominator() noexcept
Related types: uint64
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/clock.hpp
IsCaptureActive¶
bool ludus::foundation::profiling::IsCaptureActive() noexcept
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/integration.hpp
RegisterSite¶
void ludus::foundation::profiling::RegisterSite(const ZoneDescriptor &descriptor) noexcept
| Parameter | Description |
|---|---|
descriptor |
Site metadata whose Name and File have static storage duration.
|
Related types: ZoneDescriptor
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/integration.hpp
BeginSite¶
void ludus::foundation::profiling::BeginSite(uint32 siteId) noexcept
| Parameter | Description |
|---|---|
siteId |
ZoneDescriptor::SiteId of a site registered with RegisterSite.
|
Related types: uint32
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/integration.hpp
EndSite¶
void ludus::foundation::profiling::EndSite(uint32 siteId) noexcept
| Parameter | Description |
|---|---|
siteId |
The site ID given to the matching BeginSite.
|
Related types: uint32
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/integration.hpp
StartFlow¶
void ludus::foundation::profiling::StartFlow(const ZoneDescriptor &descriptor, uint64 flowId) noexcept
| Parameter | Description |
|---|---|
descriptor |
Registered site naming the flow; FinishFlow must use the same site.
|
flowId |
Caller-unique ID with CALLER_FLOW_ID_BIT set.
|
Related types: uint64 · ZoneDescriptor
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/integration.hpp
FinishFlow¶
void ludus::foundation::profiling::FinishFlow(const ZoneDescriptor &descriptor, uint64 flowId) noexcept
| Parameter | Description |
|---|---|
descriptor |
The site given to the matching StartFlow.
|
flowId |
The ID given to the matching StartFlow.
|
Related types: uint64 · ZoneDescriptor
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/integration.hpp
SampleCounter¶
void ludus::foundation::profiling::SampleCounter(const ZoneDescriptor &descriptor, uint64 value) noexcept
| Parameter | Description |
|---|---|
descriptor |
Registered site naming the counter.
|
value |
Sample value.
|
Related types: uint64 · ZoneDescriptor
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/integration.hpp
RecordMemoryGauges¶
bool ludus::foundation::profiling::RecordMemoryGauges() noexcept
ExportPerfettoTrace writes each group as one Chrome trace counter event ("ph":"C") named Memory/<domain> whose arguments are the domain's Validity, LiveRequestedBytes, LiveBlocks, PeakRequestedBytes, AllocatedBytes, FreedBytes, AllocationCount, FreeCount, FailureCount and RejectedCount. A domain whose accounting is no longer valid contributes only Validity (1 saturated, 2 accounting error), never plausible-looking byte values. The export's metadata object carries the coverage manifest: the sampled domains and the allocation paths outside domain accounting.TraceHealth::EventsDropped. Never allocates and never blocks beyond the recorder's per-chunk lock. Returns
Note
RegisterThreadForTrace so the sample is attributed and flushed. Domain accounting itself is independent of LUDUS_PROFILING_ENABLED and of whether a capture is active. Declared in modules/foundation/profiling/include/ludus/foundation/profiling/memory_gauges.hpp
SerializePerfettoTrace¶
bool ludus::foundation::profiling::SerializePerfettoTrace(Array< uint8 > &outBytes, BorrowedView< const GpuTraceSample > samples={}, const GpuTraceCoverage &coverage={}, bool shouldIncludeCpu=true) noexcept
| Parameter | Description |
|---|---|
outBytes |
Receives the complete file bytes only on success; unchanged on failure.
|
samples |
Borrowed completed GPU samples, consumed during this call. IDs must be nonzero and CollectionTicks must not precede SubmissionTicks. PassName must be valid UTF-8 without embedded zero; ScopeIdentity must be nonzero exactly when PassName is nonempty. An execution interval requires a named pass and must not end before it starts. Calibrated passes are also emitted as named "X" slices on GPU execution lanes; overlapping passes use separate lanes rather than inventing nesting. No native objects are retained.
|
coverage |
GPU sampling coverage included in the exported artifact.
|
shouldIncludeCpu |
When true, drains the most recent stopped CPU recording. When false, does not drain CPU events or serialize CPU thread metadata, allowing GPU-only export without enabling CPU scopes.
|
Returns
Note
Related types: BorrowedView · Array · uint8 · GpuTraceCoverage · GpuTraceSample
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/perfetto_export.hpp
RegisterThreadForTrace¶
void ludus::foundation::profiling::RegisterThreadForTrace(std::string_view threadName) noexcept
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/trace_system.hpp
UnregisterThreadForTrace¶
void ludus::foundation::profiling::UnregisterThreadForTrace() noexcept
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/trace_system.hpp
BeginCapture¶
bool ludus::foundation::profiling::BeginCapture(usize maxChunks=64) noexcept
maxChunks 64-byte-aligned chunks (about 96 KiB each; zero is treated as one) so recording never allocates. Events of a previous capture that were not exported are discarded. | Parameter | Description |
|---|---|
maxChunks |
Bound on total trace memory, in chunks.
|
Returns
usize, or the reservation fails; tracing then stays disabled and the engine runs normally (§21). Note
Related types: usize
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/trace_system.hpp
EndCapture¶
void ludus::foundation::profiling::EndCapture() noexcept
Note
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/trace_system.hpp
HasUnexportedTrace¶
bool ludus::foundation::profiling::HasUnexportedTrace() noexcept
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/trace_system.hpp
ExportPerfettoTrace¶
bool ludus::foundation::profiling::ExportPerfettoTrace(std::string_view path) noexcept
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/trace_system.hpp
GetTraceHealth¶
TraceHealth ludus::foundation::profiling::GetTraceHealth() noexcept
Related types: TraceHealth
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/trace_system.hpp
HashZoneName¶
constexpr uint32 ludus::foundation::profiling::HashZoneName(std::string_view name) noexcept
Related types: uint32
Declared in modules/foundation/profiling/include/ludus/foundation/profiling/zone.hpp