xref: /reactos/dll/win32/kernel32/client/perfcnt.c (revision 9393fc32)
1 /*
2  * COPYRIGHT:            See COPYING in the top level directory
3  * PROJECT:              ReactOS Win32 Base API
4  * FILE:                 dll/win32/kernel32/client/perfcnt.c
5  * PURPOSE:              Performance Counter
6  * PROGRAMMER:           Eric Kohl
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include <k32.h>
12 
13 #define NDEBUG
14 #include <debug.h>
15 
16 /* FUNCTIONS ******************************************************************/
17 
18 /*
19  * @implemented
20  */
21 BOOL
22 WINAPI
QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)23 QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
24 {
25     LARGE_INTEGER Frequency;
26     NTSTATUS Status;
27 
28     Status = NtQueryPerformanceCounter(lpPerformanceCount, &Frequency);
29     if (Frequency.QuadPart == 0) Status = STATUS_NOT_IMPLEMENTED;
30 
31     if (!NT_SUCCESS(Status))
32     {
33         BaseSetLastNTError(Status);
34         return FALSE;
35     }
36 
37     return TRUE;
38 }
39 
40 /*
41  * @implemented
42  */
43 BOOL
44 WINAPI
QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)45 QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
46 {
47     LARGE_INTEGER Count;
48     NTSTATUS Status;
49 
50     Status = NtQueryPerformanceCounter(&Count, lpFrequency);
51     if (lpFrequency->QuadPart == 0) Status = STATUS_NOT_IMPLEMENTED;
52 
53     if (!NT_SUCCESS(Status))
54     {
55         BaseSetLastNTError(Status);
56         return FALSE;
57     }
58 
59     return TRUE;
60 }
61 
62 /* EOF */
63