1 | /* $Id: MemInfoTest.c,v 1.1 2001-02-11 15:25:51 bird Exp $
|
---|
2 | *
|
---|
3 | * Test program for the k32/W32kQuerySystemMemInfo IOCtl.
|
---|
4 | *
|
---|
5 | * Copyright (c) 2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
6 | *
|
---|
7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
8 | *
|
---|
9 | */
|
---|
10 |
|
---|
11 | /*******************************************************************************
|
---|
12 | * Defined Constants And Macros *
|
---|
13 | *******************************************************************************/
|
---|
14 | #define INCL_BASE
|
---|
15 |
|
---|
16 | /*******************************************************************************
|
---|
17 | * Header Files *
|
---|
18 | *******************************************************************************/
|
---|
19 | #include <os2.h>
|
---|
20 |
|
---|
21 | #include <stdio.h>
|
---|
22 | #include <string.h>
|
---|
23 |
|
---|
24 | #include "win32k.h"
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 | int main(void)
|
---|
29 | {
|
---|
30 | APIRET rc;
|
---|
31 |
|
---|
32 | rc = libWin32kInit();
|
---|
33 | if (rc)
|
---|
34 | {
|
---|
35 | fprintf(stderr, "Win32k init failed with rc=0x%x(%d)\n", rc, rc);
|
---|
36 | return rc;
|
---|
37 | }
|
---|
38 |
|
---|
39 | for (;;)
|
---|
40 | {
|
---|
41 | K32SYSTEMMEMINFO MemInfo;
|
---|
42 |
|
---|
43 | memset(&MemInfo, 0xFE, sizeof(MemInfo));
|
---|
44 | MemInfo.cb = sizeof(K32SYSTEMMEMINFO);
|
---|
45 | MemInfo.flFlags = K32_SYSMEMINFO_ALL;
|
---|
46 | rc = W32kQuerySystemMemInfo(&MemInfo);
|
---|
47 | if (rc)
|
---|
48 | {
|
---|
49 | fprintf(stderr, "W32kQuerySystemMemInfo failed with rc=0x%x(%d)\n", rc, rc);
|
---|
50 | break;
|
---|
51 | }
|
---|
52 |
|
---|
53 | printf("\n"
|
---|
54 | " * Swap File *\n"
|
---|
55 | " -------------\n");
|
---|
56 | printf(" fSwapFile 0x%08x (%d)\n", MemInfo.fSwapFile , MemInfo.fSwapFile);
|
---|
57 | printf(" cbSwapFileSize 0x%08x (%d)\n", MemInfo.cbSwapFileSize , MemInfo.cbSwapFileSize);
|
---|
58 | printf(" cbSwapFileAvail 0x%08x (%d)\n", MemInfo.cbSwapFileAvail , MemInfo.cbSwapFileAvail);
|
---|
59 | printf(" cbSwapFileUsed 0x%08x (%d)\n", MemInfo.cbSwapFileUsed , MemInfo.cbSwapFileUsed);
|
---|
60 | printf(" cbSwapFileMinFree 0x%08x (%d)\n", MemInfo.cbSwapFileMinFree , MemInfo.cbSwapFileMinFree);
|
---|
61 | printf(" cbSwapFileCFGMinFree 0x%08x (%d)\n", MemInfo.cbSwapFileCFGMinFree , MemInfo.cbSwapFileCFGMinFree);
|
---|
62 | printf(" cbSwapFileCFGSwapSize 0x%08x (%d)\n", MemInfo.cbSwapFileCFGSwapSize, MemInfo.cbSwapFileCFGSwapSize);
|
---|
63 | printf(" cSwapFileBrokenDF 0x%08x (%d)\n", MemInfo.cSwapFileBrokenDF , MemInfo.cSwapFileBrokenDF);
|
---|
64 | printf(" cSwapFileGrowFails 0x%08x (%d)\n", MemInfo.cSwapFileGrowFails , MemInfo.cSwapFileGrowFails);
|
---|
65 | printf(" cSwapFileInMemFile 0x%08x (%d)\n", MemInfo.cSwapFileInMemFile , MemInfo.cSwapFileInMemFile);
|
---|
66 |
|
---|
67 |
|
---|
68 | printf("\n"
|
---|
69 | " * Physical Memory *\n"
|
---|
70 | " -------------------\n");
|
---|
71 | printf(" cbPhysSize 0x%08x (%d)\n", MemInfo.cbPhysSize , MemInfo.cbPhysSize );
|
---|
72 | printf(" cbPhysAvail 0x%08x (%d)\n", MemInfo.cbPhysAvail, MemInfo.cbPhysAvail);
|
---|
73 | printf(" cbPhysUsed 0x%08x (%d)\n", MemInfo.cbPhysUsed , MemInfo.cbPhysUsed );
|
---|
74 |
|
---|
75 |
|
---|
76 | printf("\n"
|
---|
77 | " * Other paging info *\n"
|
---|
78 | " ---------------------\n");
|
---|
79 | printf(" fPagingSwapEnabled 0x%08x (%d)\n", MemInfo.fPagingSwapEnabled , MemInfo.fPagingSwapEnabled );
|
---|
80 | printf(" cPagingPageFaults 0x%08x (%d)\n", MemInfo.cPagingPageFaults , MemInfo.cPagingPageFaults );
|
---|
81 | printf(" cPagingPageFaultsActive 0x%08x (%d)\n", MemInfo.cPagingPageFaultsActive, MemInfo.cPagingPageFaultsActive);
|
---|
82 | printf(" cPagingPhysPages 0x%08x (%d)\n", MemInfo.cPagingPhysPages , MemInfo.cPagingPhysPages );
|
---|
83 | printf(" ulPagingPhysMax 0x%08x (%d)\n", MemInfo.ulPagingPhysMax , MemInfo.ulPagingPhysMax );
|
---|
84 | printf(" cPagingResidentPages 0x%08x (%d)\n", MemInfo.cPagingResidentPages , MemInfo.cPagingResidentPages );
|
---|
85 | printf(" cPagingSwappablePages 0x%08x (%d)\n", MemInfo.cPagingSwappablePages , MemInfo.cPagingSwappablePages );
|
---|
86 | printf(" cPagingDiscardableInmem 0x%08x (%d)\n", MemInfo.cPagingDiscardableInmem, MemInfo.cPagingDiscardableInmem);
|
---|
87 | printf(" cPagingDiscardablePages 0x%08x (%d)\n", MemInfo.cPagingDiscardablePages, MemInfo.cPagingDiscardablePages);
|
---|
88 |
|
---|
89 |
|
---|
90 | printf("\n"
|
---|
91 | " * Other paging info *\n"
|
---|
92 | " ---------------------\n");
|
---|
93 | printf(" ulAddressLimit 0x%08x (%d)\n", MemInfo.ulAddressLimit , MemInfo.ulAddressLimit );
|
---|
94 | printf(" ulVMArenaPrivMax 0x%08x (%d)\n", MemInfo.ulVMArenaPrivMax , MemInfo.ulVMArenaPrivMax );
|
---|
95 | printf(" ulVMArenaSharedMin 0x%08x (%d)\n", MemInfo.ulVMArenaSharedMin , MemInfo.ulVMArenaSharedMin );
|
---|
96 | printf(" ulVMArenaSharedMax 0x%08x (%d)\n", MemInfo.ulVMArenaSharedMax , MemInfo.ulVMArenaSharedMax );
|
---|
97 | printf(" ulVMArenaSystemMin 0x%08x (%d)\n", MemInfo.ulVMArenaSystemMin , MemInfo.ulVMArenaSystemMin );
|
---|
98 | printf(" ulVMArenaSystemMax 0x%08x (%d)\n", MemInfo.ulVMArenaSystemMax , MemInfo.ulVMArenaSystemMax );
|
---|
99 | printf(" ulVMArenaHighPrivMax 0x%08x (%d)\n", MemInfo.ulVMArenaHighPrivMax , MemInfo.ulVMArenaHighPrivMax );
|
---|
100 | printf(" ulVMArenaHighSharedMin 0x%08x (%d)\n", MemInfo.ulVMArenaHighSharedMin, MemInfo.ulVMArenaHighSharedMin );
|
---|
101 | printf(" ulVMArenaHighSharedMax 0x%08x (%d)\n", MemInfo.ulVMArenaHighSharedMax, MemInfo.ulVMArenaHighSharedMax );
|
---|
102 |
|
---|
103 | DosSleep(2000);
|
---|
104 | }
|
---|
105 |
|
---|
106 | libWin32kTerm();
|
---|
107 | return rc;
|
---|
108 | }
|
---|
109 |
|
---|