Author: aandrejevic Date: Sat Jun 22 01:41:51 2013 New Revision: 59279
URL: http://svn.reactos.org/svn/reactos?rev=59279&view=rev Log: [NTVDM] Improve keyboard IRQ performance. Add debug output to measure number of instructions per second.
Modified: branches/ntvdm/subsystems/ntvdm/CMakeLists.txt branches/ntvdm/subsystems/ntvdm/ntvdm.c branches/ntvdm/subsystems/ntvdm/ntvdm.h
Modified: branches/ntvdm/subsystems/ntvdm/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/CMakeList... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/CMakeLists.txt [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/CMakeLists.txt [iso-8859-1] Sat Jun 22 01:41:51 2013 @@ -12,6 +12,6 @@ add_executable(ntvdm ${SOURCE}) set_module_type(ntvdm win32cui UNICODE) target_link_libraries(ntvdm softx86 softx87) -add_importlibs(ntvdm msvcrt user32 kernel32) +add_importlibs(ntvdm msvcrt user32 kernel32 ntdll) add_dependencies(ntvdm softx86 softx87) add_cd_file(TARGET ntvdm DESTINATION reactos/system32 FOR all)
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.c?r... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] Sat Jun 22 01:41:51 2013 @@ -7,6 +7,8 @@ */
#include "ntvdm.h" + +#define NDEBUG
BOOLEAN VdmRunning = TRUE; LPVOID BaseAddress = NULL; @@ -57,6 +59,7 @@ INT i; BOOLEAN PrintUsage = TRUE; CHAR CommandLine[128]; + DWORD CurrentTickCount, LastTickCount = 0, Cycles = 0, LastCyclePrintout = 0; LARGE_INTEGER Frequency, LastTimerTick, Counter; LONGLONG TimerTicks;
@@ -133,7 +136,10 @@ /* Main loop */ while (VdmRunning) { - /* Get the current time */ + /* Get the current number of ticks */ + CurrentTickCount = GetTickCount(); + + /* Get the current performance counter value */ QueryPerformanceCounter(&Counter);
/* Get the number of PIT ticks that have passed */ @@ -144,11 +150,23 @@ for (i = 0; i < TimerTicks; i++) PitDecrementCount(); LastTimerTick = Counter;
- /* Check for console input events */ - CheckForInputEvents(); + /* Check for console input events every millisecond */ + if (CurrentTickCount != LastTickCount) + { + CheckForInputEvents(); + LastTickCount = CurrentTickCount; + }
/* Continue CPU emulation */ EmulatorStep(); + + Cycles++; + if ((CurrentTickCount - LastCyclePrintout) >= 1000) + { + DPRINT1("NTVDM: %d Instructions Per Second\n", Cycles); + LastCyclePrintout = CurrentTickCount; + Cycles = 0; + } }
Cleanup:
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.h?r... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] Sat Jun 22 01:41:51 2013 @@ -14,6 +14,7 @@ #include <conio.h> #include <assert.h> #include <stdarg.h> +#include <debug.h>
/* DEFINES ********************************************************************/