2 * NTOSKRNL Executive Regressions KM-Test
3 * ReactOS Kernel Mode Regression Testing framework
5 * Copyright 2006 Aleksey Bragin <aleksey@reactos.org>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; see the file COPYING.LIB.
19 * If not, write to the Free Software Foundation,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 /* INCLUDES *******************************************************************/
25 #include <ddk/ntddk.h>
27 #include <ndk/ntndk.h>
33 /* PUBLIC FUNCTIONS ***********************************************************/
36 KeStallTest(HANDLE KeyHandle
)
39 LARGE_INTEGER TimeStart
, TimeFinish
;
43 DPRINT1("Waiting for 30 secs with 50us stalls...\n");
44 KeQuerySystemTime(&TimeStart
);
45 for (i
= 0; i
< (30*1000*20); i
++)
47 KeStallExecutionProcessor(50);
49 KeQuerySystemTime(&TimeFinish
);
50 DPRINT1("Time elapsed: %d secs\n", (TimeFinish
.QuadPart
- TimeStart
.QuadPart
) / 10000000); // 30
52 DPRINT1("Waiting for 30 secs with 1000us stalls...\n");
53 KeQuerySystemTime(&TimeStart
);
54 for (i
= 0; i
< (30*1000); i
++)
56 KeStallExecutionProcessor(1000);
58 KeQuerySystemTime(&TimeFinish
);
59 DPRINT1("Time elapsed: %d secs\n", (TimeFinish
.QuadPart
- TimeStart
.QuadPart
) / 10000000); // 30
61 DPRINT1("Waiting for 30 secs with 1us stalls...\n");
62 KeQuerySystemTime(&TimeStart
);
63 for (i
= 0; i
< (30*1000*1000); i
++)
65 KeStallExecutionProcessor(1);
67 KeQuerySystemTime(&TimeFinish
);
68 DPRINT1("Time elapsed: %d secs\n", (TimeFinish
.QuadPart
- TimeStart
.QuadPart
) / 10000000); // 43
70 DPRINT1("Waiting for 30 secs with one huge stall...\n");
71 KeQuerySystemTime(&TimeStart
);
72 KeStallExecutionProcessor(30*1000000);
73 KeQuerySystemTime(&TimeFinish
);
74 DPRINT1("Time elapsed: %d secs\n", (TimeFinish
.QuadPart
- TimeStart
.QuadPart
) / 10000000); // 30
76 FinishTest(KeyHandle
, L
"KeStallmanExecutionTest");