| 1 | // Licensed to the .NET Foundation under one or more agreements. |
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | |
| 5 | /*============================================================ |
| 6 | ** |
| 7 | ** Source: test1.c |
| 8 | ** |
| 9 | ** Purpose: Test for QueryPerformanceFrequency function |
| 10 | ** |
| 11 | ** |
| 12 | **=========================================================*/ |
| 13 | |
| 14 | #include <palsuite.h> |
| 15 | |
| 16 | int __cdecl main(int argc, char *argv[]) |
| 17 | { |
| 18 | |
| 19 | LARGE_INTEGER Freq; |
| 20 | |
| 21 | /* Initialize the PAL. |
| 22 | */ |
| 23 | |
| 24 | if(0 != (PAL_Initialize(argc, argv))) |
| 25 | { |
| 26 | return FAIL; |
| 27 | } |
| 28 | |
| 29 | /* Check the return value of the performance |
| 30 | * frequency, a value of zero indicates that |
| 31 | * either the call has failed or the |
| 32 | * high-resolution performance counter is not |
| 33 | * installed. |
| 34 | */ |
| 35 | if (!QueryPerformanceFrequency(&Freq)) |
| 36 | { |
| 37 | |
| 38 | Fail("ERROR:%u:Unable to retrieve the frequency of the " |
| 39 | "high-resolution performance counter.\n" , |
| 40 | GetLastError()); |
| 41 | } |
| 42 | |
| 43 | |
| 44 | /* Check the return value the frequency the |
| 45 | * value should be non-zero. |
| 46 | */ |
| 47 | if (Freq.QuadPart == 0) |
| 48 | { |
| 49 | |
| 50 | Fail("ERROR: The frequency has been determined to be 0 " |
| 51 | "the frequency should be non-zero.\n" ); |
| 52 | |
| 53 | } |
| 54 | |
| 55 | /* Terminate the PAL. |
| 56 | */ |
| 57 | PAL_Terminate(); |
| 58 | return PASS; |
| 59 | } |
| 60 | |