Skip to content

Fix build break for paltests #115877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/coreclr/pal/tests/palsuite/common/palsuite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ char* convertC(const WCHAR * wString)
return MultiBuffer;
}

UINT64 GetHighPrecisionTimeStamp(LARGE_INTEGER performanceFrequency)
{
return (UINT64)minipal_hires_ticks();
}

static const char* rgchPathDelim = "/";


Expand Down
1 change: 0 additions & 1 deletion src/coreclr/pal/tests/palsuite/common/palsuite.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ inline ULONG VAL32(ULONG x)

WCHAR* convert(const char * aString);
char* convertC(const WCHAR * wString);
UINT64 GetHighPrecisionTimeStamp(LARGE_INTEGER performanceFrequency);

extern const char* szTextFile;

Expand Down
14 changes: 4 additions & 10 deletions src/coreclr/pal/tests/palsuite/threading/Sleep/test1/Sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ PALTEST(threading_Sleep_test1_paltest_sleep_test1, "threading/Sleep/test1/paltes
/* Milliseconds of error which are acceptable Function execution time, etc. */
DWORD AcceptableTimeError = 150;

UINT64 OldTimeStamp;
UINT64 NewTimeStamp;
int64_t OldTimeStamp;
int64_t NewTimeStamp;
DWORD MaxDelta;
DWORD TimeDelta;
DWORD i;
Expand All @@ -43,17 +43,11 @@ PALTEST(threading_Sleep_test1_paltest_sleep_test1, "threading/Sleep/test1/paltes
return ( FAIL );
}

LARGE_INTEGER performanceFrequency;
if (!QueryPerformanceFrequency(&performanceFrequency))
{
return FAIL;
}

for( i = 0; i < sizeof(SleepTimes) / sizeof(DWORD); i++)
{
OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
OldTimeStamp = minipal_lowres_ticks();
Sleep(SleepTimes[i]);
NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
NewTimeStamp = minipal_lowres_ticks();

TimeDelta = NewTimeStamp - OldTimeStamp;

Expand Down
14 changes: 4 additions & 10 deletions src/coreclr/pal/tests/palsuite/threading/Sleep/test2/sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ PALTEST(threading_Sleep_test2_paltest_sleep_test2, "threading/Sleep/test2/paltes
/* Milliseconds of error which are acceptable Function execution time, etc. */
DWORD AcceptableTimeError = 150;

UINT64 OldTimeStamp;
UINT64 NewTimeStamp;
int64_t OldTimeStamp;
int64_t NewTimeStamp;
DWORD MaxDelta;
DWORD TimeDelta;
DWORD i;
Expand All @@ -42,17 +42,11 @@ PALTEST(threading_Sleep_test2_paltest_sleep_test2, "threading/Sleep/test2/paltes
return ( FAIL );
}

LARGE_INTEGER performanceFrequency;
if (!QueryPerformanceFrequency(&performanceFrequency))
{
return FAIL;
}

for( i = 0; i < sizeof(SleepTimes) / sizeof(DWORD); i++)
{
OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
OldTimeStamp = minipal_lowres_ticks();
Sleep(SleepTimes[i]);
NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
NewTimeStamp = minipal_lowres_ticks();

TimeDelta = NewTimeStamp - OldTimeStamp;

Expand Down
14 changes: 4 additions & 10 deletions src/coreclr/pal/tests/palsuite/threading/SleepEx/test1/test1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ PALTEST(threading_SleepEx_test1_paltest_sleepex_test1, "threading/SleepEx/test1/
{2000, TRUE},
};

UINT64 OldTimeStamp;
UINT64 NewTimeStamp;
int64_t OldTimeStamp;
int64_t NewTimeStamp;
DWORD MaxDelta;
DWORD TimeDelta;
DWORD i;
Expand All @@ -50,19 +50,13 @@ PALTEST(threading_SleepEx_test1_paltest_sleepex_test1, "threading/SleepEx/test1/
return FAIL;
}

LARGE_INTEGER performanceFrequency;
if (!QueryPerformanceFrequency(&performanceFrequency))
{
return FAIL;
}

for (i = 0; i<sizeof(testCases) / sizeof(testCases[0]); i++)
{
OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
OldTimeStamp = minipal_lowres_ticks();

SleepEx(testCases[i].SleepTime, testCases[i].Alertable);

NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
NewTimeStamp = minipal_lowres_ticks();

TimeDelta = NewTimeStamp - OldTimeStamp;

Expand Down
14 changes: 4 additions & 10 deletions src/coreclr/pal/tests/palsuite/threading/SleepEx/test2/test2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,25 +155,19 @@ VOID PALAPI APCFunc_SleepEx_test2(ULONG_PTR dwParam)
/* Entry Point for child thread. */
DWORD PALAPI SleeperProc_SleepEx_test2(LPVOID lpParameter)
{
UINT64 OldTimeStamp;
UINT64 NewTimeStamp;
int64_t OldTimeStamp;
int64_t NewTimeStamp;
BOOL Alertable;
DWORD ret;

Alertable = (BOOL)(SIZE_T) lpParameter;

LARGE_INTEGER performanceFrequency;
if (!QueryPerformanceFrequency(&performanceFrequency))
{
return FAIL;
}

OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
OldTimeStamp = minipal_lowres_ticks();
s_preWaitTimestampRecorded = true;

ret = SleepEx(ChildThreadSleepTime, Alertable);

NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
NewTimeStamp = minipal_lowres_ticks();

if (Alertable && ret != WAIT_IO_COMPLETION)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ VOID PALAPI APCFunc_WFMO_test2(ULONG_PTR dwParam)
DWORD PALAPI WaiterProc_WFMO_test2(LPVOID lpParameter)
{
HANDLE Semaphore;
UINT64 OldTimeStamp;
UINT64 NewTimeStamp;
int64_t OldTimeStamp;
int64_t NewTimeStamp;
BOOL Alertable;
DWORD ret;

Expand All @@ -156,19 +156,13 @@ DWORD PALAPI WaiterProc_WFMO_test2(LPVOID lpParameter)

Alertable = (BOOL)(SIZE_T) lpParameter;

LARGE_INTEGER performanceFrequency;
if (!QueryPerformanceFrequency(&performanceFrequency))
{
Fail("Failed to query performance frequency!");
}

OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
OldTimeStamp = minipal_lowres_ticks();
s_preWaitTimestampRecorded = true;

ret = WaitForMultipleObjectsEx(1, &Semaphore, FALSE, ChildThreadWaitTime,
Alertable);

NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
NewTimeStamp = minipal_lowres_ticks();


if (Alertable && ret != WAIT_IO_COMPLETION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,27 +177,21 @@ VOID PALAPI APCFunc_WFSOExMutexTest(ULONG_PTR dwParam)
/* Entry Point for child thread. */
DWORD PALAPI WaiterProc_WFSOExMutexTest(LPVOID lpParameter)
{
UINT64 OldTimeStamp;
UINT64 NewTimeStamp;
int64_t OldTimeStamp;
int64_t NewTimeStamp;
BOOL Alertable;
DWORD ret;

Alertable = (BOOL)(SIZE_T) lpParameter;

LARGE_INTEGER performanceFrequency;
if (!QueryPerformanceFrequency(&performanceFrequency))
{
Fail("Failed to query performance frequency!");
}

OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
OldTimeStamp = minipal_lowres_ticks();
s_preWaitTimestampRecorded = true;

ret = WaitForSingleObjectEx( hMutex_WFSOExMutexTest,
ChildThreadWaitTime,
Alertable);

NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
NewTimeStamp = minipal_lowres_ticks();

if (Alertable && ret != WAIT_IO_COMPLETION)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,11 @@ VOID PALAPI APCFunc_WFSOExSemaphoreTest(ULONG_PTR dwParam)
DWORD PALAPI WaiterProc_WFSOExSemaphoreTest(LPVOID lpParameter)
{
HANDLE hSemaphore;
UINT64 OldTimeStamp;
UINT64 NewTimeStamp;
int64_t OldTimeStamp;
int64_t NewTimeStamp;
BOOL Alertable;
DWORD ret;

LARGE_INTEGER performanceFrequency;
if (!QueryPerformanceFrequency(&performanceFrequency))
{
Fail("Failed to query performance frequency!");
}

/* Create a semaphore that is not in the signalled state */
hSemaphore = CreateSemaphoreExW(NULL, 0, 1, NULL, 0, 0);

Expand All @@ -155,14 +149,14 @@ DWORD PALAPI WaiterProc_WFSOExSemaphoreTest(LPVOID lpParameter)

Alertable = (BOOL)(SIZE_T) lpParameter;

OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
OldTimeStamp = minipal_lowres_ticks();
s_preWaitTimestampRecorded = true;

ret = WaitForSingleObjectEx( hSemaphore,
ChildThreadWaitTime,
Alertable);

NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
NewTimeStamp = minipal_lowres_ticks();


if (Alertable && ret != WAIT_IO_COMPLETION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ VOID PALAPI APCFunc_WFSOExThreadTest(ULONG_PTR dwParam)
DWORD PALAPI WaiterProc_WFSOExThreadTest(LPVOID lpParameter)
{
HANDLE hWaitThread;
UINT64 OldTimeStamp;
UINT64 NewTimeStamp;
int64_t OldTimeStamp;
int64_t NewTimeStamp;
BOOL Alertable;
DWORD ret;
DWORD dwThreadId = 0;
Expand All @@ -163,20 +163,14 @@ satisfying any threads that were waiting on the object.

Alertable = (BOOL)(SIZE_T) lpParameter;

LARGE_INTEGER performanceFrequency;
if (!QueryPerformanceFrequency(&performanceFrequency))
{
Fail("Failed to query performance frequency!");
}

OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
OldTimeStamp = minipal_lowres_ticks();
s_preWaitTimestampRecorded = true;

ret = WaitForSingleObjectEx( hWaitThread,
ChildThreadWaitTime,
Alertable);

NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency);
NewTimeStamp = minipal_lowres_ticks();


if (Alertable && ret != WAIT_IO_COMPLETION)
Expand Down
Loading