@@ -492,9 +492,6 @@ BOOLEAN EtPerfCounterParseGpuAdapterDedicatedPerfCounterInstance(
492
492
PH_STRINGREF remainingPart ;
493
493
LONG64 engineLuidLow ;
494
494
495
- if (!EtGpuAdapterDedicatedHashTable )
496
- return FALSE;
497
-
498
495
// luid_0x00000000_0x0000C4CF_phys_0
499
496
PhInitializeStringRefLongHint (& remainingPart , InstanceName );
500
497
PhSkipStringRef (& remainingPart , 5 * sizeof (WCHAR ));
@@ -522,6 +519,9 @@ PET_GPU_ENGINE_PERFCOUNTER EtPerfCounterAddOrUpdateGpuEngineCounters(
522
519
ET_GPU_ENGINE_PERFCOUNTER lookupEntry ;
523
520
PET_GPU_ENGINE_PERFCOUNTER entry ;
524
521
522
+ if (!EtPerfCounterEngineInstanceHashTable )
523
+ return NULL ;
524
+
525
525
lookupEntry .InstanceId = CounterInstance .InstanceId ;
526
526
527
527
if (entry = PhFindEntryHashtable (EtPerfCounterEngineInstanceHashTable , & lookupEntry ))
@@ -589,6 +589,9 @@ PET_GPU_PROCESS_PERFCOUNTER EtPerfCounterAddOrUpdateGpuProcessCounters(
589
589
ET_GPU_PROCESS_PERFCOUNTER lookupEntry ;
590
590
PET_GPU_PROCESS_PERFCOUNTER entry ;
591
591
592
+ if (!EtPerfCounterProcessInstanceHashTable )
593
+ return NULL ;
594
+
592
595
lookupEntry .InstanceId = CounterInstance .InstanceId ;
593
596
594
597
if (entry = PhFindEntryHashtable (EtPerfCounterProcessInstanceHashTable , & lookupEntry ))
@@ -633,6 +636,9 @@ PET_GPU_ADAPTER_PERFCOUNTER EtPerfCounterAddOrUpdateGpuAdapterCounters(
633
636
ET_GPU_ADAPTER_PERFCOUNTER lookupEntry ;
634
637
PET_GPU_ADAPTER_PERFCOUNTER entry ;
635
638
639
+ if (!EtPerfCounterAdapterInstanceHashTable )
640
+ return NULL ;
641
+
636
642
lookupEntry .InstanceId = CounterInstance .InstanceId ;
637
643
638
644
if (entry = PhFindEntryHashtable (EtPerfCounterAdapterInstanceHashTable , & lookupEntry ))
@@ -1041,6 +1047,21 @@ BOOLEAN EtPerfCounterGetCounterData(
1041
1047
ULONG bufferSize ;
1042
1048
PPERF_DATA_HEADER buffer ;
1043
1049
1050
+ {
1051
+ static ULONG64 lastTickCount = 0 ;
1052
+ ULONG64 tickCount = NtGetTickCount64 ();
1053
+
1054
+ if (lastTickCount == 0 )
1055
+ lastTickCount = tickCount ;
1056
+
1057
+ if (tickCount - lastTickCount >= 600 * 1000 )
1058
+ {
1059
+ lastTickCount = tickCount ;
1060
+ // Reset initial buffer size.
1061
+ initialBufferSize = 0x4000 ;
1062
+ }
1063
+ }
1064
+
1044
1065
bufferSize = initialBufferSize ;
1045
1066
buffer = PhAllocate (bufferSize );
1046
1067
@@ -1197,18 +1218,11 @@ VOID EtPerfCounterInitialization(
1197
1218
VOID
1198
1219
)
1199
1220
{
1200
- static PH_INITONCE initOnce = PH_INITONCE_INIT ;
1201
-
1202
- if (PhBeginInitOnce (& initOnce ))
1203
- {
1204
- EtGpuCreatePerfCounterHashTables ();
1205
- EtGpuCreatePerfCounterHashTable ();
1206
- //PhCreateThread2(EtPerfCounterQueryThread, NULL);
1207
-
1208
- PhEndInitOnce (& initOnce );
1209
- }
1221
+ EtGpuCreatePerfCounterHashTables ();
1222
+ EtGpuCreatePerfCounterHashTable ();
1210
1223
}
1211
1224
1225
+ _Success_ (return )
1212
1226
BOOLEAN EtPerfCounterOpenHandle (
1213
1227
_Out_ PHANDLE PerfQueryHandle
1214
1228
)
0 commit comments