Improve keyboard IRQ performance.
Add debug output to measure number of instructions per second.


svn path=/branches/ntvdm/; revision=59279
This commit is contained in:
Aleksandar Andrejevic 2013-06-22 01:41:51 +00:00
parent b040791380
commit 6a3d90cf53
3 changed files with 23 additions and 4 deletions

View file

@ -12,6 +12,6 @@ list(APPEND SOURCE
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)

View file

@ -8,6 +8,8 @@
#include "ntvdm.h"
#define NDEBUG
BOOLEAN VdmRunning = TRUE;
LPVOID BaseAddress = NULL;
LPCWSTR ExceptionName[] =
@ -57,6 +59,7 @@ INT wmain(INT argc, WCHAR *argv[])
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 @@ INT wmain(INT argc, WCHAR *argv[])
/* 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 @@ INT wmain(INT argc, WCHAR *argv[])
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:

View file

@ -14,6 +14,7 @@
#include <conio.h>
#include <assert.h>
#include <stdarg.h>
#include <debug.h>
/* DEFINES ********************************************************************/