mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
EmulatorPkg WinThunk: Use Win32 API to get Performance Frequency and Count
Then we can use correct TimerLib in another code, such as dpDynamicCommand(PerformanceLib). These API are from profileapi.h header and can refer to the link: https://learn.microsoft.com/en-us/windows/win32/api/profileapi/ Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
This commit is contained in:
parent
e12a8d83fa
commit
3299c36ba1
@ -5,7 +5,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
WinNtThunk.c
|
||||
WinThunk.c
|
||||
|
||||
Abstract:
|
||||
|
||||
@ -29,6 +29,8 @@ STATIC DWORD mOldStdInMode;
|
||||
STATIC DWORD mOldStdOutMode;
|
||||
#endif
|
||||
|
||||
STATIC UINT64 mPerformanceFrequency = 0;
|
||||
|
||||
UINTN
|
||||
SecWriteStdErr (
|
||||
IN UINT8 *Buffer,
|
||||
@ -451,8 +453,13 @@ SecQueryPerformanceFrequency (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
// Hard code to nanoseconds
|
||||
return 1000000000ULL;
|
||||
if (mPerformanceFrequency) {
|
||||
return mPerformanceFrequency;
|
||||
}
|
||||
|
||||
QueryPerformanceFrequency ((LARGE_INTEGER *)&mPerformanceFrequency);
|
||||
|
||||
return mPerformanceFrequency;
|
||||
}
|
||||
|
||||
UINT64
|
||||
@ -460,7 +467,11 @@ SecQueryPerformanceCounter (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
UINT64 PerformanceCount;
|
||||
|
||||
QueryPerformanceCounter ((LARGE_INTEGER *)&PerformanceCount);
|
||||
|
||||
return PerformanceCount;
|
||||
}
|
||||
|
||||
VOID
|
||||
|
Loading…
x
Reference in New Issue
Block a user