| 3180 | } |
| 3181 | |
| 3182 | void PMTraceConsumer::HandlePclEvent(EVENT_RECORD* pEventRecord) |
| 3183 | { |
| 3184 | try { |
| 3185 | if (!mTraceLoggingDecoder.DecodeTraceLoggingEventRecord(pEventRecord)) { |
| 3186 | pmlog_dbg("Failed to decode trace logging event"); // too spammy? |
| 3187 | return; |
| 3188 | } |
| 3189 | |
| 3190 | auto eventName = mTraceLoggingDecoder.GetEventName(); |
| 3191 | if (!eventName.has_value()) { |
| 3192 | pmlog_warn("Could not get trace logging event name"); |
| 3193 | return; |
| 3194 | } |
| 3195 | |
| 3196 | if (eventName.has_value()) { |
| 3197 | if (eventName.value() == L"PCLStatsInit" || |
| 3198 | eventName.value() == L"ReflexStatsInit") { |
| 3199 | pmlog_info("Received init event: " + pmon::util::str::ToNarrow(*eventName)); |
| 3200 | } |
| 3201 | else if (eventName.value() == L"PCLStatsEvent" || |
| 3202 | eventName.value() == L"ReflexStatsEvent") { |
| 3203 | auto marker = (Nvidia_PCL::PCLMarker)mTraceLoggingDecoder.GetNumericPropertyValue<uint32_t>(L"Marker"); |
| 3204 | auto frameId = (uint32_t)mTraceLoggingDecoder.GetNumericPropertyValue<uint64_t>(L"FrameID"); |
| 3205 | switch (marker) { |
| 3206 | case Nvidia_PCL::PCLMarker::SimulationStart: { |
| 3207 | auto processId = pEventRecord->EventHeader.ProcessId; |
| 3208 | auto timestamp = pEventRecord->EventHeader.TimeStamp.QuadPart; |
| 3209 | auto key = std::make_pair(frameId, processId); |
| 3210 | auto ij = mPclTimingDataByPclFrameId.find(key); |
| 3211 | if (ij != mPclTimingDataByPclFrameId.end()) { |
| 3212 | ij->second.PclSimStartTime = timestamp; |
| 3213 | } else { |
| 3214 | AppTimingData data; |
| 3215 | data.PclSimStartTime = timestamp; |
| 3216 | data.ProcessId = processId; |
| 3217 | data.FrameId = frameId; |
| 3218 | mPclTimingDataByPclFrameId.emplace(key, data); |
| 3219 | } |
| 3220 | } |
| 3221 | break; |
| 3222 | case Nvidia_PCL::PCLMarker::SimulationEnd: { |
| 3223 | auto processId = pEventRecord->EventHeader.ProcessId; |
| 3224 | auto timestamp = pEventRecord->EventHeader.TimeStamp.QuadPart; |
| 3225 | auto key = std::make_pair(frameId, processId); |
| 3226 | auto ij = mPclTimingDataByPclFrameId.find(key); |
| 3227 | if (ij != mPclTimingDataByPclFrameId.end()) { |
| 3228 | ij->second.PclSimEndTime = timestamp; |
| 3229 | } else { |
| 3230 | AppTimingData data; |
| 3231 | data.PclSimEndTime = timestamp; |
| 3232 | data.ProcessId = processId; |
| 3233 | data.FrameId = frameId; |
| 3234 | mPclTimingDataByPclFrameId.emplace(key, data); |
| 3235 | } |
| 3236 | } |
| 3237 | break; |
| 3238 | case Nvidia_PCL::PCLMarker::RenderSubmitStart: { |
| 3239 | auto processId = pEventRecord->EventHeader.ProcessId; |
no test coverage detected