|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32test\bench\t_kernasmbm.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include "d_kernasmbm.h" |
|
19 #include <e32std.h> |
|
20 #include <e32std_private.h> |
|
21 #include <e32test.h> |
|
22 |
|
23 /** |
|
24 @SYMTestCaseID KBASE-0046-t_kernasmbm |
|
25 @SYMPREQ PREQ521 |
|
26 @SYMREQ REQ4891 |
|
27 @SYMTestCaseDesc This is a performance test used to get a relative indication |
|
28 of the speed of assmbler functions in the kernel |
|
29 @SYMTestPriority Medium |
|
30 @SYMTestActions Runs benchmarks for kernel functions |
|
31 @SYMTestExpectedResults Results are for information - no specific results expected |
|
32 */ |
|
33 |
|
34 #define FailIfError(EXPR) \ |
|
35 { \ |
|
36 TInt aErr = (EXPR); \ |
|
37 if (aErr != KErrNone) \ |
|
38 { \ |
|
39 test.Printf(_L("Return code == %d\n"), aErr); \ |
|
40 test(EFalse); \ |
|
41 } \ |
|
42 } |
|
43 |
|
44 _LIT(KLddFileName, "D_KERNASMBM.LDD"); |
|
45 RTest test(_L("T_KERNASMBM")); |
|
46 |
|
47 RKernAsmBmLdd TestLdd; |
|
48 |
|
49 void InitDataL() |
|
50 { |
|
51 // Load device driver |
|
52 User::LeaveIfError(User::LoadLogicalDevice(KLddFileName)); |
|
53 User::LeaveIfError(TestLdd.Open()); |
|
54 } |
|
55 |
|
56 TInt E32Main() |
|
57 { |
|
58 CTrapCleanup* trapHandler=CTrapCleanup::New(); |
|
59 test(trapHandler!=NULL); |
|
60 |
|
61 test.Title(); |
|
62 test.Start(_L("Benchmarks for assmblerised kernel functions\n")); |
|
63 |
|
64 TRAPD(err, RunBenchmarkTestsL(TestLdd)); |
|
65 if (err != KErrNone) |
|
66 test.Printf(_L("TestMainL left with %d\n"), err); |
|
67 |
|
68 TestLdd.Close(); |
|
69 User::After(10 * 1000); |
|
70 FailIfError(User::FreeLogicalDevice(KKernAsmBmLddName)); |
|
71 |
|
72 FailIfError(err); |
|
73 |
|
74 test.End(); |
|
75 |
|
76 delete trapHandler; |
|
77 return(KErrNone); |
|
78 } |