summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/miscellaneous/queryperformancefrequency/test1/test1.c
blob: de08063a74e56f7236fbf2cbbbcc53243ab4c6f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

/*============================================================
**
** Source: test1.c
**
** Purpose: Test for QueryPerformanceFrequency function
**
**
**=========================================================*/

#include <palsuite.h>

int __cdecl main(int argc, char *argv[])
{

    LARGE_INTEGER Freq;

    /* Initialize the PAL.
     */

    if(0 != (PAL_Initialize(argc, argv)))
    {
        return FAIL;
    }

    /* Check the return value of the performance 
     * frequency, a value of zero indicates that 
     * either the call has failed or the 
     * high-resolution performance counter is not
     * installed.
     */
    if (!QueryPerformanceFrequency(&Freq))
    {
        
        Fail("ERROR:%u:Unable to retrieve the frequency of the "
             "high-resolution performance counter.\n", 
             GetLastError());
    }
    
    
    /* Check the return value the frequency the
     * value should be non-zero.
     */
    if (Freq.QuadPart == 0)
    {

        Fail("ERROR: The frequency has been determined to be 0 "
             "the frequency should be non-zero.\n");

    }
    
    /* Terminate the PAL.
     */  
    PAL_Terminate();
    return PASS;
}