| 237 | } |
| 238 | |
| 239 | void VkCommandBufferManager::UpdateGpuStats() |
| 240 | { |
| 241 | uint64_t timestamps[MaxTimestampQueries]; |
| 242 | if (mNextTimestampQuery > 0) |
| 243 | mTimestampQueryPool->getResults(0, mNextTimestampQuery, sizeof(uint64_t) * mNextTimestampQuery, timestamps, sizeof(uint64_t), VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); |
| 244 | |
| 245 | double timestampPeriod = fb->device->PhysicalDevice.Properties.Properties.limits.timestampPeriod; |
| 246 | |
| 247 | gpuStatOutput = ""; |
| 248 | for (auto& q : timeElapsedQueries) |
| 249 | { |
| 250 | if (q.endIndex <= q.startIndex) |
| 251 | continue; |
| 252 | |
| 253 | int64_t timeElapsed = max(static_cast<int64_t>(timestamps[q.endIndex] - timestamps[q.startIndex]), (int64_t)0); |
| 254 | double timeNS = timeElapsed * timestampPeriod; |
| 255 | |
| 256 | FString out; |
| 257 | out.Format("%s=%04.2f ms\n", q.name.GetChars(), timeNS / 1000000.0f); |
| 258 | gpuStatOutput += out; |
| 259 | } |
| 260 | timeElapsedQueries.clear(); |
| 261 | mGroupStack.clear(); |
| 262 | |
| 263 | gpuStatActive = keepGpuStatActive; |
| 264 | keepGpuStatActive = false; |
| 265 | } |
no test coverage detected