sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// Base test step for ECom performance tests
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
@file
|
sl@0
|
20 |
@internalComponent
|
sl@0
|
21 |
*/
|
sl@0
|
22 |
|
sl@0
|
23 |
#include <ecom/ecom.h>
|
sl@0
|
24 |
#include "Te_EComPerfTestStep.h"
|
sl@0
|
25 |
#include "EcomTestUtils.h"
|
sl@0
|
26 |
|
sl@0
|
27 |
#ifdef __ECOM_SERVER_PERFORMANCE__
|
sl@0
|
28 |
const TInt KOneSecond = 1000000;
|
sl@0
|
29 |
#endif
|
sl@0
|
30 |
|
sl@0
|
31 |
CEComPerfTestBase::CEComPerfTestBase(const TDesC& aStepName)
|
sl@0
|
32 |
{
|
sl@0
|
33 |
SetTestStepName(aStepName);
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
CEComPerfTestBase::~CEComPerfTestBase()
|
sl@0
|
37 |
{
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
/**
|
sl@0
|
41 |
Set-up ECom performance tests by starting the ECom server and then waiting to allow start-up to complete
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
TVerdict CEComPerfTestBase::doTestStepPreambleL()
|
sl@0
|
44 |
{
|
sl@0
|
45 |
#ifdef __ECOM_SERVER_PERFORMANCE__
|
sl@0
|
46 |
//Open the ecom session which in turn should start the ecom server.
|
sl@0
|
47 |
//Next, wait to make sure that startup is complete before requesting timing data.
|
sl@0
|
48 |
//Finally, get rid of the ecom session.
|
sl@0
|
49 |
REComSession& ecomSession = REComSession::OpenL();
|
sl@0
|
50 |
CleanupClosePushL(ecomSession);
|
sl@0
|
51 |
User::After(KOneSecond*15); //delay for 15 sec to ensure ecom start up has completed
|
sl@0
|
52 |
CleanupStack::PopAndDestroy(&ecomSession);
|
sl@0
|
53 |
|
sl@0
|
54 |
#endif
|
sl@0
|
55 |
return TestStepResult() ;
|
sl@0
|
56 |
}
|
sl@0
|
57 |
|
sl@0
|
58 |
TVerdict CEComPerfTestBase::doTestStepPostambleL()
|
sl@0
|
59 |
{
|
sl@0
|
60 |
return TestStepResult() ;
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
/**
|
sl@0
|
64 |
Fails the test if the measured time is less than the maximum time
|
sl@0
|
65 |
This test is only enabled on hardware non-DP release builds
|
sl@0
|
66 |
(testing for DP builds was disabled due to inconsistency of the results)
|
sl@0
|
67 |
@param aActualTime The measured time
|
sl@0
|
68 |
@param aMaxTime The maximum time
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
#if defined(__EPOC32__) && !defined(_DEBUG)
|
sl@0
|
71 |
void CEComPerfTestBase::CheckPerformance(TReal aActualTime, TReal aMaxTime, TPtrC aTimingMessage)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
THardwareConfiguration hardware_configuration = EComTestUtils::GetHardwareConfiguration();
|
sl@0
|
74 |
if ( hardware_configuration != EPlatformH4NANDDP )
|
sl@0
|
75 |
{
|
sl@0
|
76 |
if (aActualTime < aMaxTime)
|
sl@0
|
77 |
{
|
sl@0
|
78 |
INFO_PRINTF4(_L("Performance test for [%S] passed (Measured time [%f] mSecs, Time limit [%f] mSecs\n"), &aTimingMessage, aActualTime, aMaxTime);
|
sl@0
|
79 |
}
|
sl@0
|
80 |
else
|
sl@0
|
81 |
{
|
sl@0
|
82 |
INFO_PRINTF4(_L("Performance test for [%S] FAILED (Measured time [%f] mSecs, Time limit [%f] mSecs\n"), &aTimingMessage, aActualTime, aMaxTime);
|
sl@0
|
83 |
}
|
sl@0
|
84 |
TEST(aActualTime < aMaxTime);
|
sl@0
|
85 |
}
|
sl@0
|
86 |
else
|
sl@0
|
87 |
#else
|
sl@0
|
88 |
void CEComPerfTestBase::CheckPerformance(TReal aActualTime, TReal /*aMaxTime*/, TPtrC aTimingMessage)
|
sl@0
|
89 |
{
|
sl@0
|
90 |
#endif
|
sl@0
|
91 |
/*Stub implementation used when performance testing is disabled
|
sl@0
|
92 |
Performance testing is not enabled on debug, emulator and DP builds*/
|
sl@0
|
93 |
INFO_PRINTF3(_L("Performance check disabled. Measured time for [%S] is [%f] mSecs\n"), &aTimingMessage, aActualTime);
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
|
sl@0
|
97 |
#ifdef __ECOM_SERVER_PERFORMANCE__
|
sl@0
|
98 |
|
sl@0
|
99 |
_LIT(KUnknownDesC, "Unknown");
|
sl@0
|
100 |
_LIT(KCreateDesC, "Create");
|
sl@0
|
101 |
_LIT(KListDesC, "List");
|
sl@0
|
102 |
_LIT(KNotifyOnChangeDesC, "Notify On Change");
|
sl@0
|
103 |
_LIT(KCancelNotifyOnChangeDesC, "Cancel Notify On Change");
|
sl@0
|
104 |
_LIT(KCollectImplementationsDesC, "Collect Implementations");
|
sl@0
|
105 |
_LIT(KListExtendedInterfacesDesC, "List extended interfaces");
|
sl@0
|
106 |
/**
|
sl@0
|
107 |
Converts a client request type into a string description of the enumeration
|
sl@0
|
108 |
@param aClientRequest The client request to retrieve a string description of
|
sl@0
|
109 |
@return The string description of aClientRequest
|
sl@0
|
110 |
*/
|
sl@0
|
111 |
TPtrC CEComPerfTestBase::ClientRequestTypeName(TEComClientRequestType aClientRequestType)
|
sl@0
|
112 |
{
|
sl@0
|
113 |
switch (aClientRequestType)
|
sl@0
|
114 |
{
|
sl@0
|
115 |
case EEComCreateRequestType:
|
sl@0
|
116 |
return (TDesC&)KCreateDesC;
|
sl@0
|
117 |
case EEComListRequestType:
|
sl@0
|
118 |
return (TDesC&)KListDesC;
|
sl@0
|
119 |
case EEComNotifyOnChangeRequestType:
|
sl@0
|
120 |
return (TDesC&)KNotifyOnChangeDesC;
|
sl@0
|
121 |
case EEComCancelNotifyOnChangeRequestType:
|
sl@0
|
122 |
return (TDesC&)KCancelNotifyOnChangeDesC;
|
sl@0
|
123 |
case EEComCollectImplementationsRequestType:
|
sl@0
|
124 |
return (TDesC&)KCollectImplementationsDesC;
|
sl@0
|
125 |
case EEComListExtendedInterfacesRequestType:
|
sl@0
|
126 |
return (TDesC&)KListExtendedInterfacesDesC;
|
sl@0
|
127 |
default:
|
sl@0
|
128 |
return (TDesC&)KUnknownDesC;
|
sl@0
|
129 |
}
|
sl@0
|
130 |
}
|
sl@0
|
131 |
|
sl@0
|
132 |
_LIT(KCriticalStaticDesC, "CriticalStatic");
|
sl@0
|
133 |
_LIT(KCriticalDynamicDesC, "CriticalDynamic");
|
sl@0
|
134 |
_LIT(KNonCriticalDesC, "NonCritical");
|
sl@0
|
135 |
/**
|
sl@0
|
136 |
Converts a startup state into a string description of the enumeration
|
sl@0
|
137 |
@param aStartupStateIdentifier The startup state to retrieve a string description of
|
sl@0
|
138 |
@return The string description of aStartupStateIdentifier
|
sl@0
|
139 |
*/
|
sl@0
|
140 |
TPtrC CEComPerfTestBase::StartupStateName(TStartupStateIdentifier aStartupStateIdentifier)
|
sl@0
|
141 |
{
|
sl@0
|
142 |
switch (aStartupStateIdentifier)
|
sl@0
|
143 |
{
|
sl@0
|
144 |
case EStartupStateCriticalStatic:
|
sl@0
|
145 |
return (TDesC&)KCriticalStaticDesC;
|
sl@0
|
146 |
case EStartupStateCriticalDynamic:
|
sl@0
|
147 |
return (TDesC&)KCriticalDynamicDesC;
|
sl@0
|
148 |
case EStartupStateNonCritical:
|
sl@0
|
149 |
return (TDesC&)KNonCriticalDesC;
|
sl@0
|
150 |
default:
|
sl@0
|
151 |
return (TDesC&)KUnknownDesC;
|
sl@0
|
152 |
}
|
sl@0
|
153 |
}
|
sl@0
|
154 |
#endif // #ifdef __ECOM_SERVER_PERFORMANCE__
|
sl@0
|
155 |
|
sl@0
|
156 |
#ifndef __ECOM_SERVER_PERFORMANCE__
|
sl@0
|
157 |
void CEComPerfTestBase::MacroNotDefinedError()
|
sl@0
|
158 |
{
|
sl@0
|
159 |
SetTestStepResult(EFail);
|
sl@0
|
160 |
INFO_PRINTF1(_L("***Please define __ECOM_SERVER_PERFORMANCE__ macro to run this test ***"));
|
sl@0
|
161 |
}
|
sl@0
|
162 |
#endif // #ifndef __ECOM_SERVER_PERFORMANCE__
|