-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWolfProfiler.cpp
More file actions
84 lines (76 loc) · 1.64 KB
/
WolfProfiler.cpp
File metadata and controls
84 lines (76 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "WolfProfiler.h"
namespace {
constexpr int SLOT_COUNT = WolfProfiler::Count;
constexpr const char* SLOT_LABELS[SLOT_COUNT] = {
"fps",
"physics",
"input",
"zupd",
"hudanim",
"floor",
"world",
"sprites",
"weapon",
"minimap",
"fpsov",
"present",
"hudr",
"hudf",
};
} // namespace
WolfProfiler::WolfProfiler()
: stageProfiler("wolf", profilerSlots, Count) {}
void WolfProfiler::begin() {
if (initialized) {
return;
}
for (int i = 0; i < SLOT_COUNT; i++) {
stageProfiler.setLabel(i, SLOT_LABELS[i]);
}
stageProfiler.setMode(Fps, Profiler::CounterSlot);
for (int i = 1; i < SLOT_COUNT; i++) {
stageProfiler.setMode(i, Profiler::SampleSlot);
}
initialized = true;
}
void WolfProfiler::add(Slot slot, uint32_t elapsedUs) {
stageProfiler.probe(slot, elapsedUs);
}
void WolfProfiler::frame() {
stageProfiler.increment(Fps);
}
const char* WolfProfiler::slotLabel(Slot slot) {
switch (slot) {
case Slot::Fps:
return "fps";
case Slot::Physics:
return "physics";
case Slot::Input:
return "input";
case Slot::ZombieUpdate:
return "zupd";
case Slot::HudAnim:
return "hudanim";
case Slot::Floor:
return "floor";
case Slot::World:
return "world";
case Slot::Sprites:
return "sprites";
case Slot::Weapon:
return "weapon";
case Slot::Minimap:
return "minimap";
case Slot::FpsOverlay:
return "fpsov";
case Slot::Present:
return "present";
case Slot::HudRender:
return "hudr";
case Slot::HudFlush:
return "hudf";
case Slot::Count:
return "count";
}
return "?";
}