Update PhQueryPerformanceCounter typedefs

This commit is contained in:
dmex
2023-02-10 05:18:57 +11:00
parent 58061bb15a
commit ff2d8b02d7
11 changed files with 38 additions and 57 deletions
+2 -1
View File
@@ -470,7 +470,8 @@ static VOID PhStartStopwatch(
_Inout_ PSTOPWATCH Stopwatch
)
{
NtQueryPerformanceCounter(&Stopwatch->StartCounter, &Stopwatch->Frequency);
PhQueryPerformanceCounter(&Stopwatch->StartCounter);
PhQueryPerformanceFrequency(&Stopwatch->Frequency);
}
static VOID PhStopStopwatch(
+17 -39
View File
@@ -1261,7 +1261,7 @@ VOID PhGenerateGuid(
ULONG random[6];
ULONG i;
PhQueryPerformanceCounter(&seed, NULL);
PhQueryPerformanceCounter(&seed);
for (i = 0; i < 6; i++)
random[i] = RtlRandomEx(&seed.LowPart);
@@ -1374,7 +1374,7 @@ VOID PhGenerateRandomAlphaString(
if (Count == 0)
return;
PhQueryPerformanceCounter(&seed, NULL);
PhQueryPerformanceCounter(&seed);
for (i = 0; i < Count - 1; i++)
{
@@ -1390,7 +1390,7 @@ ULONG64 PhGenerateRandomNumber64(
{
LARGE_INTEGER seed;
PhQueryPerformanceCounter(&seed, NULL);
PhQueryPerformanceCounter(&seed);
return (ULONG64)RtlRandomEx(&seed.LowPart) | ((ULONG64)RtlRandomEx(&seed.LowPart) << 31);
}
@@ -7409,50 +7409,28 @@ ULONGLONG PhReadTimeStampCounter(
return ReadTimeStampCounter();
}
VOID PhQueryPerformanceCounter(
_Out_ PLARGE_INTEGER PerformanceCounter,
_Out_opt_ PLARGE_INTEGER PerformanceFrequency
// rev from QueryPerformanceCounter (dmex)
BOOLEAN PhQueryPerformanceCounter(
_Out_ PLARGE_INTEGER PerformanceCounter
)
{
if (PerformanceFrequency)
{
RtlQueryPerformanceFrequency(PerformanceFrequency);
}
RtlQueryPerformanceCounter(PerformanceCounter);
//if (RtlQueryPerformanceCounter(PerformanceCounter))
//{
// if (PerformanceFrequency)
// {
// if (RtlQueryPerformanceFrequency(PerformanceFrequency))
// return TRUE;
// }
// else
// {
// return TRUE;
// }
//}
//
//return NT_SUCCESS(NtQueryPerformanceCounter(PerformanceCounter, PerformanceFrequency));
if (RtlQueryPerformanceCounter(PerformanceCounter))
return TRUE;
return NT_SUCCESS(NtQueryPerformanceCounter(PerformanceCounter, NULL));
}
VOID PhQueryPerformanceFrequency(
// rev from QueryPerformanceFrequency (dmex)
BOOLEAN PhQueryPerformanceFrequency(
_Out_ PLARGE_INTEGER PerformanceFrequency
)
{
RtlQueryPerformanceFrequency(PerformanceFrequency);
LARGE_INTEGER performanceCounter;
//if (RtlQueryPerformanceFrequency(PerformanceFrequency))
//{
// return TRUE;
//}
//else
//{
// LARGE_INTEGER performanceCounter;
//
// return NT_SUCCESS(NtQueryPerformanceCounter(&performanceCounter, PerformanceFrequency));
//}
if (RtlQueryPerformanceFrequency(PerformanceFrequency))
return TRUE;
return NT_SUCCESS(NtQueryPerformanceCounter(&performanceCounter, PerformanceFrequency));
}
PPH_STRING PhApiSetResolveToHost(
@@ -48,7 +48,7 @@ static void CheckForTerminatedRealtimeProcesses(
)
{
LARGE_INTEGER performanceCounter;
PhQueryPerformanceCounter(&performanceCounter, nullptr);
PhQueryPerformanceCounter(&performanceCounter);
terminatedProcesses->emplace_back(processId, performanceCounter.QuadPart);
PhClearReference(reinterpret_cast<PVOID*>(&processInfo->ProcessItem));
@@ -356,7 +356,8 @@ BOOLEAN StartFpsTraceSession(
{
ULONG status;
PhQueryPerformanceCounter(&TraceStartQpc, &TraceFrequencyQpc);
PhQueryPerformanceCounter(&TraceStartQpc);
PhQueryPerformanceFrequency(&TraceStartQpc);
TraceProperties sessionProps = {};
sessionProps.Wnode.BufferSize = (ULONG)sizeof(TraceProperties);
+2 -1
View File
@@ -76,7 +76,8 @@ VOID EtInitializeDiskInformation(
RtlInitializeSListHead(&EtDiskPacketListHead);
EtFileNameHashtable = PhCreateSimpleHashtable(128);
PhQueryPerformanceCounter(&performanceCounter, &EtpPerformanceFrequency);
PhQueryPerformanceCounter(&performanceCounter);
PhQueryPerformanceFrequency(&EtpPerformanceFrequency);
EtDiskEnabled = TRUE;
+2 -2
View File
@@ -6,7 +6,7 @@
* Authors:
*
* wj32 2011-2015
* dmex 2016-2022
* dmex 2016-2023
*
*/
@@ -1043,7 +1043,7 @@ VOID EtpUpdateSystemNodeInformation(
}
}
PhQueryPerformanceCounter(&performanceCounter, &EtClockTotalRunningTimeFrequency);
PhQueryPerformanceCounter(&performanceCounter);
PhUpdateDelta(&EtClockTotalRunningTimeDelta, performanceCounter.QuadPart);
}
+1 -2
View File
@@ -5,13 +5,12 @@
*
* Authors:
*
* dmex 2016-2022
* dmex 2016-2023
*
*/
#include "exttools.h"
#include "poolmon.h"
#include "commonutil.h"
static HWND EtPoolTagDialogHandle = NULL;
static HANDLE EtPoolTagDialogThreadHandle = NULL;
+1 -1
View File
@@ -243,7 +243,7 @@ VOID GraphicsDevicesUpdate(
PhUpdateDelta(&entry->TotalRunningTimeNodesDelta[n], runningTime);
}
PhQueryPerformanceCounter(&performanceCounter, NULL);
PhQueryPerformanceCounter(&performanceCounter);
PhUpdateDelta(&entry->TotalRunningTimeDelta, performanceCounter.QuadPart);
DOUBLE elapsedTime = (DOUBLE)entry->TotalRunningTimeDelta.Delta * 10000000 / GraphicsTotalRunningTimeFrequency.QuadPart;
+4 -4
View File
@@ -112,7 +112,7 @@ NTSTATUS NetworkPingThreadStart(
icmpReplyBuffer = PhAllocateZero(icmpReplyLength);
InterlockedIncrement(&context->PingSentCount);
PhQueryPerformanceCounter(&performanceCounterStart, NULL);
PhQueryPerformanceCounter(&performanceCounterStart);
icmpReplyCount = Icmp6SendEcho2(
icmpHandle,
@@ -129,7 +129,7 @@ NTSTATUS NetworkPingThreadStart(
context->Timeout
);
PhQueryPerformanceCounter(&performanceCounterEnd, NULL);
PhQueryPerformanceCounter(&performanceCounterEnd);
icmp6ReplyStruct = (PICMPV6_ECHO_REPLY2)icmpReplyBuffer;
if (icmpReplyCount && icmp6ReplyStruct->Status == IP_SUCCESS)
@@ -187,7 +187,7 @@ NTSTATUS NetworkPingThreadStart(
icmpReplyBuffer = PhAllocateZero(icmpReplyLength);
InterlockedIncrement(&context->PingSentCount);
PhQueryPerformanceCounter(&performanceCounterStart, NULL);
PhQueryPerformanceCounter(&performanceCounterStart);
icmpReplyCount = IcmpSendEcho2Ex(
icmpHandle,
@@ -204,7 +204,7 @@ NTSTATUS NetworkPingThreadStart(
context->Timeout
);
PhQueryPerformanceCounter(&performanceCounterEnd, NULL);
PhQueryPerformanceCounter(&performanceCounterEnd);
icmpReplyStruct = (PICMP_ECHO_REPLY)icmpReplyBuffer;
if (icmpReplyCount && icmpReplyStruct->Status == IP_SUCCESS)
+4 -4
View File
@@ -498,7 +498,7 @@ NTSTATUS NetworkTracertThreadStart(
icmpReplyLength = ICMP_BUFFER_SIZE(sizeof(ICMP_ECHO_REPLY), icmpEchoBuffer->Length);
icmpReplyBuffer = PhAllocateZero(icmpReplyLength);
PhQueryPerformanceCounter(&performanceCounterStart, NULL);
PhQueryPerformanceCounter(&performanceCounterStart);
icmpReplyCount = IcmpSendEcho2Ex(
icmpHandle,
@@ -515,7 +515,7 @@ NTSTATUS NetworkTracertThreadStart(
context->Timeout
);
PhQueryPerformanceCounter(&performanceCounterEnd, NULL);
PhQueryPerformanceCounter(&performanceCounterEnd);
if (icmpReplyCount > 0)
{
@@ -579,7 +579,7 @@ NTSTATUS NetworkTracertThreadStart(
icmpReplyLength = ICMP_BUFFER_SIZE(sizeof(ICMPV6_ECHO_REPLY), icmpEchoBuffer->Length);
icmpReplyBuffer = PhAllocateZero(icmpReplyLength);
PhQueryPerformanceCounter(&performanceCounterStart, NULL);
PhQueryPerformanceCounter(&performanceCounterStart);
icmpReplyCount = Icmp6SendEcho2(
icmpHandle,
@@ -596,7 +596,7 @@ NTSTATUS NetworkTracertThreadStart(
context->Timeout
);
PhQueryPerformanceCounter(&performanceCounterEnd, NULL);
PhQueryPerformanceCounter(&performanceCounterEnd);
if (icmpReplyCount > 0)
{
+2 -1
View File
@@ -512,7 +512,8 @@ BOOLEAN CheckRebarLastRedrawMessage(
LARGE_INTEGER currentUpdateTimeTicks;
LARGE_INTEGER currentUpdateTimeFrequency;
PhQueryPerformanceCounter(&currentUpdateTimeTicks, &currentUpdateTimeFrequency);
PhQueryPerformanceCounter(&currentUpdateTimeTicks);
PhQueryPerformanceFrequency(&currentUpdateTimeFrequency);
if (lastUpdateTimeTicks.QuadPart == 0)
lastUpdateTimeTicks.QuadPart = currentUpdateTimeTicks.QuadPart;