Commit edc479ee authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

kernelbase: Implement and add tests for QueryProcessCycleTime.

parent c0ffd587
......@@ -1074,10 +1074,13 @@ BOOL WINAPI DECLSPEC_HOTPATCH ProcessIdToSessionId( DWORD pid, DWORD *id )
*/
BOOL WINAPI DECLSPEC_HOTPATCH QueryProcessCycleTime( HANDLE process, ULONG64 *cycle )
{
static int once;
if (!once++) FIXME( "(%p,%p): stub!\n", process, cycle );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return FALSE;
PROCESS_CYCLE_TIME_INFORMATION time;
if (!set_ntstatus( NtQueryInformationProcess( process, ProcessCycleTime, &time, sizeof(time), NULL ) ))
return FALSE;
*cycle = time.AccumulatedCycles;
return TRUE;
}
......
......@@ -421,6 +421,21 @@ static void test_MapViewOfFileFromApp(void)
ok(ret, "Failed to delete a test file.\n");
}
static void test_QueryProcessCycleTime(void)
{
ULONG64 cycles1, cycles2;
BOOL ret;
ret = QueryProcessCycleTime( GetCurrentProcess(), &cycles1 );
ok( ret, "QueryProcessCycleTime failed, error %lu.\n", GetLastError() );
ret = QueryProcessCycleTime( GetCurrentProcess(), &cycles2 );
ok( ret, "QueryProcessCycleTime failed, error %lu.\n", GetLastError() );
todo_wine
ok( cycles2 > cycles1, "CPU cycles used by process should be increasing.\n" );
}
static void init_funcs(void)
{
HMODULE hmod = GetModuleHandleA("kernelbase.dll");
......@@ -453,4 +468,5 @@ START_TEST(process)
test_OpenFileMappingFromApp();
test_CreateFileMappingFromApp();
test_MapViewOfFileFromApp();
test_QueryProcessCycleTime();
}
......@@ -2605,6 +2605,7 @@ WINBASEAPI BOOL WINAPI QueryInformationJobObject(HANDLE,JOBOBJECTINFOCLAS
WINBASEAPI BOOL WINAPI QueryMemoryResourceNotification(HANDLE,PBOOL);
WINBASEAPI BOOL WINAPI QueryPerformanceCounter(LARGE_INTEGER*);
WINBASEAPI BOOL WINAPI QueryPerformanceFrequency(LARGE_INTEGER*);
WINBASEAPI BOOL WINAPI QueryProcessCycleTime(HANDLE,PULONG64);
WINBASEAPI BOOL WINAPI QueryThreadCycleTime(HANDLE,PULONG64);
WINBASEAPI BOOL WINAPI QueryUmsThreadInformation(PUMS_CONTEXT,UMS_THREAD_INFO_CLASS,PVOID,ULONG,PULONG);
WINBASEAPI DWORD WINAPI QueueUserAPC(PAPCFUNC,HANDLE,ULONG_PTR);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment