mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 12:55:43 +00:00
- Add km regtests to build.
- Add a very simple memory monitor (to be improved later). svn path=/trunk/; revision=26664
This commit is contained in:
parent
7ba021c0ca
commit
d80647e124
6 changed files with 232 additions and 0 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
<directory name="drivers">
|
||||||
|
<xi:include href="drivers/directory.rbuild" />
|
||||||
|
</directory>
|
||||||
<directory name="dxtest">
|
<directory name="dxtest">
|
||||||
<xi:include href="dxtest/directory.rbuild" />
|
<xi:include href="dxtest/directory.rbuild" />
|
||||||
</directory>
|
</directory>
|
||||||
|
|
|
@ -3,4 +3,7 @@
|
||||||
</directory>
|
</directory>
|
||||||
<directory name="kmtest">
|
<directory name="kmtest">
|
||||||
<xi:include href="kmtest/kmtest.rbuild" />
|
<xi:include href="kmtest/kmtest.rbuild" />
|
||||||
|
</directory>
|
||||||
|
<directory name="memtest">
|
||||||
|
<xi:include href="memtest/memtest.rbuild" />
|
||||||
</directory>
|
</directory>
|
110
rostests/drivers/memtest/memtest.c
Normal file
110
rostests/drivers/memtest/memtest.c
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
/*
|
||||||
|
* Memory Manager Information and Test driver
|
||||||
|
*
|
||||||
|
* Copyright 2006 Aleksey Bragin <alekset@reactos.org>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; see the file COPYING.LIB.
|
||||||
|
* If not, write to the Free Software Foundation,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
|
//#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <ddk/ntddk.h>
|
||||||
|
#include "memtest.h"
|
||||||
|
|
||||||
|
HANDLE MonitorThreadHandle;
|
||||||
|
|
||||||
|
/* FUNCTIONS ***********************************************************/
|
||||||
|
|
||||||
|
static VOID NTAPI
|
||||||
|
MonitorThread(PVOID Ignored)
|
||||||
|
{
|
||||||
|
SYSTEM_PERFORMANCE_INFORMATION PerformanceInfo;
|
||||||
|
ULONG Length;
|
||||||
|
LARGE_INTEGER Interval, SystemTime;
|
||||||
|
|
||||||
|
/* Main loop */
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
Interval.QuadPart = -300 * 10000; // 300 ms
|
||||||
|
|
||||||
|
/* Query information */
|
||||||
|
if (ZwQuerySystemInformation(SystemPerformanceInformation,
|
||||||
|
(PVOID) &PerformanceInfo,
|
||||||
|
sizeof(SYSTEM_PERFORMANCE_INFORMATION),
|
||||||
|
&Length) != NO_ERROR)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Query current system time */
|
||||||
|
KeQuerySystemTime(&SystemTime);
|
||||||
|
|
||||||
|
|
||||||
|
DbgPrint("%I64d;%d;%d\n", SystemTime.QuadPart,
|
||||||
|
PerformanceInfo.CommittedPages, PerformanceInfo.AvailablePages);
|
||||||
|
|
||||||
|
/* Wait for a bit. */
|
||||||
|
KeDelayExecutionThread(KernelMode, FALSE, &Interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("Finishing monitoring thread.\n");
|
||||||
|
|
||||||
|
PsTerminateSystemThread(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
StartMemoryMonitor()
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = PsCreateSystemThread(
|
||||||
|
&MonitorThreadHandle,
|
||||||
|
THREAD_ALL_ACCESS,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
MonitorThread,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to start a monitoring thread\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DriverEntry
|
||||||
|
*/
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||||
|
PUNICODE_STRING RegistryPath)
|
||||||
|
{
|
||||||
|
DbgPrint("\n===============================================\n Memory Manager Information and Test driver\n");
|
||||||
|
DbgPrint("Time;Memory pages allocated;Memory pages free\n");
|
||||||
|
|
||||||
|
|
||||||
|
StartMemoryMonitor();
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
100
rostests/drivers/memtest/memtest.h
Normal file
100
rostests/drivers/memtest/memtest.h
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
#ifndef MEMTEST_H
|
||||||
|
#define MEMTEST_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
// Class 2
|
||||||
|
typedef struct _SYSTEM_PERFORMANCE_INFORMATION
|
||||||
|
{
|
||||||
|
LARGE_INTEGER IdleProcessTime;
|
||||||
|
LARGE_INTEGER IoReadTransferCount;
|
||||||
|
LARGE_INTEGER IoWriteTransferCount;
|
||||||
|
LARGE_INTEGER IoOtherTransferCount;
|
||||||
|
ULONG IoReadOperationCount;
|
||||||
|
ULONG IoWriteOperationCount;
|
||||||
|
ULONG IoOtherOperationCount;
|
||||||
|
ULONG AvailablePages;
|
||||||
|
ULONG CommittedPages;
|
||||||
|
ULONG CommitLimit;
|
||||||
|
ULONG PeakCommitment;
|
||||||
|
ULONG PageFaultCount;
|
||||||
|
ULONG CopyOnWriteCount;
|
||||||
|
ULONG TransitionCount;
|
||||||
|
ULONG CacheTransitionCount;
|
||||||
|
ULONG DemandZeroCount;
|
||||||
|
ULONG PageReadCount;
|
||||||
|
ULONG PageReadIoCount;
|
||||||
|
ULONG CacheReadCount;
|
||||||
|
ULONG CacheIoCount;
|
||||||
|
ULONG DirtyPagesWriteCount;
|
||||||
|
ULONG DirtyWriteIoCount;
|
||||||
|
ULONG MappedPagesWriteCount;
|
||||||
|
ULONG MappedWriteIoCount;
|
||||||
|
ULONG PagedPoolPages;
|
||||||
|
ULONG NonPagedPoolPages;
|
||||||
|
ULONG PagedPoolAllocs;
|
||||||
|
ULONG PagedPoolFrees;
|
||||||
|
ULONG NonPagedPoolAllocs;
|
||||||
|
ULONG NonPagedPoolFrees;
|
||||||
|
ULONG FreeSystemPtes;
|
||||||
|
ULONG ResidentSystemCodePage;
|
||||||
|
ULONG TotalSystemDriverPages;
|
||||||
|
ULONG TotalSystemCodePages;
|
||||||
|
ULONG NonPagedPoolLookasideHits;
|
||||||
|
ULONG PagedPoolLookasideHits;
|
||||||
|
ULONG Spare3Count;
|
||||||
|
ULONG ResidentSystemCachePage;
|
||||||
|
ULONG ResidentPagedPoolPage;
|
||||||
|
ULONG ResidentSystemDriverPage;
|
||||||
|
ULONG CcFastReadNoWait;
|
||||||
|
ULONG CcFastReadWait;
|
||||||
|
ULONG CcFastReadResourceMiss;
|
||||||
|
ULONG CcFastReadNotPossible;
|
||||||
|
ULONG CcFastMdlReadNoWait;
|
||||||
|
ULONG CcFastMdlReadWait;
|
||||||
|
ULONG CcFastMdlReadResourceMiss;
|
||||||
|
ULONG CcFastMdlReadNotPossible;
|
||||||
|
ULONG CcMapDataNoWait;
|
||||||
|
ULONG CcMapDataWait;
|
||||||
|
ULONG CcMapDataNoWaitMiss;
|
||||||
|
ULONG CcMapDataWaitMiss;
|
||||||
|
ULONG CcPinMappedDataCount;
|
||||||
|
ULONG CcPinReadNoWait;
|
||||||
|
ULONG CcPinReadWait;
|
||||||
|
ULONG CcPinReadNoWaitMiss;
|
||||||
|
ULONG CcPinReadWaitMiss;
|
||||||
|
ULONG CcCopyReadNoWait;
|
||||||
|
ULONG CcCopyReadWait;
|
||||||
|
ULONG CcCopyReadNoWaitMiss;
|
||||||
|
ULONG CcCopyReadWaitMiss;
|
||||||
|
ULONG CcMdlReadNoWait;
|
||||||
|
ULONG CcMdlReadWait;
|
||||||
|
ULONG CcMdlReadNoWaitMiss;
|
||||||
|
ULONG CcMdlReadWaitMiss;
|
||||||
|
ULONG CcReadAheadIos;
|
||||||
|
ULONG CcLazyWriteIos;
|
||||||
|
ULONG CcLazyWritePages;
|
||||||
|
ULONG CcDataFlushes;
|
||||||
|
ULONG CcDataPages;
|
||||||
|
ULONG ContextSwitches;
|
||||||
|
ULONG FirstLevelTbFills;
|
||||||
|
ULONG SecondLevelTbFills;
|
||||||
|
ULONG SystemCalls;
|
||||||
|
} SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
|
||||||
|
|
||||||
|
#define SystemPerformanceInformation 2
|
||||||
|
|
||||||
|
|
||||||
|
LONG
|
||||||
|
NTAPI
|
||||||
|
ZwQuerySystemInformation(
|
||||||
|
IN ULONG SystemInformationClass,
|
||||||
|
OUT PVOID SystemInformation,
|
||||||
|
IN ULONG Length,
|
||||||
|
OUT PULONG ResultLength
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* MEMTEST_H */
|
9
rostests/drivers/memtest/memtest.rbuild
Normal file
9
rostests/drivers/memtest/memtest.rbuild
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<module name="memtest" type="kernelmodedriver" installbase="system32/drivers" installname="memtest.sys">
|
||||||
|
<bootstrap base="reactos" />
|
||||||
|
<define name="__USE_W32API" />
|
||||||
|
<include base="ReactOS">include/reactos/drivers</include>
|
||||||
|
<library>ntoskrnl</library>
|
||||||
|
<library>hal</library>
|
||||||
|
<file>memtest.c</file>
|
||||||
|
<file>memtest.rc</file>
|
||||||
|
</module>
|
7
rostests/drivers/memtest/memtest.rc
Normal file
7
rostests/drivers/memtest/memtest.rc
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/* $Id: csqtest.rc 21842 2006-05-07 19:16:11Z ion $ */
|
||||||
|
|
||||||
|
#define REACTOS_VERSION_DLL
|
||||||
|
#define REACTOS_STR_FILE_DESCRIPTION "Memory Manager Information and Testing\0"
|
||||||
|
#define REACTOS_STR_INTERNAL_NAME "memtest\0"
|
||||||
|
#define REACTOS_STR_ORIGINAL_FILENAME "memtest.sys\0"
|
||||||
|
#include <reactos/version.rc>
|
Loading…
Add table
Add a link
Reference in a new issue