ReactOS  0.4.15-dev-499-g1f31905
memtest.c File Reference
#include <ddk/ntddk.h>
#include "memtest.h"
#include <debug.h>
Include dependency graph for memtest.c:

Go to the source code of this file.

Functions

static VOID NTAPI MonitorThread (PVOID Ignored)
 
VOID StartMemoryMonitor ()
 
NTSTATUS NTAPI DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
 

Variables

HANDLE MonitorThreadHandle
 

Function Documentation

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( PDRIVER_OBJECT  DriverObject,
PUNICODE_STRING  RegistryPath 
)

Definition at line 100 of file memtest.c.

102 {
103  DbgPrint("\n===============================================\n Memory Manager Information and Test driver\n");
104  DbgPrint("Time;Memory pages allocated;Memory pages free\n");
105 
106 
108 
109  return STATUS_SUCCESS;
110 }
#define DbgPrint
Definition: loader.c:25
VOID StartMemoryMonitor()
Definition: memtest.c:73
return STATUS_SUCCESS
Definition: btrfs.c:3014

◆ MonitorThread()

static VOID NTAPI MonitorThread ( PVOID  Ignored)
static

Definition at line 35 of file memtest.c.

36 {
37  SYSTEM_PERFORMANCE_INFORMATION PerformanceInfo;
38  ULONG Length;
39  LARGE_INTEGER Interval, SystemTime;
40 
41  /* Main loop */
42  while (TRUE)
43  {
44  Interval.QuadPart = -300 * 10000; // 300 ms
45 
46  /* Query information */
48  (PVOID) &PerformanceInfo,
51  {
52  break;
53  }
54 
55  /* Query current system time */
56  KeQuerySystemTime(&SystemTime);
57 
58 
59  DbgPrint("%I64d;%d;%d\n", SystemTime.QuadPart,
60  PerformanceInfo.CommittedPages, PerformanceInfo.AvailablePages);
61 
62  /* Wait for a bit. */
64  }
65 
66  DPRINT("Finishing monitoring thread.\n");
67 
69 }
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
#define TRUE
Definition: types.h:120
#define DbgPrint
Definition: loader.c:25
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
NTSYSAPI NTSTATUS NTAPI ZwQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
void DPRINT(...)
Definition: polytest.cpp:61
#define SystemPerformanceInformation
Definition: memtest.h:87
DWORD Interval
Definition: netstat.c:33
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI PsTerminateSystemThread(IN NTSTATUS ExitStatus)
Definition: kill.c:1144
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:3014
LONGLONG QuadPart
Definition: typedefs.h:113

Referenced by StartMemoryMonitor().

◆ StartMemoryMonitor()

VOID StartMemoryMonitor ( )

Definition at line 73 of file memtest.c.

74 {
76 
80  NULL,
81  NULL,
82  NULL,
84  NULL);
85 
86  if (!NT_SUCCESS(Status))
87  {
88  DPRINT1("Failed to start a monitoring thread\n");
89  return;
90  }
91 }
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static VOID NTAPI MonitorThread(PVOID Ignored)
Definition: memtest.c:35
Status
Definition: gdiplustypes.h:24
HANDLE MonitorThreadHandle
Definition: memtest.c:30
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
#define DPRINT1
Definition: precomp.h:8

Referenced by DriverEntry().

Variable Documentation

◆ MonitorThreadHandle

HANDLE MonitorThreadHandle

Definition at line 30 of file memtest.c.

Referenced by StartMemoryMonitor().