os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/Te_EComClientRequestPerfTestStep.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
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
// Te_EComClientRequrestPerfTestStep.cpp
sl@0
    15
// Tests the performance of ECom client calls
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
/**
sl@0
    20
 @file
sl@0
    21
 @internalComponent
sl@0
    22
*/
sl@0
    23
sl@0
    24
#include "Te_EComClientRequestPerfTestStep.h"
sl@0
    25
#include <ecom/ecom.h>
sl@0
    26
#include "Interface.h"
sl@0
    27
#include "EComSessionAux.h"
sl@0
    28
#include "EcomTestUtils.h"
sl@0
    29
#include <cs_subconparams.h>
sl@0
    30
#include "EComPerfTestDllTwo.h"
sl@0
    31
sl@0
    32
#ifdef __ECOM_SERVER_PERFORMANCE__
sl@0
    33
// Constants for list interface testing
sl@0
    34
// There should be a single implementation of this interface in EComPerfTestDllOne.dll
sl@0
    35
const TUid KUidListImplTestInterface = {0x10009DF3};
sl@0
    36
// The resolver implementation uid in EComClientRequestPerfTestResolver.dll
sl@0
    37
const TUid KCustomResolverImplementationUid = {0x10009DF8};
sl@0
    38
// Constants for create implementation testing
sl@0
    39
// these are implementations from EComPerfTestDllTwo.dll
sl@0
    40
const TUid KUidCreateImplementation = {0x10009DF6};
sl@0
    41
// There should be a single implementation of this interface in EComPerfTestDllTwo.dll
sl@0
    42
const TUid KUidCreateImplTestInterface = {0x10009DF4};
sl@0
    43
// Constants for GetExtendedInterface and ListExtendedInterface testing
sl@0
    44
// these are implementations from EComExample10.dll
sl@0
    45
const TUid KExample10ImplementationUid = {0x10009E38};
sl@0
    46
const TUid KExample10ImplementationUid2 = {0x10009E3A};
sl@0
    47
// Expected data type
sl@0
    48
_LIT8(KExpectedDataTypeDllOne,"ECom_Performance1");
sl@0
    49
_LIT8(KExpectedDataTypeDllTwo,"ECom_Performance2-1");
sl@0
    50
_LIT8(KExpectedDataTypeExample10, "Example 10");
sl@0
    51
// Extended Interfaces
sl@0
    52
const TUid KExtendedInterfaceUid1 = {0x10009E44};
sl@0
    53
const TUid KExtendedInterfaceUid2 = {0x10009E45};
sl@0
    54
const TUid KExtendedInterfaceUid3 = {0x10009E46};
sl@0
    55
// Uids for list implementation and create implementation test with extended interfaces. 
sl@0
    56
const TUid KExample10InterfaceUid = {0x10009DBB}; 
sl@0
    57
sl@0
    58
// Start-up urel/armv5 test limits for H2 RAM(non-NAND) hardware configuration. These figures were determined using benchmarks from the ONB&TR.
sl@0
    59
// Although these limits are passed to CheckPerformance() for non urel/armv5 testing this method
sl@0
    60
// does not test against them. It is disabled.
sl@0
    61
// The following constants are test limit allowances that are used for each client request test. The limit
sl@0
    62
// for each test is determined by adding together these limits as appropriate.
sl@0
    63
// We do not provide special set of constants for H2 NAND cofiguration because H2 NAND tests are not performed.
sl@0
    64
const TReal KBasicH2RAM = 5;
sl@0
    65
const TReal KSecurityInfoRetrievedH2RAM = 5;
sl@0
    66
const TReal KDefaultResolverH2RAM = 2;
sl@0
    67
const TReal KCustomResolverH2RAM = 5;
sl@0
    68
const TReal KDllLoadedH2RAM = 3;
sl@0
    69
const TReal KFetchExtendedInterfaceH2RAM = 1; 
sl@0
    70
const TReal KListExtendedInterfacesH2RAM = 1;
sl@0
    71
const TReal KExtendedInterfacesMatchedH2RAM = 2; 
sl@0
    72
// Start-up urel/armv5 test limits for H4 RAM(non-NAND) hardware configuration. These constants were determined using benchmarks from the ONB&TR.
sl@0
    73
const TReal KBasicH4RAM = 2;
sl@0
    74
const TReal KSecurityInfoRetrievedH4RAM = 3;
sl@0
    75
const TReal KDefaultResolverH4RAM = 1;
sl@0
    76
const TReal KCustomResolverH4RAM = 3;
sl@0
    77
const TReal KDllLoadedH4RAM = 2;
sl@0
    78
const TReal KFetchExtendedInterfaceH4RAM = 1; 
sl@0
    79
const TReal KListExtendedInterfacesH4RAM = 1; 
sl@0
    80
const TReal KExtendedInterfacesMatchedH4RAM = 1; 
sl@0
    81
// Start-up urel/armv5 test limits for H4 NAND ROM configuration. These constants were determined using benchmarks from the ONB&TR.
sl@0
    82
const TReal KBasicH4NAND = 3;
sl@0
    83
const TReal KSecurityInfoRetrievedH4NAND = 9;
sl@0
    84
const TReal KDefaultResolverH4NAND = 2;
sl@0
    85
const TReal KCustomResolverH4NAND = 8;
sl@0
    86
const TReal KDllLoadedH4NAND = 7;
sl@0
    87
const TReal KFetchExtendedInterfaceH4NAND = 1; 
sl@0
    88
