23#define SAMPLE_FREQUENCY ((32768 << 1) >> RTC_MODE)
37 SumXX = (XMax * (XMax + 1) * (2*XMax + 1)) / 6;
41 for (SumXY = 0,
X = 1;
X <= XMax;
X++)
43 SumXY +=
X * (ArrayY[
X] - ArrayY[0]);
50 return (SumXY + (SumXX/2)) / SumXX;
58 PVOID PreviousHandler;
59 UCHAR RegisterA, RegisterB;
77 RegisterA = (RegisterA & 0xF0) |
RTC_MODE;
142 if (PerformanceFrequency)
#define APIC_CLOCK_VECTOR
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
BOOLEAN NTAPI HalEnableSystemInterrupt(IN ULONG Vector, IN KIRQL Irql, IN KINTERRUPT_MODE InterruptMode)
VOID NTAPI HalDisableSystemInterrupt(IN ULONG Vector, IN KIRQL Irql)
VOID NTAPI HalpWriteCmos(_In_ UCHAR Reg, _In_ UCHAR Value)
UCHAR NTAPI HalpReadCmos(_In_ UCHAR Reg)
void __cdecl _disable(void)
void __cdecl _enable(void)
#define _ReadWriteBarrier()
PPC_QUAL void __writemsr(const unsigned long Value)
PPC_QUAL unsigned long long __rdtsc(void)
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
__INTRIN_INLINE uintptr_t __readeflags(void)
static LARGE_INTEGER StartTime
#define KeStallExecutionProcessor(MicroSeconds)
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
#define INITIAL_STALL_COUNT
FORCEINLINE PVOID KeQueryInterruptHandler(IN ULONG Vector)
FORCEINLINE VOID KeRegisterInterruptHandler(IN ULONG Vector, IN PVOID Handler)
PULONG MinorVersion OPTIONAL
UCHAR TscCalibrationPhase
LARGE_INTEGER HalpCpuClockFrequency
ULONG64 TscCalibrationArray[NUM_SAMPLES]
VOID NTAPI HalpCalibrateStallExecution(VOID)
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(OUT PLARGE_INTEGER PerformanceFrequency OPTIONAL)
static ULONG64 DoLinearRegression(ULONG XMax, ULONG64 *ArrayY)
VOID NTAPI HalCalibratePerformanceCounter(IN volatile PLONG Count, IN ULONGLONG NewCount)
VOID NTAPI HalpInitializeTsc(void)
void __cdecl TscCalibrationISR(void)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
_Must_inspect_result_ _In_ ULONG Flags