Avara3D 0.2.0
C++ API reference
FrameStats.h
1//
2// FrameStats.h
3// avara3d
4//
5// Created by Morgan Davis on 1/6/26.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_PROFILE_FRAMESTATS_H
10#define AVARA3D_PROFILE_FRAMESTATS_H
11
12#include <chrono>
13#include <cstdint>
14
15namespace a3d {
16
17 struct RenderMemoryStats {
18
19 struct Usage {
20
21 std::uint64_t textureBytes {0};
22 std::uint64_t vertexBufferBytes {0};
23 std::uint64_t indexBufferBytes {0};
24 std::uint64_t uniformBufferBytes {0};
25 std::uint64_t renderTargetBytes {0};
26 std::uint64_t otherBytes {0};
27
28 std::uint64_t totalBytes() const {
29
30 return textureBytes + vertexBufferBytes + indexBufferBytes + uniformBufferBytes
31 + renderTargetBytes + otherBytes;
32 }
33 };
34
35 Usage a3d {};
36 Usage imgui {};
37 std::uint64_t peakTotalBytes {0};
38
39 Usage totalUsage() const {
40
41 return {
42 .textureBytes = a3d.textureBytes + imgui.textureBytes,
43 .vertexBufferBytes = a3d.vertexBufferBytes + imgui.vertexBufferBytes,
44 .indexBufferBytes = a3d.indexBufferBytes + imgui.indexBufferBytes,
45 .uniformBufferBytes = a3d.uniformBufferBytes + imgui.uniformBufferBytes,
46 .renderTargetBytes = a3d.renderTargetBytes + imgui.renderTargetBytes,
47 .otherBytes = a3d.otherBytes + imgui.otherBytes,
48 };
49 }
50
51 std::uint64_t totalBytes() const {
52
53 return a3d.totalBytes() + imgui.totalBytes();
54 }
55 };
56
57 struct FrameStats {
58
59 std::chrono::nanoseconds frameTime {};
60 std::chrono::nanoseconds engineCpuTime {};
61 std::chrono::nanoseconds renderCpuTime {};
62 std::chrono::nanoseconds renderGpuTime {};
63 std::chrono::nanoseconds physicsTime {};
64 std::chrono::nanoseconds applicationTime {};
65
66 RenderMemoryStats renderMemory {};
67
68 // fixed simulation configuration
69 double simulationTimeStep {0.0};
70 std::uint32_t maxCatchUpSteps {0};
71
72 // cumulative completed simulation
73 std::uint64_t simulationStepCount {0};
74 double simulationTime {0.0};
75
76 // simulation steps completed during this Runner update
77 std::uint32_t simulationStepsThisUpdate {0};
78
79 // complete fixed-step simulation debt discarded after bounded catch-up
80 double discardedSimulationTime {0.0};
81 double totalDiscardedSimulationTime {0.0};
82
83 std::uint32_t nodes {0};
84 std::uint32_t meshes {0};
85 std::uint32_t elements {0};
86 std::uint32_t polygons {0};
87 std::uint32_t lights {0};
88
89 std::uint32_t staticBodies {0};
90 std::uint32_t dynamicBodies {0};
91 std::uint32_t kinematicBodies {0};
92
93 std::uint32_t primitiveShapes {0};
94 std::uint32_t boundingBoxShapes {0};
95 std::uint32_t convexHullShapes {0};
96 std::uint32_t concavePolyhedronShapes {0};
97
98 std::uint32_t activeContacts {0};
99 };
100
101}
102
103#endif // AVARA3D_PROFILE_FRAMESTATS_H