const TReal KListExtendedInterfacesH4NAND = 1; 
sl@0
    89
const TReal KExtendedInterfacesMatchedH4NAND = 2; 
sl@0
    90
// Start-up urel/armv5 test limits for H6 RAM(non-NAND) hardware configuration. These constants were determined using benchmarks from the ONB&TR.
sl@0
    91
const TReal KBasicH6RAM = 1;
sl@0
    92
const TReal KSecurityInfoRetrievedH6RAM = 1.5;
sl@0
    93
const TReal KDefaultResolverH6RAM = 1;
sl@0
    94
const TReal KCustomResolverH6RAM = 1.5;
sl@0
    95
const TReal KDllLoadedH6RAM = 1;
sl@0
    96
const TReal KFetchExtendedInterfaceH6RAM = 1; 
sl@0
    97
const TReal KListExtendedInterfacesH6RAM = 1; 
sl@0
    98
const TReal KExtendedInterfacesMatchedH6RAM = 1; 
sl@0
    99
// Start-up urel/armv5 test limits for H6 NAND ROM configuration. These constants were determined using benchmarks from the ONB&TR.
sl@0
   100
const TReal KBasicH6NAND = 1.5;
sl@0
   101
const TReal KSecurityInfoRetrievedH6NAND = 4;
sl@0
   102
const TReal KDefaultResolverH6NAND = 1;
sl@0
   103
const TReal KCustomResolverH6NAND = 4;
sl@0
   104
const TReal KDllLoadedH6NAND = 3;
sl@0
   105
const TReal KFetchExtendedInterfaceH6NAND = 1; 
sl@0
   106
const TReal KListExtendedInterfacesH6NAND = 1; 
sl@0
   107
const TReal KExtendedInterfacesMatchedH6NAND = 1; 
sl@0
   108
//Specify the number of iterations to do to obtain the average value for API time measurement
sl@0
   109
const TInt KNumberIteration=10;
sl@0
   110
#endif // __ECOM_SERVER_PERFORMANCE__
sl@0
   111
sl@0
   112
CEComClientRequestsPerfTest::CEComClientRequestsPerfTest() : CEComPerfTestBase(KEComClientRequestsPerfTest)
sl@0
   113
	{
sl@0
   114
	}
sl@0
   115
sl@0
   116
CEComClientRequestsPerfTest::~CEComClientRequestsPerfTest()
sl@0
   117
	{
sl@0
   118
	}
sl@0
   119
sl@0
   120
#ifdef __ECOM_SERVER_PERFORMANCE__
sl@0
   121
void CEComClientRequestsPerfTest::WaitForDllUnload()
sl@0
   122
	{
sl@0
   123
#if defined(__EPOC32__) && !defined(_DEBUG)
sl@0
   124
	// Timeout to unload dll when lazy unload is enabled - which it is by default
sl@0
   125
	// Used only for HW release builds
sl@0
   126
	const TInt32 KLazyUnloadTimeout = 150000000; // 2.5 minutes
sl@0
   127
sl@0
   128
	// Wait for DLL to unload - target release builds only
sl@0
   129
	User::After(KLazyUnloadTimeout);
sl@0
   130
#else
sl@0
   131
	INFO_PRINTF1(_L("*** WARNING: Use results with care no delay for DLL to unload ***\n"));
sl@0
   132
#endif // #if defined(__EPOC32__) && !defined(_DEBUG)
sl@0
   133
sl@0
   134
	}
sl@0
   135
#endif // __ECOM_SERVER_PERFORMANCE__
sl@0
   136
sl@0
   137
/*
sl@0
   138
 Test cases covered in the test step:
sl@0
   139
 
sl@0
   140
 1. Time calls to ListImplementationsL and CreateImplementationL without resolver, with default resolver and 
sl@0
   141
 with custom resolver under various conditions.
sl@0
   142
 	1.1 ListImplementationL performance testing without extended interfaces.
sl@0
   143
 	1.2 CreateImplementationL performance testing without extended interfaces.
sl@0
   144
 	1.3 ListImplementationL performance testing with extended interfaces.(TestCaseID:SYSLIB-ECOM-CT-3598)
sl@0
   145
 	1.4 CreateImplementationL performance testing with extended interfaces.(TestCaseID:SYSLIB-ECOM-CT-3599)
sl@0
   146
 
sl@0
   147
 2. Time calls to GetExtendedInterfaceL and ListExtendedInterfacesL under various conditions.
sl@0
   148
 	2.1 ListExtendedInterfacesL performance testing.(TestCaseID:SYSLIB-ECOM-CT-3600)
sl@0
   149
 	2.2 GetExtendedInterfaceL performance testing.(TestCaseID: SYSLIB-ECOM-CT-3601)
sl@0
   150
sl@0
   151
 1.3,1.4,2.1 and 2.2 are test cases for EC43
sl@0
   152
 @return EPass if the test completed successfully and the performance of the client calls are within the maximum
sl@0
   153
*/
sl@0
   154
