|
16 | 16 | #include "ETW/Microsoft_Windows_Win32k.h"
|
17 | 17 | #include "ETW/NT_Process.h"
|
18 | 18 |
|
| 19 | +#include "../IntelPresentMon/CommonUtilities/Meta.h" |
| 20 | + |
19 | 21 | #include <assert.h>
|
20 | 22 | #include <dxgi.h>
|
21 | 23 |
|
@@ -224,21 +226,8 @@ void PrintEventHeaderHelper_(EVENT_RECORD* eventRecord, EventMetadata* metadata,
|
224 | 226 | {
|
225 | 227 | wprintf(L" %s=", propName);
|
226 | 228 |
|
227 |
| - const auto propFuncVoid = reinterpret_cast<const void*>(propFunc); |
228 |
| - if (propFuncVoid == reinterpret_cast<const void*>(PrintBool)) PrintBool(metadata->GetEventData<uint32_t>(eventRecord, propName) != 0); |
229 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintU32)) PrintU32(metadata->GetEventData<uint32_t>(eventRecord, propName)); |
230 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintU64)) PrintU64(metadata->GetEventData<uint64_t>(eventRecord, propName)); |
231 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintU64x)) PrintU64x(metadata->GetEventData<uint64_t>(eventRecord, propName)); |
232 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintString)) PrintString(metadata->GetEventData<std::string>(eventRecord, propName)); |
233 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintWString)) PrintWString(metadata->GetEventData<std::wstring>(eventRecord, propName)); |
234 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintTime)) PrintTime(metadata->GetEventData<uint64_t>(eventRecord, propName)); |
235 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintTimeDelta)) PrintTimeDelta(metadata->GetEventData<uint64_t>(eventRecord, propName)); |
236 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintQueuePacketType)) PrintQueuePacketType(metadata->GetEventData<uint32_t>(eventRecord, propName)); |
237 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintDmaPacketType)) PrintDmaPacketType(metadata->GetEventData<uint32_t>(eventRecord, propName)); |
238 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintPresentFlags)) PrintPresentFlags(metadata->GetEventData<uint32_t>(eventRecord, propName)); |
239 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintPresentHistoryModel)) PrintPresentHistoryModel(metadata->GetEventData<uint32_t>(eventRecord, propName)); |
240 |
| - else if (propFuncVoid == reinterpret_cast<const void*>(PrintInputType)) PrintInputType(metadata->GetEventData<uint8_t>(eventRecord, propName)); |
241 |
| - else assert(false && "unknown prop function for verbose PrintEventHeader"); |
| 229 | + using ParamType = pmon::util::FunctionPtrTraits<F>::template ParameterType<0>; |
| 230 | + propFunc(metadata->GetEventData<std::remove_cvref_t<ParamType>>(eventRecord, propName)); |
242 | 231 |
|
243 | 232 | if constexpr (sizeof...(T)) {
|
244 | 233 | PrintEventHeaderHelper_(eventRecord, metadata, rest...);
|
|
0 commit comments