group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
PhysicsPerfStats.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <cstdint>
7
8namespace physics::perf
9{
10
12{
13 std::uint32_t movementCalls = 0;
14 std::uint32_t movementPlayers = 0;
15 std::uint32_t collisionCalls = 0;
16 std::uint32_t collisionPlayers = 0;
17
18 std::uint32_t kccCalls = 0;
19 std::uint32_t kccBumpHits = 0;
20 std::uint32_t kccCaIterations = 0;
21 std::uint32_t kccSweepHits = 0;
22
23 std::uint32_t wallDetectCalls = 0;
24 std::uint32_t wallMeshProbes = 0;
25 std::uint32_t wallMeshProbeMeshes = 0;
26 std::uint32_t wallSphereFallbacks = 0;
27 std::uint32_t wallAttachmentCalls = 0;
28 std::uint32_t wallAttachmentMeshes = 0;
29 std::uint32_t wallDetectSkippedByGate = 0;
31 std::uint32_t wallAttachmentNeighborHits = 0;
33
34 std::uint32_t staticBroadphaseQueries = 0;
35 std::uint32_t staticBroadphaseMeshes = 0;
36
37 std::uint32_t sweepAabbAllCalls = 0;
38 std::uint32_t sweepCapsuleAllCalls = 0;
39 std::uint32_t sweepCapsuleTriMeshCalls = 0;
40 std::uint32_t sweepCapsuleTriMeshNodes = 0;
41 std::uint32_t sweepCapsuleTriMeshTris = 0;
42
43 std::uint32_t deepestCapsuleCalls = 0;
44 std::uint32_t deepestCapsuleTriMeshCalls = 0;
45 std::uint32_t deepestCapsuleTriMeshNodes = 0;
46 std::uint32_t deepestCapsuleTriMeshTris = 0;
47
48 std::uint32_t closestPointMeshCalls = 0;
49 std::uint32_t closestPointMeshNodes = 0;
50 std::uint32_t closestPointMeshTris = 0;
51 std::uint32_t closestPointTriangleCalls = 0;
52
53 std::uint32_t closestPointWallProbeCalls = 0;
54 std::uint32_t closestPointWallProbeNodes = 0;
55 std::uint32_t closestPointWallProbeTris = 0;
59};
60
61inline thread_local bool enabled = false;
62inline thread_local FrameStats frame;
63
64enum class ClosestPointContext : std::uint8_t
65{
69};
70
72
86
87inline void setEnabled(bool value) noexcept
88{
89 enabled = value;
90}
91
92[[nodiscard]] inline bool isEnabled() noexcept
93{
94 return enabled;
95}
96
97inline void resetFrame() noexcept
98{
99 frame = {};
100}
101
102[[nodiscard]] inline FrameStats snapshot() noexcept
103{
104 return frame;
105}
106
107inline void add(std::uint32_t FrameStats::*field, std::uint32_t amount = 1) noexcept
108{
109 if (enabled)
110 frame.*field += amount;
111}
112
113inline void addClosestPointCall() noexcept
114{
116 if (!enabled)
117 return;
119 ++frame.closestPointWallProbeCalls;
121 ++frame.closestPointWallAttachmentCalls;
122}
123
124inline void addClosestPointNode() noexcept
125{
127 if (!enabled)
128 return;
130 ++frame.closestPointWallProbeNodes;
132 ++frame.closestPointWallAttachmentNodes;
133}
134
135inline void addClosestPointTri() noexcept
136{
138 if (!enabled)
139 return;
141 ++frame.closestPointWallProbeTris;
143 ++frame.closestPointWallAttachmentTris;
144}
145
146} // namespace physics::perf
~ScopedClosestPointContext()
Definition PhysicsPerfStats.hpp:81
ScopedClosestPointContext(ClosestPointContext context) noexcept
Definition PhysicsPerfStats.hpp:76
ClosestPointContext previous_
Definition PhysicsPerfStats.hpp:84
Definition PhysicsPerfStats.hpp:9
bool enabled
Definition PhysicsPerfStats.hpp:61
ClosestPointContext
Definition PhysicsPerfStats.hpp:65
@ Generic
Definition PhysicsPerfStats.hpp:66
@ WallAttachment
Definition PhysicsPerfStats.hpp:68
@ WallProbe
Definition PhysicsPerfStats.hpp:67
void resetFrame() noexcept
Definition PhysicsPerfStats.hpp:97
void addClosestPointCall() noexcept
Definition PhysicsPerfStats.hpp:113
ClosestPointContext closestPointContext
Definition PhysicsPerfStats.hpp:71
void addClosestPointTri() noexcept
Definition PhysicsPerfStats.hpp:135
void add(std::uint32_t FrameStats::*field, std::uint32_t amount=1) noexcept
Definition PhysicsPerfStats.hpp:107
void setEnabled(bool value) noexcept
Definition PhysicsPerfStats.hpp:87
FrameStats snapshot() noexcept
Definition PhysicsPerfStats.hpp:102
FrameStats frame
Definition PhysicsPerfStats.hpp:62
bool isEnabled() noexcept
Definition PhysicsPerfStats.hpp:92
void addClosestPointNode() noexcept
Definition PhysicsPerfStats.hpp:124
Definition PhysicsPerfStats.hpp:12
std::uint32_t wallDetectSkippedByGate
Definition PhysicsPerfStats.hpp:29
std::uint32_t staticBroadphaseQueries
Definition PhysicsPerfStats.hpp:34
std::uint32_t wallDetectCalls
Definition PhysicsPerfStats.hpp:23
std::uint32_t closestPointWallProbeNodes
Definition PhysicsPerfStats.hpp:54
std::uint32_t wallAttachmentBroadphaseFallbacks
Definition PhysicsPerfStats.hpp:32
std::uint32_t wallAttachmentCalls
Definition PhysicsPerfStats.hpp:27
std::uint32_t closestPointMeshTris
Definition PhysicsPerfStats.hpp:50
std::uint32_t sweepCapsuleTriMeshCalls
Definition PhysicsPerfStats.hpp:39
std::uint32_t wallMeshProbes
Definition PhysicsPerfStats.hpp:24
std::uint32_t deepestCapsuleTriMeshCalls
Definition PhysicsPerfStats.hpp:44
std::uint32_t wallAttachmentPrevTriangleHits
Definition PhysicsPerfStats.hpp:30
std::uint32_t closestPointWallAttachmentCalls
Definition PhysicsPerfStats.hpp:56
std::uint32_t wallAttachmentMeshes
Definition PhysicsPerfStats.hpp:28
std::uint32_t staticBroadphaseMeshes
Definition PhysicsPerfStats.hpp:35
std::uint32_t closestPointMeshNodes
Definition PhysicsPerfStats.hpp:49
std::uint32_t kccCalls
Definition PhysicsPerfStats.hpp:18
std::uint32_t collisionCalls
Definition PhysicsPerfStats.hpp:15
std::uint32_t movementPlayers
Definition PhysicsPerfStats.hpp:14
std::uint32_t deepestCapsuleCalls
Definition PhysicsPerfStats.hpp:43
std::uint32_t sweepCapsuleAllCalls
Definition PhysicsPerfStats.hpp:38
std::uint32_t wallMeshProbeMeshes
Definition PhysicsPerfStats.hpp:25
std::uint32_t closestPointWallAttachmentTris
Definition PhysicsPerfStats.hpp:58
std::uint32_t sweepCapsuleTriMeshNodes
Definition PhysicsPerfStats.hpp:40
std::uint32_t closestPointWallProbeCalls
Definition PhysicsPerfStats.hpp:53
std::uint32_t wallAttachmentNeighborHits
Definition PhysicsPerfStats.hpp:31
std::uint32_t kccSweepHits
Definition PhysicsPerfStats.hpp:21
std::uint32_t sweepCapsuleTriMeshTris
Definition PhysicsPerfStats.hpp:41
std::uint32_t deepestCapsuleTriMeshTris
Definition PhysicsPerfStats.hpp:46
std::uint32_t closestPointWallAttachmentNodes
Definition PhysicsPerfStats.hpp:57
std::uint32_t sweepAabbAllCalls
Definition PhysicsPerfStats.hpp:37
std::uint32_t deepestCapsuleTriMeshNodes
Definition PhysicsPerfStats.hpp:45
std::uint32_t collisionPlayers
Definition PhysicsPerfStats.hpp:16
std::uint32_t kccBumpHits
Definition PhysicsPerfStats.hpp:19
std::uint32_t kccCaIterations
Definition PhysicsPerfStats.hpp:20
std::uint32_t closestPointWallProbeTris
Definition PhysicsPerfStats.hpp:55
std::uint32_t movementCalls
Definition PhysicsPerfStats.hpp:13
std::uint32_t wallSphereFallbacks
Definition PhysicsPerfStats.hpp:26
std::uint32_t closestPointTriangleCalls
Definition PhysicsPerfStats.hpp:51
std::uint32_t closestPointMeshCalls
Definition PhysicsPerfStats.hpp:48