| 134 | } |
| 135 | |
| 136 | uint64 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 | |
| 171 | void Profiler::EndCPUProfile(uint64 idx) |
| 172 | { |
no test coverage detected