* The Shell.. for a long time we dreamed of having a compatible, properly working...
[reactos.git] / rostests / 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 <kmt_test.h>
11
12 #define NDEBUG
13 #include <debug.h>
14
15 static VOID KeStallExecutionProcessorTest(VOID)
16 {
17 ULONG i;
18 LARGE_INTEGER TimeStart, TimeFinish;
19
20 DPRINT1("Waiting for 30 secs with 50us stalls...\n");
21 KeQuerySystemTime(&TimeStart);
22 for (i = 0; i < (30*1000*20); i++)
23 {
24 KeStallExecutionProcessor(50);
25 }
26 KeQuerySystemTime(&TimeFinish);
27 DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30
28
29 DPRINT1("Waiting for 30 secs with 1000us stalls...\n");
30 KeQuerySystemTime(&TimeStart);
31 for (i = 0; i < (30*1000); i++)
32 {
33 KeStallExecutionProcessor(1000);
34 }
35 KeQuerySystemTime(&TimeFinish);
36 DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30
37
38 DPRINT1("Waiting for 30 secs with 1us stalls...\n");
39 KeQuerySystemTime(&TimeStart);
40 for (i = 0; i < (30*1000*1000); i++)
41 {
42 KeStallExecutionProcessor(1);
43 }
44 KeQuerySystemTime(&TimeFinish);
45 DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 43
46
47 DPRINT1("Waiting for 30 secs with one huge stall...\n");
48 KeQuerySystemTime(&TimeStart);
49 KeStallExecutionProcessor(30*1000000);
50 KeQuerySystemTime(&TimeFinish);
51 DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30
52 }
53
54 START_TEST(KeProcessor)
55 {
56 KeStallExecutionProcessorTest();
57 }