2 * Memory Manager Information and Test driver
4 * Copyright 2006 Aleksey Bragin <alekset@reactos.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; see the file COPYING.LIB.
18 * If not, write to the Free Software Foundation,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 /* INCLUDES *******************************************************************/
24 #include <ddk/ntddk.h>
30 HANDLE MonitorThreadHandle
;
32 /* FUNCTIONS ***********************************************************/
35 MonitorThread(PVOID Ignored
)
37 SYSTEM_PERFORMANCE_INFORMATION PerformanceInfo
;
39 LARGE_INTEGER Interval
, SystemTime
;
44 Interval
.QuadPart
= -300 * 10000; // 300 ms
46 /* Query information */
47 if (ZwQuerySystemInformation(SystemPerformanceInformation
,
48 (PVOID
) &PerformanceInfo
,
49 sizeof(SYSTEM_PERFORMANCE_INFORMATION
),
50 &Length
) != STATUS_SUCCESS
)
55 /* Query current system time */
56 KeQuerySystemTime(&SystemTime
);
59 DbgPrint("%I64d;%d;%d\n", SystemTime
.QuadPart
,
60 PerformanceInfo
.CommittedPages
, PerformanceInfo
.AvailablePages
);
63 KeDelayExecutionThread(KernelMode
, FALSE
, &Interval
);
66 DPRINT("Finishing monitoring thread.\n");
68 PsTerminateSystemThread(0);
77 Status
= PsCreateSystemThread(
86 if (!NT_SUCCESS(Status
))
88 DPRINT1("Failed to start a monitoring thread\n");
93 /* PUBLIC FUNCTIONS ***********************************************************/
100 DriverEntry(PDRIVER_OBJECT DriverObject
,
101 PUNICODE_STRING RegistryPath
)
103 DbgPrint("\n===============================================\n Memory Manager Information and Test driver\n");
104 DbgPrint("Time;Memory pages allocated;Memory pages free\n");
107 StartMemoryMonitor();
109 return STATUS_SUCCESS
;