| 185 | } |
| 186 | |
| 187 | void DbgProfiler::ThreadProc() |
| 188 | { |
| 189 | //TODO: Do timing smarter, handle delays and slow stack traces and stuff |
| 190 | |
| 191 | //timeBeginPeriod(1); |
| 192 | |
| 193 | BF_ASSERT(mTotalVirtualSamples == 0); |
| 194 | |
| 195 | ProfileAddrEntry profileEntry; |
| 196 | |
| 197 | const int maxStackTrace = 1024; |
| 198 | addr_target stackTrace[maxStackTrace]; |
| 199 | |
| 200 | DWORD prevSampleTick = timeGetTime(); |
| 201 | uint32 accumMS = 0; |
| 202 | |
| 203 | int totalWait = 0; |
| 204 | int totalWait2 = 0; |
| 205 | int iterations = 0; |
| 206 | HashSet<int> idleThreadSet; |
| 207 | |
| 208 | while (true) |
| 209 | { |
| 210 | if (mWantsClear) |
| 211 | { |
| 212 | DoClear(); |
| 213 | |
| 214 | mTotalVirtualSamples = 0; |
| 215 | mTotalActualSamples = 0; |
| 216 | mTotalActiveSamplingMS = 0; |
| 217 | |
| 218 | mAlloc.Clear(); |
| 219 | mThreadInfo.Clear(); |
| 220 | mThreadIdList.Clear(); |
| 221 | mProfileAddrEntrySet.Clear(); |
| 222 | mProfileAddrEntries.Clear(); |
| 223 | mPendingProfileEntries.Clear(); |
| 224 | mProfileProcEntrySet.Clear(); |
| 225 | mProfileProcEntries.Clear(); |
| 226 | mProfileAddrToProcMap.Clear(); |
| 227 | mProcMap.Clear(); |
| 228 | mUniqueProcSet.Clear(); |
| 229 | mWantsClear = false; |
| 230 | |
| 231 | accumMS = 0; |
| 232 | prevSampleTick = timeGetTime(); |
| 233 | } |
| 234 | |
| 235 | iterations++; |
| 236 | DWORD startTick0 = timeGetTime(); |
| 237 | idleThreadSet.Clear(); |
| 238 | |
| 239 | SYSTEM_PROCESS_INFORMATION* processData = NULL; |
| 240 | std::unique_ptr<SYSTEM_PROCESS_INFORMATION> ptrDelete(processData); |
| 241 | |
| 242 | //processData = CaptureProcessInfo(); |
| 243 | |
| 244 | auto curProcessData = processData; |
no test coverage detected