os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/Te_EComClientRequestPerfTestStep.cpp
Update contrib.
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 "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Te_EComClientRequrestPerfTestStep.cpp
15 // Tests the performance of ECom client calls
24 #include "Te_EComClientRequestPerfTestStep.h"
25 #include <ecom/ecom.h>
26 #include "Interface.h"
27 #include "EComSessionAux.h"
28 #include "EcomTestUtils.h"
29 #include <cs_subconparams.h>
30 #include "EComPerfTestDllTwo.h"
32 #ifdef __ECOM_SERVER_PERFORMANCE__
33 // Constants for list interface testing
34 // There should be a single implementation of this interface in EComPerfTestDllOne.dll
35 const TUid KUidListImplTestInterface = {0x10009DF3};
36 // The resolver implementation uid in EComClientRequestPerfTestResolver.dll
37 const TUid KCustomResolverImplementationUid = {0x10009DF8};
38 // Constants for create implementation testing
39 // these are implementations from EComPerfTestDllTwo.dll
40 const TUid KUidCreateImplementation = {0x10009DF6};
41 // There should be a single implementation of this interface in EComPerfTestDllTwo.dll
42 const TUid KUidCreateImplTestInterface = {0x10009DF4};
43 // Constants for GetExtendedInterface and ListExtendedInterface testing
44 // these are implementations from EComExample10.dll
45 const TUid KExample10ImplementationUid = {0x10009E38};
46 const TUid KExample10ImplementationUid2 = {0x10009E3A};
48 _LIT8(KExpectedDataTypeDllOne,"ECom_Performance1");
49 _LIT8(KExpectedDataTypeDllTwo,"ECom_Performance2-1");
50 _LIT8(KExpectedDataTypeExample10, "Example 10");
51 // Extended Interfaces
52 const TUid KExtendedInterfaceUid1 = {0x10009E44};
53 const TUid KExtendedInterfaceUid2 = {0x10009E45};
54 const TUid KExtendedInterfaceUid3 = {0x10009E46};
55 // Uids for list implementation and create implementation test with extended interfaces.
56 const TUid KExample10InterfaceUid = {0x10009DBB};
58 // Start-up urel/armv5 test limits for H2 RAM(non-NAND) hardware configuration. These figures were determined using benchmarks from the ONB&TR.
59 // Although these limits are passed to CheckPerformance() for non urel/armv5 testing this method
60 // does not test against them. It is disabled.
61 // The following constants are test limit allowances that are used for each client request test. The limit
62 // for each test is determined by adding together these limits as appropriate.
63 // We do not provide special set of constants for H2 NAND cofiguration because H2 NAND tests are not performed.
64 const TReal KBasicH2RAM = 5;
65 const TReal KSecurityInfoRetrievedH2RAM = 5;
66 const TReal KDefaultResolverH2RAM = 2;
67 const TReal KCustomResolverH2RAM = 5;
68 const TReal KDllLoadedH2RAM = 3;
69 const TReal KFetchExtendedInterfaceH2RAM = 1;
70 const TReal KListExtendedInterfacesH2RAM = 1;
71 const TReal KExtendedInterfacesMatchedH2RAM = 2;
72 // Start-up urel/armv5 test limits for H4 RAM(non-NAND) hardware configuration. These constants were determined using benchmarks from the ONB&TR.
73 const TReal KBasicH4RAM = 2;
74 const TReal KSecurityInfoRetrievedH4RAM = 3;
75 const TReal KDefaultResolverH4RAM = 1;
76 const TReal KCustomResolverH4RAM = 3;
77 const TReal KDllLoadedH4RAM = 2;
78 const TReal KFetchExtendedInterfaceH4RAM = 1;
79 const TReal KListExtendedInterfacesH4RAM = 1;
80 const TReal KExtendedInterfacesMatchedH4RAM = 1;
81 // Start-up urel/armv5 test limits for H4 NAND ROM configuration. These constants were determined using benchmarks from the ONB&TR.
82 const TReal KBasicH4NAND = 3;
83 const TReal KSecurityInfoRetrievedH4NAND = 9;
84 const TReal KDefaultResolverH4NAND = 2;
85 const TReal KCustomResolverH4NAND = 8;
86 const TReal KDllLoadedH4NAND = 7;
87 const TReal KFetchExtendedInterfaceH4NAND = 1;
88 const TReal KListExtendedInterfacesH4NAND = 1;
89 const TReal KExtendedInterfacesMatchedH4NAND = 2;
90 // Start-up urel/armv5 test limits for H6 RAM(non-NAND) hardware configuration. These constants were determined using benchmarks from the ONB&TR.
91 const TReal KBasicH6RAM = 1;
92 const TReal KSecurityInfoRetrievedH6RAM = 1.5;
93 const TReal KDefaultResolverH6RAM = 1;
94 const TReal KCustomResolverH6RAM = 1.5;
95 const TReal KDllLoadedH6RAM = 1;
96 const TReal KFetchExtendedInterfaceH6RAM = 1;
97 const TReal KListExtendedInterfacesH6RAM = 1;
98 const TReal KExtendedInterfacesMatchedH6RAM = 1;
99 // Start-up urel/armv5 test limits for H6 NAND ROM configuration. These constants were determined using benchmarks from the ONB&TR.
100 const TReal KBasicH6NAND = 1.5;
101 const TReal KSecurityInfoRetrievedH6NAND = 4;
102 const TReal KDefaultResolverH6NAND = 1;
103 const TReal KCustomResolverH6NAND = 4;
104 const TReal KDllLoadedH6NAND = 3;
105 const TReal KFetchExtendedInterfaceH6NAND = 1;
106 const TReal KListExtendedInterfacesH6NAND = 1;
107 const TReal KExtendedInterfacesMatchedH6NAND = 1;
108 //Specify the number of iterations to do to obtain the average value for API time measurement
109 const TInt KNumberIteration=10;
110 #endif // __ECOM_SERVER_PERFORMANCE__
112 CEComClientRequestsPerfTest::CEComClientRequestsPerfTest() : CEComPerfTestBase(KEComClientRequestsPerfTest)
116 CEComClientRequestsPerfTest::~CEComClientRequestsPerfTest()
120 #ifdef __ECOM_SERVER_PERFORMANCE__
121 void CEComClientRequestsPerfTest::WaitForDllUnload()
123 #if defined(__EPOC32__) && !defined(_DEBUG)
124 // Timeout to unload dll when lazy unload is enabled - which it is by default
125 // Used only for HW release builds
126 const TInt32 KLazyUnloadTimeout = 150000000; // 2.5 minutes
128 // Wait for DLL to unload - target release builds only
129 User::After(KLazyUnloadTimeout);
131 INFO_PRINTF1(_L("*** WARNING: Use results with care no delay for DLL to unload ***\n"));
132 #endif // #if defined(__EPOC32__) && !defined(_DEBUG)
135 #endif // __ECOM_SERVER_PERFORMANCE__
138 Test cases covered in the test step:
140 1. Time calls to ListImplementationsL and CreateImplementationL without resolver, with default resolver and
141 with custom resolver under various conditions.
142 1.1 ListImplementationL performance testing without extended interfaces.
143 1.2 CreateImplementationL performance testing without extended interfaces.
144 1.3 ListImplementationL performance testing with extended interfaces.(TestCaseID:SYSLIB-ECOM-CT-3598)
145 1.4 CreateImplementationL performance testing with extended interfaces.(TestCaseID:SYSLIB-ECOM-CT-3599)
147 2. Time calls to GetExtendedInterfaceL and ListExtendedInterfacesL under various conditions.
148 2.1 ListExtendedInterfacesL performance testing.(TestCaseID:SYSLIB-ECOM-CT-3600)
149 2.2 GetExtendedInterfaceL performance testing.(TestCaseID: SYSLIB-ECOM-CT-3601)
151 1.3,1.4,2.1 and 2.2 are test cases for EC43
152 @return EPass if the test completed successfully and the performance of the client calls are within the maximum
154 TVerdict CEComClientRequestsPerfTest::doTestStepL()
156 #ifdef __ECOM_SERVER_PERFORMANCE__
157 RImplInfoPtrArray ifArray;
158 RArray<TUid> extendedInterfaces;
159 CleanupClosePushL(extendedInterfaces);
160 extendedInterfaces.AppendL(KExtendedInterfaceUid1);
161 extendedInterfaces.AppendL(KExtendedInterfaceUid2);
162 extendedInterfaces.AppendL(KExtendedInterfaceUid3);
163 //set configuration-dependent timing limits (for non-NAND and NAND ROM configurations)
164 TReal limitBasic = 0;
165 TReal limitSecurityInfoRetrieved = 0;
166 TReal limitDefaultResolver = 0;
167 TReal limitCustomResolver = 0;
168 TReal limitDllLoaded = 0;
169 TReal limitFetchExtendedInterface = 0;
170 TReal limitListExtendedInterfaces = 0;
171 TReal limitExtendedInterfaceMatched = 0;
173 THardwareConfiguration hardware_configuration = EComTestUtils::GetHardwareConfiguration();
174 switch (hardware_configuration)
177 limitBasic = KBasicH2RAM;
178 limitSecurityInfoRetrieved = KSecurityInfoRetrievedH2RAM;
179 limitDefaultResolver = KDefaultResolverH2RAM;
180 limitCustomResolver = KCustomResolverH2RAM;
181 limitDllLoaded = KDllLoadedH2RAM;
182 limitFetchExtendedInterface = KFetchExtendedInterfaceH2RAM;
183 limitListExtendedInterfaces = KListExtendedInterfacesH2RAM;
184 limitExtendedInterfaceMatched = KExtendedInterfacesMatchedH2RAM;
185 INFO_PRINTF1(_L("Hardware configuration: H2 RAM"));
188 case EPlatformH2NAND:
189 INFO_PRINTF1(_L("Hardware configuration: H2 NAND"));
190 INFO_PRINTF1(_L("***Performance testing on H2 NAND is not supported!***"));
191 SetTestStepResult(EFail);
194 case EPlatformH2NANDDP:
195 INFO_PRINTF1(_L("Hardware configuration: H2 NAND DP"));
196 INFO_PRINTF1(_L("***Performance testing on H2 NAND DP is not supported!***"));
197 SetTestStepResult(EFail);
201 limitBasic = KBasicH4RAM;
202 limitSecurityInfoRetrieved = KSecurityInfoRetrievedH4RAM;
203 limitDefaultResolver = KDefaultResolverH4RAM;
204 limitCustomResolver = KCustomResolverH4RAM;
205 limitDllLoaded = KDllLoadedH4RAM;
206 limitFetchExtendedInterface = KFetchExtendedInterfaceH4RAM;
207 limitListExtendedInterfaces = KListExtendedInterfacesH4RAM;
208 limitExtendedInterfaceMatched = KExtendedInterfacesMatchedH4RAM;
209 INFO_PRINTF1(_L("Hardware configuration: H4 RAM"));
212 case EPlatformH4NAND:
213 limitBasic = KBasicH4NAND;
214 limitSecurityInfoRetrieved = KSecurityInfoRetrievedH4NAND;
215 limitDefaultResolver = KDefaultResolverH4NAND;
216 limitCustomResolver = KCustomResolverH4NAND;
217 limitDllLoaded = KDllLoadedH4NAND;
218 limitFetchExtendedInterface = KFetchExtendedInterfaceH4NAND;
219 limitListExtendedInterfaces = KListExtendedInterfacesH4NAND;
220 limitExtendedInterfaceMatched = KExtendedInterfacesMatchedH4NAND;
221 INFO_PRINTF1(_L("Hardware configuration: H4 NAND"));
224 case EPlatformH4NANDDP:
225 INFO_PRINTF1(_L("Hardware configuration: H4 NAND DP"));
229 limitBasic = KBasicH6RAM;
230 limitSecurityInfoRetrieved = KSecurityInfoRetrievedH6RAM;
231 limitDefaultResolver = KDefaultResolverH6RAM;
232 limitCustomResolver = KCustomResolverH6RAM;
233 limitDllLoaded = KDllLoadedH6RAM;
234 limitFetchExtendedInterface = KFetchExtendedInterfaceH6RAM;
235 limitListExtendedInterfaces = KListExtendedInterfacesH6RAM;
236 limitExtendedInterfaceMatched = KExtendedInterfacesMatchedH6RAM;
237 INFO_PRINTF1(_L("Hardware configuration: H6 RAM"));
240 case EPlatformH6NAND:
241 limitBasic = KBasicH6NAND;
242 limitSecurityInfoRetrieved = KSecurityInfoRetrievedH6NAND;
243 limitDefaultResolver = KDefaultResolverH6NAND;
244 limitCustomResolver = KCustomResolverH6NAND;
245 limitDllLoaded = KDllLoadedH6NAND;
246 limitFetchExtendedInterface = KFetchExtendedInterfaceH6NAND;
247 limitListExtendedInterfaces = KListExtendedInterfacesH6NAND;
248 limitExtendedInterfaceMatched = KExtendedInterfacesMatchedH6NAND;
249 INFO_PRINTF1(_L("Hardware configuration: H6 NAND"));
251 case EPlatformH6NANDDP:
252 INFO_PRINTF1(_L("Hardware configuration: H6 NAND DP"));
255 case EPlatformWINSCW:
256 INFO_PRINTF1(_L("Hardware configuration: WINSCW"));
260 INFO_PRINTF1(_L("***Unrecognized platform!***"));
261 SetTestStepResult(EFail);
266 // 1.1 ListImplementationL performance testing without extended interfaces.
269 INFO_PRINTF1(_L("Time servicing ListImplementationsL requests - each request returns 4 implementations:\n"));
271 // Time ListImplementationsL without resolver
273 TInt startTime = User::FastCounter();
274 REComSession::ListImplementationsL(KUidListImplTestInterface, ifArray);
275 TInt endTime = User::FastCounter();
276 TEST(ifArray.Count()==4);
277 ifArray.ResetAndDestroy();
278 TReal netTime = FastCountToMilliseconds(endTime-startTime);
279 CheckPerformance(netTime, limitBasic+limitSecurityInfoRetrieved, _L("Call with: no resolver, security info retrieval"));
282 // Average Time over KNumberIteration ListImplementationsL without resolver when the DLL security info is cached
285 for (TInt i=0;i<KNumberIteration;i++)
287 startTime = User::FastCounter();
288 REComSession::ListImplementationsL(KUidListImplTestInterface, ifArray);
289 endTime = User::FastCounter();
290 TEST(ifArray.Count()==4);
291 ifArray.ResetAndDestroy();
292 totalTime+=(endTime-startTime);
294 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
295 CheckPerformance(netTime, limitBasic, _L("Call with: no resolver, security info cached"));
298 // Average Time over KNumberIteration ListImplementationsL with default resolver when the DLL security info is cached
301 TEComResolverParams params;
302 params.SetDataType(KExpectedDataTypeDllOne());
303 params.SetGenericMatch(ETrue);
304 for (TInt i=0;i<KNumberIteration;i++)
306 startTime = User::FastCounter();
307 REComSession::ListImplementationsL(KUidListImplTestInterface, params, ifArray);
308 endTime = User::FastCounter();
309 TEST(ifArray.Count()==4);
310 ifArray.ResetAndDestroy();
311 totalTime+=(endTime-startTime);
313 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
314 CheckPerformance(netTime, limitBasic+limitDefaultResolver, _L("Call with: default resolver, security info cached"));
317 // Average Time over KNumberIteration ListImplementationsL with custom resolver when the DLL security check is cached
320 for (TInt i=0;i<KNumberIteration;i++)
322 startTime = User::FastCounter();
323 REComSession::ListImplementationsL(KUidListImplTestInterface, params, KCustomResolverImplementationUid, ifArray);
324 endTime = User::FastCounter();
325 TEST(ifArray.Count()==4);
326 ifArray.ResetAndDestroy();
327 totalTime+=(endTime-startTime);
329 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
330 CheckPerformance(netTime, limitBasic+limitCustomResolver, _L("Call with: custom resolver, security info cached"));
333 // 1.2 CreateImplementationL performance testing without extended interfaces.
335 INFO_PRINTF1(_L("Time servicing CreateImplementationL requests:\n"));
337 // Time Create Implementation without resolver with retrieval of security info and dll will be loaded
339 TUid ecomDestructorId;
340 startTime = User::FastCounter();
341 CImplementationClassExampleTwo *ecomPtr = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(KUidCreateImplementation, ecomDestructorId);
342 endTime = User::FastCounter();
343 REComSession::DestroyedImplementation(ecomDestructorId);
345 netTime = FastCountToMilliseconds(endTime-startTime);
346 CheckPerformance(netTime, limitBasic+limitDllLoaded+limitSecurityInfoRetrieved, _L("Call with: no resolver, dll to be loaded, security info retrieval"));
347 REComSession::FinalClose();
352 // Time CreateImplementation without resolver when the DLL security info cached and dll will be loaded
354 startTime = User::FastCounter();
355 ecomPtr = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(KUidCreateImplementation, ecomDestructorId);
356 endTime = User::FastCounter();
357 netTime = FastCountToMilliseconds(endTime-startTime);
358 CheckPerformance(netTime, limitBasic+limitDllLoaded, _L("Call with: no resolver, dll to be loaded, security info cached"));
361 // Average Time over KNumberIteration CreateImplementation without resolver when the DLL security info is cached and dll is already
365 CImplementationClassExampleTwo *ecomPtr2=NULL;
366 TUid ecomDestructorId2;
367 for (TInt i=0;i<KNumberIteration;i++)
369 startTime = User::FastCounter();
370 ecomPtr2 = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(KUidCreateImplementation, ecomDestructorId2);
371 endTime = User::FastCounter();
372 totalTime+=endTime-startTime;
373 REComSession::DestroyedImplementation(ecomDestructorId2);
376 REComSession::DestroyedImplementation(ecomDestructorId);
378 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
379 CheckPerformance(netTime, limitBasic, _L("Call with: no resolver, dll already loaded, security info cached"));
380 REComSession::FinalClose();
385 // Time CreateImplementation with default resolver when the DLL security info cached and dll must be loaded
387 params.SetDataType(KExpectedDataTypeDllTwo);
388 startTime = User::FastCounter();
389 ecomPtr = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(KUidCreateImplTestInterface, ecomDestructorId, params);
390 endTime = User::FastCounter();
391 netTime = FastCountToMilliseconds(endTime-startTime);
392 CheckPerformance(netTime, limitBasic+limitDefaultResolver+limitDllLoaded, _L("Call with: default resolver, dll to be loaded, security info cached"));
395 // Average Time over KNumberIteration CreateImplementation with default resolver when the DLL security info is cached and dll is already
399 for (TInt i=0;i<KNumberIteration;i++)
401 startTime = User::FastCounter();
402 ecomPtr2 = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(KUidCreateImplTestInterface, ecomDestructorId2, params);
403 endTime = User::FastCounter();
404 totalTime+=endTime-startTime;
405 REComSession::DestroyedImplementation(ecomDestructorId2);
408 REComSession::DestroyedImplementation(ecomDestructorId);
410 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
411 CheckPerformance(netTime, limitBasic+limitDefaultResolver, _L("Call with: default resolver, dll already loaded, security info cached"));
412 REComSession::FinalClose();
417 // Time CreateImplementation with custom resolver when the DLL security info cached and dll must be loaded
419 startTime = User::FastCounter();
420 ecomPtr = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(
421 KUidCreateImplTestInterface, ecomDestructorId, params, KCustomResolverImplementationUid);
422 endTime = User::FastCounter();
423 netTime = FastCountToMilliseconds(endTime-startTime);
424 CheckPerformance(netTime, limitBasic+limitCustomResolver+limitDllLoaded, _L("Call with: custom resolver, dll to be loaded, security info cached"));
427 // Average Time over KNumberIteration CreateImplementation with default resolver when the DLL security info is cached and dll is already
431 for (TInt i=0;i<KNumberIteration;i++)
433 startTime = User::FastCounter();
434 ecomPtr2 = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(
435 KUidCreateImplTestInterface, ecomDestructorId2, params, KCustomResolverImplementationUid);
436 endTime = User::FastCounter();
437 totalTime+=endTime-startTime;
438 REComSession::DestroyedImplementation(ecomDestructorId2);
441 REComSession::DestroyedImplementation(ecomDestructorId);
443 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
444 CheckPerformance(netTime, limitBasic+limitCustomResolver, _L("Call with: custom resolver, dll already loaded, security info cached"));
447 // 1.3 ListImplementationL performance testing with extended interfaces.
450 INFO_PRINTF1(_L("Time servicing ListImplementationsL with extended interfaces requests:\n"));
452 // Time ListImplementationsL with extended interfaces without resolver
454 startTime = User::FastCounter();
455 REComSession::ListImplementationsL(KExample10InterfaceUid, extendedInterfaces, ifArray);
456 endTime = User::FastCounter();
457 TEST(ifArray.Count() == 1);
458 ifArray.ResetAndDestroy();
459 netTime = FastCountToMilliseconds(endTime-startTime);
460 CheckPerformance(netTime, limitBasic+limitSecurityInfoRetrieved+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, no resolver, security info retrieval"));
463 // Average Time over KNumberIteration ListImplementationsL with extended interfaces,without resolver when the DLL security info is cached
466 for (TInt i = 0; i < KNumberIteration; i++)
468 startTime = User::FastCounter();
469 REComSession::ListImplementationsL(KExample10InterfaceUid, extendedInterfaces, ifArray);
470 endTime = User::FastCounter();
471 TEST(ifArray.Count() == 1);
472 ifArray.ResetAndDestroy();
473 totalTime += (endTime-startTime);
475 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
476 CheckPerformance(netTime, limitBasic+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, no resolver, security info cached"));
479 // Average Time over KNumberIteration ListImplementationsL with extended interfaces, with default resolver when the DLL security info is cached
482 params.SetDataType(KExpectedDataTypeExample10());
483 params.SetGenericMatch(ETrue);
484 for (TInt i = 0; i < KNumberIteration; i++)
486 startTime = User::FastCounter();
487 REComSession::ListImplementationsL(KExample10InterfaceUid, extendedInterfaces, params, ifArray);
488 endTime = User::FastCounter();
489 TEST(ifArray.Count() == 1);
490 ifArray.ResetAndDestroy();
491 totalTime += (endTime-startTime);
493 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
494 CheckPerformance(netTime, limitBasic+limitDefaultResolver+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, default resolver, security info cached"));
497 // Average Time over KNumberIteration ListImplementationsL with extended interfaces, with custom resolver when the DLL security check is cached
500 for (TInt i = 0; i < KNumberIteration; i++)
502 startTime = User::FastCounter();
503 REComSession::ListImplementationsL(KExample10InterfaceUid, extendedInterfaces, params, KCustomResolverImplementationUid, ifArray);
504 endTime = User::FastCounter();
505 TEST(ifArray.Count() == 1);
506 ifArray.ResetAndDestroy();
507 totalTime += (endTime-startTime);
509 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
510 CheckPerformance(netTime, limitBasic+limitCustomResolver+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, custom resolver, security info cached"));
513 // 1.4 CreateImplementationL performance testing with extended interfaces.
515 CExampleInterface* dllPtr = NULL;
516 CExampleInterface* dllPtr2 = NULL;
518 INFO_PRINTF1(_L("Time servicing CreateImplementationsL with extended interfaces requests:\n"));
520 // Time CreateImplementation with extended interfaces, default resolver when the DLL security info cached and dll must be loaded
522 params.SetDataType(KExpectedDataTypeExample10);
523 startTime = User::FastCounter();
524 dllPtr = reinterpret_cast<CExampleInterface*>(REComSession::CreateImplementationL(KExample10InterfaceUid, extendedInterfaces, ecomDestructorId, params));
525 endTime = User::FastCounter();
526 netTime = FastCountToMilliseconds(endTime-startTime);
527 CheckPerformance(netTime, limitBasic+limitDefaultResolver+limitDllLoaded+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, default resolver, dll to be loaded, security info cached"));
530 // Average Time over KNumberIteration CreateImplementation with extended interfaces, default resolver when the DLL security info is cached and dll is already
534 for (TInt i = 0; i < KNumberIteration; i++)
536 startTime = User::FastCounter();
537 dllPtr2 = reinterpret_cast<CExampleInterface*>(REComSession::CreateImplementationL(KExample10InterfaceUid, extendedInterfaces, ecomDestructorId2, params));
538 endTime = User::FastCounter();
539 totalTime += endTime-startTime;
540 REComSession::DestroyedImplementation(ecomDestructorId2);
543 REComSession::DestroyedImplementation(ecomDestructorId);
545 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
546 CheckPerformance(netTime, limitBasic+limitDefaultResolver+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, default resolver, dll already loaded, security info cached"));
547 REComSession::FinalClose();
551 // Time CreateImplementation with extended interfaces, custom resolver when the DLL security info cached and dll must be loaded
553 startTime = User::FastCounter();
554 dllPtr = reinterpret_cast<CExampleInterface*>(REComSession::CreateImplementationL(
555 KExample10InterfaceUid, extendedInterfaces, ecomDestructorId, params, KCustomResolverImplementationUid));
556 endTime = User::FastCounter();
557 netTime = FastCountToMilliseconds(endTime-startTime);
558 CheckPerformance(netTime, limitBasic+limitCustomResolver+limitDllLoaded+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, custom resolver, dll to be loaded, security info cached"));
561 // Average Time over KNumberIteration CreateImplementation with extended interfaces, custom resolver when the DLL security info is cached and dll is already
565 for (TInt i = 0; i < KNumberIteration; i++)
567 startTime = User::FastCounter();
568 dllPtr2 = reinterpret_cast<CExampleInterface*>(REComSession::CreateImplementationL(
569 KExample10InterfaceUid, extendedInterfaces, ecomDestructorId2, params, KCustomResolverImplementationUid));
570 endTime = User::FastCounter();
571 totalTime += endTime-startTime;
572 REComSession::DestroyedImplementation(ecomDestructorId2);
575 REComSession::DestroyedImplementation(ecomDestructorId);
577 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
578 CheckPerformance(netTime, limitBasic+limitCustomResolver+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, custom resolver, dll already loaded, security info cached"));
580 REComSession::FinalClose();
582 CleanupStack::PopAndDestroy(&extendedInterfaces);
585 // 2.1 ListExtendedInterfacesL performance testing.
588 CleanupClosePushL(ifInfo);
590 for (TInt i = 0; i < KNumberIteration; i++)
592 startTime = User::FastCounter();
593 REComSession::ListExtendedInterfacesL(KExample10ImplementationUid,ifInfo);
594 endTime = User::FastCounter();
595 // Ensure test is valid by testing return parameters
596 TEST(ifInfo.Count() == 3);
597 totalTime += endTime-startTime;
600 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
601 CheckPerformance(netTime, limitListExtendedInterfaces, _L("List extended interface. Three interfaces returned."));
603 // Test with no interfaces returned
605 for (TInt i = 0; i < KNumberIteration; i++)
607 startTime = User::FastCounter();
608 REComSession::ListExtendedInterfacesL(KExample10ImplementationUid2,ifInfo);
609 endTime = User::FastCounter();
610 // Ensure test is valid by testing return parameters
611 TEST(ifInfo.Count() == 0);
612 totalTime += endTime-startTime;
615 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
616 CheckPerformance(netTime, limitListExtendedInterfaces, _L("List extended interface. No interface returned."));
617 CleanupStack::PopAndDestroy(&ifInfo);
620 // 2.2 GetExtendedInterfaceL performance testing.
624 // Set up some empty initialisation parameters
625 CExampleInterface::TExampleInterfaceInitParams initParams;
626 initParams.integer = 0;
627 initParams.descriptor = NULL;
628 dllPtr = REINTERPRET_CAST(CExampleInterface*,
629 REComSession::CreateImplementationL(KExample10ImplementationUid,
633 // Call extended interface here.
635 for (TInt i = 0; i < KNumberIteration; i++)
637 startTime = User::FastCounter();
638 MExampleInterfaceExtended* ext1 = static_cast<MExampleInterfaceExtended*>(REComSession::GetExtendedInterfaceL(instanceKey, KExtendedInterfaceUid1 ));
639 endTime = User::FastCounter();
640 totalTime += endTime - startTime;
642 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
643 CheckPerformance(netTime, limitFetchExtendedInterface, _L("Get extended interface. Interface is part of main instantiation object."));
645 for (TInt i = 0; i < KNumberIteration; i++)
647 startTime = User::FastCounter();
648 MExampleInterfaceExtended2* ext2 = static_cast<MExampleInterfaceExtended2*>(REComSession::GetExtendedInterfaceL(instanceKey, KExtendedInterfaceUid2 ));
649 endTime = User::FastCounter();
650 totalTime += endTime - startTime;
652 netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
653 CheckPerformance(netTime, limitFetchExtendedInterface, _L("Get extended interface. Interface is separate object."));
654 REComSession::DestroyedImplementation(instanceKey);
656 REComSession::FinalClose();
658 MacroNotDefinedError();
659 #endif // __ECOM_SERVER_PERFORMANCE__
660 return TestStepResult();