MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / StartCPUProfile

Method StartCPUProfile

SampleFramework12/v1.00/Graphics/Profiler.cpp:136–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136uint64 Profiler::StartCPUProfile(const char* name)
137{
138 Assert_(name != nullptr);
139
140 uint64 profileIdx = uint64(-1);
141 for(uint64 i = 0; i < numCPUProfiles; ++i)
142 {
143 if(cpuProfiles[i].Name == name)
144 {
145 profileIdx = i;
146 break;
147 }
148 }
149
150 if(profileIdx == uint64(-1))
151 {
152 Assert_(numCPUProfiles < MaxProfiles);
153 profileIdx = numCPUProfiles++;
154 cpuProfiles[profileIdx].Name = name;
155 }
156
157 ProfileData& profileData = cpuProfiles[profileIdx];
158 Assert_(profileData.QueryStarted == false);
159 Assert_(profileData.QueryFinished == false);
160 profileData.CPUProfile = true;
161 profileData.Active = true;
162
163 timer.Update();
164 profileData.StartTime = timer.ElapsedMicroseconds();
165
166 profileData.QueryStarted = true;
167
168 return profileIdx;
169}
170
171void Profiler::EndCPUProfile(uint64 idx)
172{

Callers 1

CPUProfileBlockMethod · 0.80

Calls 2

ElapsedMicrosecondsMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected