64b27d5fd2c9166d728675c4679f79076f8578f3
[reactos.git] / kmtests / ntos_ke / KeProcessor.c
1 /*
2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: LGPLv2+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite Executive Regressions KM-Test
5 * PROGRAMMER: Aleksey Bragin <aleksey@reactos.org>
6 */
7
8 /* TODO: this test doesn't process any test results; it also takes very long */
9
10 #include <ntddk.h>
11 #include <ntifs.h>
12 #include <ndk/ntndk.h>
13 #include <kmt_test.h>
14
15 #define NDEBUG
16 #include <debug.h>
17
18 static VOID KeStallExecutionProcessorTest(VOID)
19 {
20 ULONG i;
21 LARGE_INTEGER TimeStart, TimeFinish;
22
23 DPRINT1("Waiting for 30 secs with 50us stalls...\n");
24 KeQuerySystemTime(&TimeStart);
25 for (i = 0; i < (30*1000*20); i++)
26 {
27 KeStallExecutionProcessor(50);
28 }
29 KeQuerySystemTime(&TimeFinish);
30 DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30
31
32 DPRINT1("Waiting for 30 secs with 1000us stalls...\n");
33 KeQuerySystemTime(&TimeStart);
34 for (i = 0; i < (30*1000); i++)
35 {
36 KeStallExecutionProcessor(1000);
37 }
38 KeQuerySystemTime(&TimeFinish);
39 DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30
40
41 DPRINT1("Waiting for 30 secs with 1us stalls...\n");
42 KeQuerySystemTime(&TimeStart);
43 for (i = 0; i < (30*1000*1000); i++)
44 {
45 KeStallExecutionProcessor(1);
46 }
47 KeQuerySystemTime(&TimeFinish);
48 DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 43
49
50 DPRINT1("Waiting for 30 secs with one huge stall...\n");
51 KeQuerySystemTime(&TimeStart);
52 KeStallExecutionProcessor(30*1000000);
53 KeQuerySystemTime(&TimeFinish);
54 DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30
55 }
56
57 START_TEST(KeProcessor)
58 {
59 KeStallExecutionProcessorTest();
60 }