Author: fireball Date: Wed May 9 15:55:19 2007 New Revision: 26664
URL: http://svn.reactos.org/svn/reactos?rev=26664&view=rev Log: - Add km regtests to build. - Add a very simple memory monitor (to be improved later).
Added: trunk/rostests/drivers/memtest/ (with props) trunk/rostests/drivers/memtest/memtest.c (with props) trunk/rostests/drivers/memtest/memtest.h (with props) trunk/rostests/drivers/memtest/memtest.rbuild (with props) trunk/rostests/drivers/memtest/memtest.rc (with props) Modified: trunk/rostests/directory.rbuild trunk/rostests/drivers/directory.rbuild
Modified: trunk/rostests/directory.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/rostests/directory.rbuild?rev=26664... ============================================================================== --- trunk/rostests/directory.rbuild (original) +++ trunk/rostests/directory.rbuild Wed May 9 15:55:19 2007 @@ -1,3 +1,6 @@ +<directory name="drivers"> + <xi:include href="drivers/directory.rbuild" /> +</directory> <directory name="dxtest"> <xi:include href="dxtest/directory.rbuild" /> </directory>
Modified: trunk/rostests/drivers/directory.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/directory.rbuild?r... ============================================================================== --- trunk/rostests/drivers/directory.rbuild (original) +++ trunk/rostests/drivers/directory.rbuild Wed May 9 15:55:19 2007 @@ -3,4 +3,7 @@ </directory> <directory name="kmtest"> <xi:include href="kmtest/kmtest.rbuild" /> +</directory> +<directory name="memtest"> + <xi:include href="memtest/memtest.rbuild" /> </directory>
Propchange: trunk/rostests/drivers/memtest/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Wed May 9 15:55:19 2007 @@ -1,0 +1,7 @@ +*.coff +*.sym +*.sys +*.o +*.map +*.vcproj +*.user
Added: trunk/rostests/drivers/memtest/memtest.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/memtest/memtest.c?... ============================================================================== --- trunk/rostests/drivers/memtest/memtest.c (added) +++ trunk/rostests/drivers/memtest/memtest.c Wed May 9 15:55:19 2007 @@ -1,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; +}
Propchange: trunk/rostests/drivers/memtest/memtest.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/rostests/drivers/memtest/memtest.h URL: http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/memtest/memtest.h?... ============================================================================== --- trunk/rostests/drivers/memtest/memtest.h (added) +++ trunk/rostests/drivers/memtest/memtest.h Wed May 9 15:55:19 2007 @@ -1,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 */
Propchange: trunk/rostests/drivers/memtest/memtest.h ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/rostests/drivers/memtest/memtest.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/memtest/memtest.rb... ============================================================================== --- trunk/rostests/drivers/memtest/memtest.rbuild (added) +++ trunk/rostests/drivers/memtest/memtest.rbuild Wed May 9 15:55:19 2007 @@ -1,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>
Propchange: trunk/rostests/drivers/memtest/memtest.rbuild ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/rostests/drivers/memtest/memtest.rc URL: http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/memtest/memtest.rc... ============================================================================== --- trunk/rostests/drivers/memtest/memtest.rc (added) +++ trunk/rostests/drivers/memtest/memtest.rc Wed May 9 15:55:19 2007 @@ -1,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>
Propchange: trunk/rostests/drivers/memtest/memtest.rc ------------------------------------------------------------------------------ svn:eol-style = native