TVerdict CEComClientRequestsPerfTest::doTestStepL()
sl@0
   155
	{
sl@0
   156
#ifdef __ECOM_SERVER_PERFORMANCE__
sl@0
   157
	RImplInfoPtrArray ifArray;
sl@0
   158
	RArray<TUid> extendedInterfaces;
sl@0
   159
	CleanupClosePushL(extendedInterfaces);
sl@0
   160
	extendedInterfaces.AppendL(KExtendedInterfaceUid1);
sl@0
   161
	extendedInterfaces.AppendL(KExtendedInterfaceUid2);
sl@0
   162
	extendedInterfaces.AppendL(KExtendedInterfaceUid3);
sl@0
   163
	//set configuration-dependent timing limits (for non-NAND and NAND ROM configurations)
sl@0
   164
	TReal limitBasic = 0;
sl@0
   165
	TReal limitSecurityInfoRetrieved = 0;
sl@0
   166
	TReal limitDefaultResolver = 0;
sl@0
   167
	TReal limitCustomResolver = 0;
sl@0
   168
	TReal limitDllLoaded = 0;
sl@0
   169
	TReal limitFetchExtendedInterface = 0;
sl@0
   170
	TReal limitListExtendedInterfaces = 0;
sl@0
   171
	TReal limitExtendedInterfaceMatched = 0;
sl@0
   172
	
sl@0
   173
	THardwareConfiguration hardware_configuration = EComTestUtils::GetHardwareConfiguration();
sl@0
   174
	switch (hardware_configuration)
sl@0
   175
		{
sl@0
   176
		case EPlatformH2RAM:
sl@0
   177
	    	limitBasic = KBasicH2RAM;
sl@0
   178
			limitSecurityInfoRetrieved = KSecurityInfoRetrievedH2RAM;
sl@0
   179
			limitDefaultResolver = KDefaultResolverH2RAM;
sl@0
   180
			limitCustomResolver = KCustomResolverH2RAM;
sl@0
   181
			limitDllLoaded = KDllLoadedH2RAM;
sl@0
   182
			limitFetchExtendedInterface = KFetchExtendedInterfaceH2RAM;
sl@0
   183
			limitListExtendedInterfaces = KListExtendedInterfacesH2RAM;
sl@0
   184
			limitExtendedInterfaceMatched = KExtendedInterfacesMatchedH2RAM;
sl@0
   185
			INFO_PRINTF1(_L("Hardware configuration: H2 RAM"));
sl@0
   186
			break;
sl@0
   187
			
sl@0
   188
		case EPlatformH2NAND:
sl@0
   189
			INFO_PRINTF1(_L("Hardware configuration: H2 NAND"));
sl@0
   190
			INFO_PRINTF1(_L("***Performance testing on H2 NAND is not supported!***"));
sl@0
   191
			SetTestStepResult(EFail);			
sl@0
   192
			break;
sl@0
   193
			
sl@0
   194
		case EPlatformH2NANDDP:
sl@0
   195
			INFO_PRINTF1(_L("Hardware configuration: H2 NAND DP"));
sl@0
   196
			INFO_PRINTF1(_L("***Performance testing on H2 NAND DP is not supported!***"));
sl@0
   197
			SetTestStepResult(EFail);			
sl@0
   198
			break;
sl@0
   199
		
sl@0
   200
		case EPlatformH4RAM:
sl@0
   201
			limitBasic = KBasicH4RAM;
sl@0
   202
			limitSecurityInfoRetrieved = KSecurityInfoRetrievedH4RAM;
sl@0
   203
			limitDefaultResolver = KDefaultResolverH4RAM;
sl@0
   204
			limitCustomResolver = KCustomResolverH4RAM;
sl@0
   205
			limitDllLoaded = KDllLoadedH4RAM;
sl@0
   206
			limitFetchExtendedInterface = KFetchExtendedInterfaceH4RAM;
sl@0
   207
			limitListExtendedInterfaces = KListExtendedInterfacesH4RAM;
sl@0
   208
			limitExtendedInterfaceMatched = KExtendedInterfacesMatchedH4RAM;
sl@0
   209
			INFO_PRINTF1(_L("Hardware configuration: H4 RAM"));
sl@0
   210
			break;
sl@0
   211
		
sl@0
   212
		case EPlatformH4NAND:		
sl@0
   213
			limitBasic = KBasicH4NAND;
sl@0
   214
			limitSecurityInfoRetrieved = KSecurityInfoRetrievedH4NAND;
sl@0
   215
			limitDefaultResolver = KDefaultResolverH4NAND;
sl@0
   216
			limitCustomResolver = KCustomResolverH4NAND;
sl@0
   217
			limitDllLoaded = KDllLoadedH4NAND;
sl@0
   218
			limitFetchExtendedInterface = KFetchExtendedInterfaceH4NAND;
sl@0
   219
			limitListExtendedInterfaces = KListExtendedInterfacesH4NAND;
sl@0
   220
			limitExtendedInterfaceMatched = KExtendedInterfacesMatchedH4NAND;			
sl@0
   221
			INFO_PRINTF1(_L("Hardware configuration: H4 NAND"));			
sl@0
   222
			break;
sl@0
   223
		
sl@0
   224
		case EPlatformH4NANDDP:	
sl@0
   225
			INFO_PRINTF1(_L("Hardware configuration: H4 NAND DP"));
sl@0
   226
			break;
sl@0
   227
			
sl@0
   228
		case EPlatformH6RAM:
sl@0
   229
			limitBasic = KBasicH6RAM;
sl@0
   230
			limitSecurityInfoRetrieved = KSecurityInfoRetrievedH6RAM;
sl@0
   231
			limitDefaultResolver = KDefaultResolverH6RAM;
sl@0
   232
			limitCustomResolver = KCustomResolverH6RAM;
sl@0
   233
			limitDllLoaded = KDllLoadedH6RAM;
sl@0
   234
			limitFetchExtendedInterface = KFetchExtendedInterfaceH6RAM;
sl@0
   235
			limitListExtendedInterfaces = KListExtendedInterfacesH6RAM;
sl@0
   236
			limitExtendedInterfaceMatched = KExtendedInterfacesMatchedH6RAM;
sl@0
   237
			INFO_PRINTF1(_L("Hardware configuration: H6 RAM"));
sl@0
   238
			break;
sl@0
   239
		
sl@0
   240
		case EPlatformH6NAND:		
sl@0
   241
			limitBasic = KBasicH6NAND;
sl@0
   242
			limitSecurityInfoRetrieved = KSecurityInfoRetrievedH6NAND;
sl@0
   243
			limitDefaultResolver = KDefaultResolverH6NAND;
sl@0
   244
			limitCustomResolver = KCustomResolverH6NAND;
sl@0
   245
			limitDllLoaded = KDllLoadedH6NAND;
sl@0
   246
			limitFetchExtendedInterface = KFetchExtendedInterfaceH6NAND;
sl@0
   247
			limitListExtendedInterfaces = KListExtendedInterfacesH6NAND;
sl@0
   248
			limitExtendedInterfaceMatched = KExtendedInterfacesMatchedH6NAND;			
sl@0
   249
			INFO_PRINTF1(_L("Hardware configuration: H6 NAND"));			
sl@0
   250
			break;
sl@0
   251
		case EPlatformH6NANDDP:	
sl@0
   252
			INFO_PRINTF1(_L("Hardware configuration: H6 NAND DP"));
sl@0
   253
			break;
sl@0
   254
		
sl@0
   255
		case EPlatformWINSCW:
sl@0
   256
			INFO_PRINTF1(_L("Hardware configuration: WINSCW"));
sl@0
   257
			break;
sl@0
   258
		
sl@0
   259
		default:
sl@0
   260
			INFO_PRINTF1(_L("***Unrecognized platform!***"));
sl@0
   261
			SetTestStepResult(EFail);
sl@0
   262
			break;		
sl@0
   263
		}
sl@0
   264
sl@0
   265
	//
sl@0
   266
	// 1.1 ListImplementationL performance testing without extended interfaces.
sl@0
   267
	//
sl@0
   268
	TInt totalTime=0;
sl@0
   269
	INFO_PRINTF1(_L("Time servicing ListImplementationsL requests - each request returns 4 implementations:\n"));
sl@0
   270
	//
sl@0
   271
	// Time ListImplementationsL without resolver
sl@0
   272
	//
sl@0
   273
	TInt startTime = User::FastCounter();
sl@0
   274
	REComSession::ListImplementationsL(KUidListImplTestInterface, ifArray);
sl@0
   275
	TInt endTime = User::FastCounter();
sl@0
   276
	TEST(ifArray.Count()==4);
sl@0
   277
	ifArray.ResetAndDestroy();
sl@0
   278
	TReal netTime = FastCountToMilliseconds(endTime-startTime);
sl@0
   279
	CheckPerformance(netTime, limitBasic+limitSecurityInfoRetrieved, _L("Call with: no resolver, security info retrieval"));
sl@0
   280
sl@0
   281
	//
sl@0
   282
	// Average Time over KNumberIteration ListImplementationsL without resolver when the DLL security info is cached
sl@0
   283
	//
sl@0
   284
	totalTime=0;
sl@0
   285
	for (TInt i=0;i<KNumberIteration;i++)
sl@0
   286
		{
sl@0
   287
		startTime = User::FastCounter();
sl@0
   288
		REComSession::ListImplementationsL(KUidListImplTestInterface, ifArray);
sl@0
   289
		endTime = User::FastCounter();
sl@0
   290
		TEST(ifArray.Count()==4);
sl@0
   291
		ifArray.ResetAndDestroy();
sl@0
   292
		totalTime+=(endTime-startTime);
sl@0
   293
		}
sl@0
   294
		netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   295
		CheckPerformance(netTime, limitBasic, _L("Call with: no resolver, security info cached"));
sl@0
   296
sl@0
   297
	//
sl@0
   298
	// Average Time over KNumberIteration ListImplementationsL with default resolver when the DLL security info is cached
sl@0
   299
	//
sl@0
   300
	totalTime=0;
sl@0
   301
	TEComResolverParams params;
sl@0
   302
	params.SetDataType(KExpectedDataTypeDllOne());
sl@0
   303
	params.SetGenericMatch(ETrue);
sl@0
   304
	for (TInt i=0;i<KNumberIteration;i++)	
sl@0
   305
		{	
sl@0
   306
		startTime = User::FastCounter();
sl@0
   307
		REComSession::ListImplementationsL(KUidListImplTestInterface, params, ifArray);
sl@0
   308
		endTime = User::FastCounter();
sl@0
   309
		TEST(ifArray.Count()==4);
sl@0
   310
		ifArray.ResetAndDestroy();
sl@0
   311
		totalTime+=(endTime-startTime);	
sl@0
   312
		}
sl@0
   313
		netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   314
		CheckPerformance(netTime, limitBasic+limitDefaultResolver, _L("Call with: default resolver, security info cached"));
sl@0
   315
sl@0
   316
	//
sl@0
   317
	// Average Time over KNumberIteration ListImplementationsL with custom resolver when the DLL security check is cached
sl@0
   318
	//
sl@0
   319
	totalTime=0;
sl@0
   320
	for (TInt i=0;i<KNumberIteration;i++)	
sl@0
   321
		{	
sl@0
   322
		startTime = User::FastCounter();
sl@0
   323
		REComSession::ListImplementationsL(KUidListImplTestInterface, params, KCustomResolverImplementationUid, ifArray);
sl@0
   324
		endTime = User::FastCounter();
sl@0
   325
		TEST(ifArray.Count()==4);
sl@0
   326
		ifArray.ResetAndDestroy();
sl@0
   327
		totalTime+=(endTime-startTime);
sl@0
   328
		}
sl@0
   329
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   330
	CheckPerformance(netTime, limitBasic+limitCustomResolver, _L("Call with: custom resolver, security info cached"));
sl@0
   331
sl@0
   332
	//
sl@0
   333
	// 1.2 CreateImplementationL performance testing without extended interfaces.
sl@0
   334
	//
sl@0
   335
	INFO_PRINTF1(_L("Time servicing CreateImplementationL requests:\n"));
sl@0
   336
	//
sl@0
   337
	// Time Create Implementation without resolver with retrieval of security info and dll will be loaded
sl@0
   338
	//
sl@0
   339
	TUid ecomDestructorId;
sl@0
   340
	startTime = User::FastCounter();
sl@0
   341
	CImplementationClassExampleTwo *ecomPtr = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(KUidCreateImplementation, ecomDestructorId);
sl@0
   342
	endTime = User::FastCounter();
sl@0
   343
	REComSession::DestroyedImplementation(ecomDestructorId);
sl@0
   344
	delete ecomPtr;
sl@0
   345
	netTime = FastCountToMilliseconds(endTime-startTime);
sl@0
   346
	CheckPerformance(netTime, limitBasic+limitDllLoaded+limitSecurityInfoRetrieved, _L("Call with: no resolver, dll to be loaded, security info retrieval"));
sl@0
   347
	REComSession::FinalClose();
sl@0
   348
sl@0
   349
	WaitForDllUnload();
sl@0
   350
sl@0
   351
	//
sl@0
   352
	// Time CreateImplementation without resolver when the DLL security info cached and dll will be loaded
sl@0
   353
	//
sl@0
   354
	startTime = User::FastCounter();
sl@0
   355
	ecomPtr = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(KUidCreateImplementation, ecomDestructorId);
sl@0
   356
	endTime = User::FastCounter();
sl@0
   357
	netTime = FastCountToMilliseconds(endTime-startTime);
sl@0
   358
	CheckPerformance(netTime, limitBasic+limitDllLoaded, _L("Call with: no resolver, dll to be loaded, security info cached"));
sl@0
   359
sl@0
   360
	//
sl@0
   361
	// Average Time over KNumberIteration CreateImplementation without resolver when the DLL security info is cached and dll is already
sl@0
   362
	// loaded
sl@0
   363
	//
sl@0
   364
	totalTime=0;
sl@0
   365
	CImplementationClassExampleTwo *ecomPtr2=NULL;
sl@0
   366
	TUid ecomDestructorId2;
sl@0
   367
	for (TInt i=0;i<KNumberIteration;i++)	
sl@0
   368
		{	
sl@0
   369
		startTime = User::FastCounter();
sl@0
   370
		ecomPtr2 = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(KUidCreateImplementation, ecomDestructorId2);
sl@0
   371
		endTime = User::FastCounter();
sl@0
   372
		totalTime+=endTime-startTime;
sl@0
   373
		REComSession::DestroyedImplementation(ecomDestructorId2);
sl@0
   374
		delete ecomPtr2;
sl@0
   375
		}
sl@0
   376
	REComSession::DestroyedImplementation(ecomDestructorId);
sl@0
   377
	delete ecomPtr;
sl@0
   378
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   379
	CheckPerformance(netTime, limitBasic, _L("Call with: no resolver, dll already loaded, security info cached"));
sl@0
   380
	REComSession::FinalClose();
sl@0
   381
sl@0
   382
	WaitForDllUnload();
sl@0
   383
sl@0
   384
	//
sl@0
   385
	// Time CreateImplementation with default resolver when the DLL security info cached and dll must be loaded
sl@0
   386
	//
sl@0
   387
	params.SetDataType(KExpectedDataTypeDllTwo);
sl@0
   388
	startTime = User::FastCounter();
sl@0
   389
	ecomPtr = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(KUidCreateImplTestInterface, ecomDestructorId, params);
sl@0
   390
	endTime = User::FastCounter();
sl@0
   391
	netTime = FastCountToMilliseconds(endTime-startTime);
sl@0
   392
	CheckPerformance(netTime, limitBasic+limitDefaultResolver+limitDllLoaded, _L("Call with: default resolver, dll to be loaded, security info cached"));
sl@0
   393
sl@0
   394
	//
sl@0
   395
	// Average Time over KNumberIteration CreateImplementation with default resolver when the DLL security info is cached and dll is already
sl@0
   396
	// loaded
sl@0
   397
	//
sl@0
   398
	totalTime=0;
sl@0
   399
	for (TInt i=0;i<KNumberIteration;i++)	
sl@0
   400
		{
sl@0
   401
		startTime = User::FastCounter();
sl@0
   402
		ecomPtr2 = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(KUidCreateImplTestInterface, ecomDestructorId2, params);
sl@0
   403
		endTime = User::FastCounter();
sl@0
   404
		totalTime+=endTime-startTime;
sl@0
   405
		REComSession::DestroyedImplementation(ecomDestructorId2);
sl@0
   406
		delete ecomPtr2;
sl@0
   407
		}
sl@0
   408
	REComSession::DestroyedImplementation(ecomDestructorId);
sl@0
   409
	delete ecomPtr;	
sl@0
   410
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   411
	CheckPerformance(netTime, limitBasic+limitDefaultResolver, _L("Call with: default resolver, dll already loaded, security info cached"));
sl@0
   412
	REComSession::FinalClose();
sl@0
   413
sl@0
   414
	WaitForDllUnload();
sl@0
   415
sl@0
   416
	//
sl@0
   417
	// Time CreateImplementation with custom resolver when the DLL security info cached and dll must be loaded
sl@0
   418
	//
sl@0
   419
	startTime = User::FastCounter();
sl@0
   420
	ecomPtr = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(
sl@0
   421
				KUidCreateImplTestInterface, ecomDestructorId, params, KCustomResolverImplementationUid);
sl@0
   422
	endTime = User::FastCounter();
sl@0
   423
	netTime = FastCountToMilliseconds(endTime-startTime);
sl@0
   424
	CheckPerformance(netTime, limitBasic+limitCustomResolver+limitDllLoaded, _L("Call with: custom resolver, dll to be loaded, security info cached"));
sl@0
   425
sl@0
   426
	//
sl@0
   427
	// Average Time over KNumberIteration CreateImplementation with default resolver when the DLL security info is cached and dll is already
sl@0
   428
	// loaded
sl@0
   429
	//
sl@0
   430
	totalTime=0;
sl@0
   431
	for (TInt i=0;i<KNumberIteration;i++)	
sl@0
   432
		{	
sl@0
   433
		startTime = User::FastCounter();
sl@0
   434
		ecomPtr2 = (CImplementationClassExampleTwo*)REComSession::CreateImplementationL(
sl@0
   435
					KUidCreateImplTestInterface, ecomDestructorId2, params, KCustomResolverImplementationUid);
sl@0
   436
		endTime = User::FastCounter();
sl@0
   437
		totalTime+=endTime-startTime;	
sl@0
   438
		REComSession::DestroyedImplementation(ecomDestructorId2);
sl@0
   439
		delete ecomPtr2;
sl@0
   440
		}
sl@0
   441
	REComSession::DestroyedImplementation(ecomDestructorId);
sl@0
   442
	delete ecomPtr;	
sl@0
   443
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   444
	CheckPerformance(netTime, limitBasic+limitCustomResolver, _L("Call with: custom resolver, dll already loaded, security info cached"));
sl@0
   445
sl@0
   446
	//
sl@0
   447
	// 1.3 ListImplementationL performance testing with extended interfaces.
sl@0
   448
	//
sl@0
   449
	totalTime = 0;
sl@0
   450
	INFO_PRINTF1(_L("Time servicing ListImplementationsL with extended interfaces requests:\n"));
sl@0
   451
	//
sl@0
   452
	// Time ListImplementationsL with extended interfaces without resolver
sl@0
   453
	//
sl@0
   454
	startTime = User::FastCounter();
sl@0
   455
	REComSession::ListImplementationsL(KExample10InterfaceUid, extendedInterfaces, ifArray);
sl@0
   456
	endTime = User::FastCounter();
sl@0
   457
	TEST(ifArray.Count() == 1);
sl@0
   458
	ifArray.ResetAndDestroy();
sl@0
   459
	netTime = FastCountToMilliseconds(endTime-startTime);
sl@0
   460
	CheckPerformance(netTime, limitBasic+limitSecurityInfoRetrieved+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, no resolver, security info retrieval"));
sl@0
   461
sl@0
   462
	//
sl@0
   463
	// Average Time over KNumberIteration ListImplementationsL with extended interfaces,without resolver when the DLL security info is cached
sl@0
   464
	//
sl@0
   465
	totalTime=0;
sl@0
   466
	for (TInt i = 0; i < KNumberIteration; i++)
sl@0
   467
		{
sl@0
   468
		startTime = User::FastCounter();
sl@0
   469
		REComSession::ListImplementationsL(KExample10InterfaceUid, extendedInterfaces, ifArray);
sl@0
   470
		endTime = User::FastCounter();
sl@0
   471
		TEST(ifArray.Count() == 1);
sl@0
   472
		ifArray.ResetAndDestroy();
sl@0
   473
		totalTime += (endTime-startTime);
sl@0
   474
		}
sl@0
   475
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   476
	CheckPerformance(netTime, limitBasic+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, no resolver, security info cached"));
sl@0
   477
sl@0
   478
	//
sl@0
   479
	// Average Time over KNumberIteration ListImplementationsL with extended interfaces, with default resolver when the DLL security info is cached
sl@0
   480
	//
sl@0
   481
	totalTime = 0;
sl@0
   482
	params.SetDataType(KExpectedDataTypeExample10());
sl@0
   483
	params.SetGenericMatch(ETrue);
sl@0
   484
	for (TInt i = 0; i < KNumberIteration; i++)	
sl@0
   485
		{	
sl@0
   486
		startTime = User::FastCounter();
sl@0
   487
		REComSession::ListImplementationsL(KExample10InterfaceUid, extendedInterfaces, params, ifArray);
sl@0
   488
		endTime = User::FastCounter();
sl@0
   489
		TEST(ifArray.Count() == 1);
sl@0
   490
		ifArray.ResetAndDestroy();
sl@0
   491
		totalTime += (endTime-startTime);	
sl@0
   492
		}
sl@0
   493
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   494
	CheckPerformance(netTime, limitBasic+limitDefaultResolver+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, default resolver, security info cached"));
sl@0
   495
sl@0
   496
	//
sl@0
   497
	// Average Time over KNumberIteration ListImplementationsL with extended interfaces, with custom resolver when the DLL security check is cached
sl@0
   498
	//
sl@0
   499
	totalTime = 0;
sl@0
   500
	for (TInt i = 0; i < KNumberIteration; i++)	
sl@0
   501
		{	
sl@0
   502
		startTime = User::FastCounter();
sl@0
   503
		REComSession::ListImplementationsL(KExample10InterfaceUid, extendedInterfaces, params, KCustomResolverImplementationUid, ifArray);
sl@0
   504
		endTime = User::FastCounter();
sl@0
   505
		TEST(ifArray.Count() == 1);
sl@0
   506
		ifArray.ResetAndDestroy();
sl@0
   507
		totalTime += (endTime-startTime);
sl@0
   508
		}
sl@0
   509
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   510
	CheckPerformance(netTime, limitBasic+limitCustomResolver+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, custom resolver, security info cached"));
sl@0
   511
	
sl@0
   512
	//
sl@0
   513
	// 1.4 CreateImplementationL performance testing with extended interfaces.
sl@0
   514
	//
sl@0
   515
	CExampleInterface* dllPtr = NULL;
sl@0
   516
	CExampleInterface* dllPtr2 = NULL;
sl@0
   517
	totalTime = 0;
sl@0
   518
	INFO_PRINTF1(_L("Time servicing CreateImplementationsL with extended interfaces requests:\n"));
sl@0
   519
	//
sl@0
   520
	// Time CreateImplementation with extended interfaces, default resolver when the DLL security info cached and dll must be loaded
sl@0
   521
	//
sl@0
   522
	params.SetDataType(KExpectedDataTypeExample10);
sl@0
   523
	startTime = User::FastCounter();
sl@0
   524
	dllPtr = reinterpret_cast<CExampleInterface*>(REComSession::CreateImplementationL(KExample10InterfaceUid, extendedInterfaces, ecomDestructorId, params));
sl@0
   525
	endTime = User::FastCounter();
sl@0
   526
	netTime = FastCountToMilliseconds(endTime-startTime);
sl@0
   527
	CheckPerformance(netTime, limitBasic+limitDefaultResolver+limitDllLoaded+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, default resolver, dll to be loaded, security info cached"));
sl@0
   528
	
sl@0
   529
	//
sl@0
   530
	// Average Time over KNumberIteration CreateImplementation with extended interfaces, default resolver when the DLL security info is cached and dll is already
sl@0
   531
	// loaded
sl@0
   532
	//
sl@0
   533
	totalTime = 0;
sl@0
   534
	for (TInt i = 0; i < KNumberIteration; i++)	
sl@0
   535
		{
sl@0
   536
		startTime = User::FastCounter();
sl@0
   537
		dllPtr2 = reinterpret_cast<CExampleInterface*>(REComSession::CreateImplementationL(KExample10InterfaceUid, extendedInterfaces, ecomDestructorId2, params));
sl@0
   538
		endTime = User::FastCounter();
sl@0
   539
		totalTime += endTime-startTime;
sl@0
   540
		REComSession::DestroyedImplementation(ecomDestructorId2);
sl@0
   541
		delete dllPtr2;
sl@0
   542
		}
sl@0
   543
	REComSession::DestroyedImplementation(ecomDestructorId);
sl@0
   544
	delete dllPtr;	
sl@0
   545
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   546
	CheckPerformance(netTime, limitBasic+limitDefaultResolver+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, default resolver, dll already loaded, security info cached"));
sl@0
   547
	REComSession::FinalClose();
sl@0
   548
	WaitForDllUnload();
sl@0
   549
sl@0
   550
	//
sl@0
   551
	// Time CreateImplementation with extended interfaces, custom resolver when the DLL security info cached and dll must be loaded
sl@0
   552
	//
sl@0
   553
	startTime = User::FastCounter();
sl@0
   554
	dllPtr = reinterpret_cast<CExampleInterface*>(REComSession::CreateImplementationL(
sl@0
   555
		KExample10InterfaceUid, extendedInterfaces, ecomDestructorId, params, KCustomResolverImplementationUid));
sl@0
   556
	endTime = User::FastCounter();
sl@0
   557
	netTime = FastCountToMilliseconds(endTime-startTime);
sl@0
   558
	CheckPerformance(netTime, limitBasic+limitCustomResolver+limitDllLoaded+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, custom resolver, dll to be loaded, security info cached"));
sl@0
   559
sl@0
   560
	//
sl@0
   561
	// Average Time over KNumberIteration CreateImplementation with extended interfaces, custom resolver when the DLL security info is cached and dll is already
sl@0
   562
	// loaded
sl@0
   563
	//
sl@0
   564
	totalTime = 0;
sl@0
   565
	for (TInt i = 0; i < KNumberIteration; i++)	
sl@0
   566
		{	
sl@0
   567
		startTime = User::FastCounter();
sl@0
   568
		dllPtr2 = reinterpret_cast<CExampleInterface*>(REComSession::CreateImplementationL(
sl@0
   569
			KExample10InterfaceUid, extendedInterfaces, ecomDestructorId2, params, KCustomResolverImplementationUid));
sl@0
   570
		endTime = User::FastCounter();
sl@0
   571
		totalTime += endTime-startTime;	
sl@0
   572
		REComSession::DestroyedImplementation(ecomDestructorId2);
sl@0
   573
		delete dllPtr2;
sl@0
   574
		}
sl@0
   575
	REComSession::DestroyedImplementation(ecomDestructorId);
sl@0
   576
	delete dllPtr;	
sl@0
   577
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   578
	CheckPerformance(netTime, limitBasic+limitCustomResolver+limitExtendedInterfaceMatched, _L("Call with: extended interfaces, custom resolver, dll already loaded, security info cached"));
sl@0
   579
	
sl@0
   580
	REComSession::FinalClose();
sl@0
   581
	WaitForDllUnload();
sl@0
   582
	CleanupStack::PopAndDestroy(&extendedInterfaces);
sl@0
   583
sl@0
   584
	//
sl@0
   585
	// 2.1 ListExtendedInterfacesL performance testing.
sl@0
   586
	//
sl@0
   587
	RArray<TUid> ifInfo;
sl@0
   588
	CleanupClosePushL(ifInfo);
sl@0
   589
	totalTime = 0;
sl@0
   590
	for (TInt i = 0; i < KNumberIteration; i++)	
sl@0
   591
		{
sl@0
   592
		startTime = User::FastCounter();
sl@0
   593
		REComSession::ListExtendedInterfacesL(KExample10ImplementationUid,ifInfo);
sl@0
   594
		endTime = User::FastCounter();
sl@0
   595
		// Ensure test is valid by testing return parameters
sl@0
   596
		TEST(ifInfo.Count() == 3);
sl@0
   597
		totalTime += endTime-startTime;
sl@0
   598
		ifInfo.Reset();
sl@0
   599
		}
sl@0
   600
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   601
	CheckPerformance(netTime, limitListExtendedInterfaces, _L("List extended interface. Three interfaces returned."));
sl@0
   602
		
sl@0
   603
	// Test with no interfaces returned
sl@0
   604
	totalTime = 0;
sl@0
   605
	for (TInt i = 0; i < KNumberIteration; i++)	
sl@0
   606
		{
sl@0
   607
		startTime = User::FastCounter();
sl@0
   608
		REComSession::ListExtendedInterfacesL(KExample10ImplementationUid2,ifInfo);
sl@0
   609
		endTime = User::FastCounter();
sl@0
   610
		// Ensure test is valid by testing return parameters
sl@0
   611
		TEST(ifInfo.Count() == 0);
sl@0
   612
		totalTime += endTime-startTime;
sl@0
   613
		ifInfo.Reset();
sl@0
   614
		}
sl@0
   615
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   616
	CheckPerformance(netTime, limitListExtendedInterfaces, _L("List extended interface. No interface returned."));
sl@0
   617
	CleanupStack::PopAndDestroy(&ifInfo);
sl@0
   618
sl@0
   619
	//
sl@0
   620
	// 2.2 GetExtendedInterfaceL performance testing.
sl@0
   621
	//
sl@0
   622
	
sl@0
   623
	TUid instanceKey;
sl@0
   624
	// Set up some empty initialisation parameters
sl@0
   625
	CExampleInterface::TExampleInterfaceInitParams initParams;
sl@0
   626
	initParams.integer		= 0;
sl@0
   627
	initParams.descriptor	= NULL;
sl@0
   628
	dllPtr = REINTERPRET_CAST(CExampleInterface*, 
sl@0
   629
							REComSession::CreateImplementationL(KExample10ImplementationUid,
sl@0
   630
															   instanceKey,
sl@0
   631
															   &initParams));
sl@0
   632
	
sl@0
   633
	// Call extended interface here.
sl@0
   634
	totalTime = 0;
sl@0
   635
	for (TInt i = 0; i < KNumberIteration; i++)	
sl@0
   636
		{
sl@0
   637
		startTime = User::FastCounter();
sl@0
   638
		MExampleInterfaceExtended* ext1 = static_cast<MExampleInterfaceExtended*>(REComSession::GetExtendedInterfaceL(instanceKey, KExtendedInterfaceUid1 ));
sl@0
   639
		endTime = User::FastCounter();
sl@0
   640
		totalTime += endTime - startTime;
sl@0
   641
		}
sl@0
   642
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   643
	CheckPerformance(netTime, limitFetchExtendedInterface, _L("Get extended interface. Interface is part of main instantiation object."));
sl@0
   644
	totalTime = 0;
sl@0
   645
	for (TInt i = 0; i < KNumberIteration; i++)	
sl@0
   646
		{
sl@0
   647
		startTime = User::FastCounter();
sl@0
   648
		MExampleInterfaceExtended2* ext2 = static_cast<MExampleInterfaceExtended2*>(REComSession::GetExtendedInterfaceL(instanceKey, KExtendedInterfaceUid2 ));
sl@0
   649
		endTime = User::FastCounter();
sl@0
   650
		totalTime += endTime - startTime;
sl@0
   651
		}
sl@0
   652
	netTime = (FastCountToMilliseconds(totalTime))/KNumberIteration;
sl@0
   653
	CheckPerformance(netTime, limitFetchExtendedInterface, _L("Get extended interface. Interface is separate object."));
sl@0
   654
	REComSession::DestroyedImplementation(instanceKey);
sl@0
   655
	delete dllPtr;
sl@0
   656
	REComSession::FinalClose();
sl@0
   657
#else
sl@0
   658
	MacroNotDefinedError();
sl@0
   659
#endif // __ECOM_SERVER_PERFORMANCE__
sl@0
   660
	return TestStepResult();
sl@0
   661
	}