home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Troubleshooting Netware Systems
/
CSTRIAL0196.BIN
/
attach
/
msj
/
v10n05
/
dynvxd.exe
/
VCYCLASM.EXE
/
VXDTEST.C
< prev
Wrap
C/C++ Source or Header
|
1995-05-01
|
3KB
|
74 lines
/*****************************************************************************/
/* */
/* VXDTEST.C -- Test program for VCYCLE.VXD */
/* */
/* Written by Walter Oney */
/* */
/*****************************************************************************/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <string.h>
DWORD counter[2]; // RDTSC counter
void dotest(void)
{ // dotest
_asm
{ // get starting timestamp
_emit 0Fh ; Pentium RDTSC
_emit 31h
mov counter, eax ; save counter
mov counter+4, edx
} // get starting timestamp
Sleep(500); // sleep for 1/2 second
_asm
{ // compute delta between now and start
_emit 0Fh ; RDTSC
_emit 31h
sub eax, counter ; compute delta since start
sbb edx, counter+4
mov counter, eax ; save as return value
mov counter+4, edx
} // compute delta between now and start
} // dotest
int main(int argc, char *argv[])
{ // main
HANDLE hDevice;
hDevice = CreateFile("\\\\.\\VCYCLE.VXD", 0, 0, NULL, 0,
FILE_FLAG_DELETE_ON_CLOSE, NULL);
if (hDevice != INVALID_HANDLE_VALUE)
{ // talk to device
DWORD version;
DWORD nret;
LPDWORD pcounter = counter;
DeviceIoControl(hDevice, 1, NULL, 0, &version, sizeof(version),
&nret, NULL);
printf("VCYCLE.VXD is version %d.%02d\n", HIBYTE(version),
LOBYTE(version));
dotest();
printf("Elapsed time measured without virtualization is %ld\n",
counter[0]);
DeviceIoControl(hDevice, 2, &pcounter, sizeof(pcounter), NULL, 0,
NULL, NULL);
dotest();
printf("Elapsed time measured with virtualization is %ld\n",
counter[0]);
pcounter = NULL;
DeviceIoControl(hDevice, 2, &pcounter, sizeof(pcounter), NULL,
0, NULL, NULL);
CloseHandle(hDevice);
} // talk to device
return 0;
} // main