|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 */ |
|
24 |
|
25 #ifndef __PERFORMANCETEST_H__ |
|
26 #define __PERFORMANCETEST_H__ |
|
27 #include <f32file.h> |
|
28 #include "t_testaction.h" |
|
29 #include "t_testsetup.h" |
|
30 #include <e32std.h> |
|
31 |
|
32 const TInt KMaxIterations = 500; |
|
33 |
|
34 _LIT8(KIterationsStart, "<iterations>"); |
|
35 _LIT8(KIterationsEnd, "</iterations>"); |
|
36 _LIT8(KTypeOfCryptoStart, "<cryptotype>"); |
|
37 _LIT8(KTypeOfCryptoEnd, "</cryptotype>"); |
|
38 _LIT8(KRSAStandard, "EStandard"); |
|
39 _LIT8(KRSAStandardCRT, "EStandardCRT"); |
|
40 |
|
41 // This class can be used to switch on/off performance testing |
|
42 // It inherits from CTestAction so it can be used in the script |
|
43 // but otherwise doesn't carry out any test. |
|
44 // When in a script and enabled, the performance tester singleton |
|
45 // is initialised and can then be used by all following tests in |
|
46 // various performance operations |
|
47 |
|
48 class CPerformanceTest : public CTestAction |
|
49 { |
|
50 public: |
|
51 static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, |
|
52 Output& aOut, const TTestActionSpec& aTestActionSpec); |
|
53 static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole, |
|
54 Output& aOut, const TTestActionSpec& aTestActionSpec); |
|
55 public: |
|
56 virtual ~CPerformanceTest(); |
|
57 virtual void PerformAction(TRequestStatus& aStatus); |
|
58 protected: |
|
59 CPerformanceTest(CConsoleBase& aConsole, Output& aOut); |
|
60 virtual void ConstructL(const TTestActionSpec& aTestActionSpec); |
|
61 virtual void DoPerformPrerequisite(TRequestStatus& aStatus); |
|
62 virtual void DoPerformPostrequisite(TRequestStatus& aStatus); |
|
63 virtual void DoReportAction(void){}; |
|
64 virtual void DoCheckResult(TInt){}; |
|
65 }; |
|
66 |
|
67 // static singleton tracks performance testing and provides |
|
68 // standard operations for all performance tests |
|
69 |
|
70 class CPerformance : public CBase |
|
71 { |
|
72 public: |
|
73 static CPerformance* NewL(); |
|
74 public: |
|
75 static CPerformance* PerformanceTester(); |
|
76 static void ClosePerformanceTester(); |
|
77 public: |
|
78 inline void SetTestingPerformance(TBool aTestPerformance) {iTestingPerformance=aTestPerformance;}; |
|
79 inline TBool IsTestingPerformance() const {return (iTestingPerformance);}; |
|
80 private: |
|
81 CPerformance(); |
|
82 ~CPerformance(); |
|
83 private: |
|
84 static CPerformance* iPerformanceTester; |
|
85 private: |
|
86 TBool iTestingPerformance; |
|
87 }; |
|
88 |
|
89 #endif // __PERFORMANCETEST_H__ |