os/ossrv/lowlevellibsandfws/pluginfw/Framework/ResolverTest/t_resolverperf.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/ResolverTest/t_resolverperf.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,567 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include <e32math.h>
    1.20 +#include <hal.h>
    1.21 +#include <e32test.h>
    1.22 +#include <ecom/ecom.h>
    1.23 +#include <ecom/ecomresolverparams.h>
    1.24 +#include "Interface.h" // for TExampleInterfaceInitParams
    1.25 +#include "EComPatchDataConstantv2.h"
    1.26 +#include "../EcomTestUtils/EcomTestUtils.h"
    1.27 +
    1.28 +LOCAL_D RTest test(_L("Custom Resolver Load Time Performance Test"));
    1.29 +
    1.30 +_LIT8(KDummyData,"dummy");
    1.31 +
    1.32 +// KCExampleInterfaceUid is defined in "Interface.inl" !
    1.33 +
    1.34 +// custom resolvers available for testing.
    1.35 +// 200126cd, A0001346 and A0001347 are allocated outside the
    1.36 +// ECOM Uid Allocations.doc
    1.37 +const TUid KDummyResolverUid2  = {0xA0001346};
    1.38 +const TUid KDummyResolverUid3  = {0xA0001347};
    1.39 +const TUid KExampleResolverUid = {0x10009DD0};
    1.40 +const TUid KMyResolverUid      = {0x10009E12};
    1.41 +const TUid KDummyResolverUid1  = {0x200126CD};
    1.42 +
    1.43 +const TInt KArraySize = 5;
    1.44 +
    1.45 +TUid MyResolvers[KArraySize] = {
    1.46 +	KDummyResolverUid2,
    1.47 +	KDummyResolverUid1,
    1.48 +	KExampleResolverUid,
    1.49 +	KMyResolverUid,
    1.50 +	KDummyResolverUid3
    1.51 +	};
    1.52 +
    1.53 +// The custom resolver in RAMOnly dir
    1.54 +_LIT(KDummyRscInC, "c:\\resource\\plugins\\dummycustomresolver1.rsc");
    1.55 +_LIT(KDummyDllInC, "c:\\sys\\bin\\dummycustomresolver1.dll");
    1.56 +_LIT(KDummyRscInZ, "z:\\ramonly\\dummycustomresolver1.rsc");
    1.57 +_LIT(KDummyDllInZ, "z:\\ramonly\\dummycustomresolver1.dll");
    1.58 +
    1.59 +// Copies the Plugins to specific folder for testing purpose
    1.60 +LOCAL_C void CopyPluginsL()
    1.61 +	{
    1.62 +	EComTestUtils::FileManCopyFileL(KDummyRscInZ, KDummyRscInC);
    1.63 +	EComTestUtils::FileManCopyFileL(KDummyDllInZ, KDummyDllInC);
    1.64 +	}
    1.65 +
    1.66 +// Deleting plugin from the RAM for cleanup purpose
    1.67 +LOCAL_C void DeleteTestPlugin()
    1.68 +	{
    1.69 +	TRAP_IGNORE(EComTestUtils::FileManDeleteFileL(KDummyRscInC));
    1.70 +	TRAP_IGNORE(EComTestUtils::FileManDeleteFileL(KDummyDllInC));
    1.71 +	}
    1.72 +
    1.73 +// converts fast counter ticks to milliseconds
    1.74 +LOCAL_D TReal FastCountToMilliseconds(TUint32 aFastCount)
    1.75 +	{
    1.76 +	TInt freqInHz;
    1.77 +	HAL::Get(HAL::EFastCounterFrequency, freqInHz);
    1.78 +	TReal freqInkHz = (TReal)freqInHz / 1000;
    1.79 +	return (TReal)aFastCount / freqInkHz;
    1.80 +	}
    1.81 +
    1.82 +// counter wrap around subtraction
    1.83 +LOCAL_D TUint32 ElaspedCounterTicks(TUint32 aStart, TUint32 aEnd)
    1.84 +	{
    1.85 +	if (aEnd >= aStart)
    1.86 +		{
    1.87 +		return (aEnd - aStart);
    1.88 +		}
    1.89 +	else
    1.90 +		{
    1.91 +		return (KMaxTUint32 - aStart + aEnd + 1);
    1.92 +		}
    1.93 +	}
    1.94 +
    1.95 +// sleep for 2 minutes and 15 seconds
    1.96 +LOCAL_D void WaitForLazyUnloadPassL(void)
    1.97 +	{
    1.98 +	// Performance results from winscw do not count.
    1.99 +	// Hence sleep only in armv5.
   1.100 +#ifdef __ARMCC__
   1.101 +	const TInt32 KLazyDllUnloadPeriod = 135; // actual is 2 minutes.
   1.102 +
   1.103 +	test.Printf(_L("sleep %d s to avoid lazy DLL unload\n"), KLazyDllUnloadPeriod);
   1.104 +	User::After( KLazyDllUnloadPeriod * 1000000 );
   1.105 +	test.Printf(_L("wake up after sleeping %d s\n"), KLazyDllUnloadPeriod);
   1.106 +#endif
   1.107 +
   1.108 +	// Wait one second for plugin discovery
   1.109 +#ifdef __X86GCC__
   1.110 +	test.Printf(_L("sleep 1 s \n"));
   1.111 +	User::After(1000000);
   1.112 +	test.Printf(_L("wake up!\n"));
   1.113 +#endif
   1.114 +	}
   1.115 +
   1.116 +/** Check create test is within allowed limit.
   1.117 +@return True means test pass. False means fail.
   1.118 +*/
   1.119 +LOCAL_D TBool CheckCreatePerf(TReal aMilliseconds)
   1.120 +	{
   1.121 +	// These thresholds have 33% margin, i.e. when the limit is 320 ms,
   1.122 +	// the expected result is about 240 ms.
   1.123 +	const TReal KH2DpNandThreshold = 420.0;
   1.124 +	const TReal KH2NandThreshold = 420.0;
   1.125 +	const TReal KH2RamThreshold = 400.0;
   1.126 +
   1.127 +	const TReal KH4DpNandThreshold = 200.0;
   1.128 +	const TReal KH4NandThreshold = 200.0;
   1.129 +	const TReal KH4RamThreshold = 180.0;
   1.130 +	const TReal KH4MMCThreshold = 225.0; 
   1.131 +	//INFO: 'KH4MMCThreshold' is the threshold in case of WDP enabled configuration on H4.
   1.132 +    //       This was arrived at by running the test on a ROM built without the USE_DATA_PAGING defined.
   1.133 +	//       The time taken by this operation in the above configuration was used to set this threshold
   1.134 +
   1.135 +	const TReal KH6DpNandThreshold = 150.0;
   1.136 +	const TReal KH6NandThreshold = 150.0;
   1.137 +	const TReal KH6RamThreshold = 140.0;
   1.138 +
   1.139 +
   1.140 +	TReal threshold = 0.0;
   1.141 +	switch (EComTestUtils::GetHardwareConfiguration())
   1.142 +		{
   1.143 +		case EPlatformH2RAM:
   1.144 +			threshold = KH2RamThreshold;
   1.145 +			break;
   1.146 +		case EPlatformH2NAND:
   1.147 +			threshold = KH2NandThreshold;
   1.148 +			break;
   1.149 +		case EPlatformH2NANDDP:
   1.150 +			threshold = KH2DpNandThreshold;
   1.151 +			break;
   1.152 +		case EPlatformH4RAM:
   1.153 +			threshold = KH4RamThreshold;
   1.154 +			break;
   1.155 +		case EPlatformH4MMC:
   1.156 +			threshold = KH4MMCThreshold;
   1.157 +			break;
   1.158 +		case EPlatformH4NAND:
   1.159 +			threshold = KH4NandThreshold;
   1.160 +			break;
   1.161 +		case EPlatformH4NANDDP:
   1.162 +			threshold = KH4DpNandThreshold;
   1.163 +			break;
   1.164 +		case EPlatformH6RAM:
   1.165 +			threshold = KH6RamThreshold;
   1.166 +			break;
   1.167 +		case EPlatformH6NAND:
   1.168 +			threshold = KH6NandThreshold;
   1.169 +			break;
   1.170 +		case EPlatformH6NANDDP:
   1.171 +			threshold = KH6DpNandThreshold;
   1.172 +			break;
   1.173 +		default:
   1.174 +			// Ignore results on winscw and whatever unknown platform.
   1.175 +			test.Printf(_L("custom resolver create perf test: %f ms\n"), aMilliseconds);
   1.176 +			return ETrue;
   1.177 +		}
   1.178 +
   1.179 +		test.Printf(_L("custom resolver create perf test: %f ms (limit %f)\n"), aMilliseconds, threshold);
   1.180 +#ifdef _DEBUG
   1.181 +		// the thresholds are for urel only
   1.182 +		return ETrue;
   1.183 +#else
   1.184 +		return (threshold > aMilliseconds);
   1.185 +#endif
   1.186 +	}
   1.187 +
   1.188 +/** Check list test is within allowed limit.
   1.189 +@return True means test pass. False means fail.
   1.190 +*/
   1.191 +LOCAL_D TBool CheckListPerf(TReal aMilliseconds)
   1.192 +	{
   1.193 +	// These thresholds have 33% margin, i.e. when the limit is 300 ms,
   1.194 +	// the expected result is about 200 ms.
   1.195 +	const TReal KH2DpNandThreshold = 360.0;
   1.196 +	const TReal KH2NandThreshold = 360.0;
   1.197 +	const TReal KH2RamThreshold = 320.0;
   1.198 +
   1.199 +	const TReal KH4DpNandThreshold = 150.0;
   1.200 +	const TReal KH4NandThreshold = 150.0;
   1.201 +	const TReal KH4RamThreshold = 140.0;
   1.202 +	const TReal KH4MMCThreshold = 140.0;
   1.203 +	//INFO: 'KH4MMCThreshold' is the threshold in case of WDP enabled configuration on H4.
   1.204 +    //       This was arrived at by running the test on a ROM built without the USE_DATA_PAGING defined.
   1.205 +	//       The time taken by this operation in the above configuration was used to set this threshold
   1.206 +
   1.207 +	const TReal KH6DpNandThreshold = 150.0;
   1.208 +	const TReal KH6NandThreshold = 150.0;
   1.209 +	const TReal KH6RamThreshold = 140.0;
   1.210 +
   1.211 +
   1.212 +	TReal threshold = 0.0;
   1.213 +	switch (EComTestUtils::GetHardwareConfiguration())
   1.214 +		{
   1.215 +		case EPlatformH2RAM:
   1.216 +			threshold = KH2RamThreshold;
   1.217 +			break;
   1.218 +		case EPlatformH2NAND:
   1.219 +			threshold = KH2NandThreshold;
   1.220 +			break;
   1.221 +		case EPlatformH2NANDDP:
   1.222 +			threshold = KH2DpNandThreshold;
   1.223 +			break;
   1.224 +		case EPlatformH4RAM:
   1.225 +			threshold = KH4RamThreshold;
   1.226 +			break;
   1.227 +		case EPlatformH4MMC:
   1.228 +			threshold = KH4MMCThreshold;
   1.229 +			break;
   1.230 +		case EPlatformH4NAND:
   1.231 +			threshold = KH4NandThreshold;
   1.232 +			break;
   1.233 +		case EPlatformH4NANDDP:
   1.234 +			threshold = KH4DpNandThreshold;
   1.235 +			break;
   1.236 +		case EPlatformH6RAM:
   1.237 +			threshold = KH6RamThreshold;
   1.238 +			break;
   1.239 +		case EPlatformH6NAND:
   1.240 +			threshold = KH6NandThreshold;
   1.241 +			break;
   1.242 +		case EPlatformH6NANDDP:
   1.243 +			threshold = KH6DpNandThreshold;
   1.244 +			break;
   1.245 +		default:
   1.246 +			// Ignore results on winscw and whatever unknown platform.
   1.247 +			test.Printf(_L("custom resolver list perf test: %f ms\n"), aMilliseconds);
   1.248 +			return ETrue;
   1.249 +		}
   1.250 +
   1.251 +		test.Printf(_L("custom resolver list perf test: %f ms (limit %f)\n"), aMilliseconds, threshold);
   1.252 +#ifdef _DEBUG
   1.253 +		// the thresholds are for urel only
   1.254 +		return ETrue;
   1.255 +#else
   1.256 +		return (threshold > aMilliseconds);
   1.257 +#endif
   1.258 +	}
   1.259 +
   1.260 +/** Check create test in cache miss is within allowed limit.
   1.261 +@return True means test pass. False means fail.
   1.262 +*/
   1.263 +LOCAL_D TBool CheckCacheMissCreatePerf(TReal aMilliseconds)
   1.264 +	{
   1.265 +	// These thresholds have 33% margin, i.e. when the limit is 1200 ms,
   1.266 +	// the expected result is about 900 ms.
   1.267 +	const TReal KH2DpNandThreshold = 2250.0;
   1.268 +	const TReal KH2NandThreshold = 2250.0;
   1.269 +	const TReal KH2RamThreshold = 1000.0;
   1.270 +
   1.271 +	const TReal KH4DpNandThreshold = 1350.0;
   1.272 +	const TReal KH4NandThreshold = 1350.0;
   1.273 +	const TReal KH4RamThreshold = 500.0;
   1.274 +	const TReal KH4MMCThreshold = 1350.0;
   1.275 +	//INFO: 'KH4MMCThreshold' is the threshold in case of WDP enabled configuration on H4.
   1.276 +    //       This was arrived at by running the test on a ROM built without the USE_DATA_PAGING defined.
   1.277 +	//       The time taken by this operation in the above configuration was used to set this threshold
   1.278 +
   1.279 +	const TReal KH6DpNandThreshold = 1000.0;
   1.280 +	const TReal KH6NandThreshold = 1000.0;
   1.281 +	const TReal KH6RamThreshold = 350.0;
   1.282 +
   1.283 +	TReal threshold = 0.0;
   1.284 +	switch (EComTestUtils::GetHardwareConfiguration())
   1.285 +		{
   1.286 +		case EPlatformH2RAM:
   1.287 +			threshold = KH2RamThreshold;
   1.288 +			break;
   1.289 +		case EPlatformH2NAND:
   1.290 +			threshold = KH2NandThreshold;
   1.291 +			break;
   1.292 +		case EPlatformH2NANDDP:
   1.293 +			threshold = KH2DpNandThreshold;
   1.294 +			break;
   1.295 +		case EPlatformH4RAM:
   1.296 +			threshold = KH4RamThreshold;
   1.297 +			break;
   1.298 +		case EPlatformH4MMC:
   1.299 +			threshold = KH4MMCThreshold;
   1.300 +			break;
   1.301 +		case EPlatformH4NAND:
   1.302 +			threshold = KH4NandThreshold;
   1.303 +			break;
   1.304 +		case EPlatformH4NANDDP:
   1.305 +			threshold = KH4DpNandThreshold;
   1.306 +			break;
   1.307 +		case EPlatformH6RAM:
   1.308 +			threshold = KH6RamThreshold;
   1.309 +			break;
   1.310 +		case EPlatformH6NAND:
   1.311 +			threshold = KH6NandThreshold;
   1.312 +			break;
   1.313 +		case EPlatformH6NANDDP:
   1.314 +			threshold = KH6DpNandThreshold;
   1.315 +			break;
   1.316 +		default:
   1.317 +			// Ignore results on winscw and whatever unknown platform.
   1.318 +			test.Printf(_L("Cache miss create perf test: %f ms\n"), aMilliseconds);
   1.319 +			return ETrue;
   1.320 +		}
   1.321 +
   1.322 +		test.Printf(_L("Cache miss create perf test: %f ms (limit %f)\n"), aMilliseconds, threshold);
   1.323 +#ifdef _DEBUG
   1.324 +		// the thresholds are for urel only
   1.325 +		return ETrue;
   1.326 +#else
   1.327 +		return (threshold > aMilliseconds);
   1.328 +#endif
   1.329 +	}
   1.330 +
   1.331 +/** Check list test in cache miss is within allowed limit.
   1.332 +@return True means test pass. False means fail.
   1.333 +*/
   1.334 +LOCAL_D TBool CheckCacheMissListPerf(TReal aMilliseconds)
   1.335 +	{
   1.336 +	// These thresholds have 33% margin, i.e. when the limit is 1200 ms,
   1.337 +	// the expected result is about 900 ms.
   1.338 +	const TReal KH2DpNandThreshold = 2250.0;
   1.339 +	const TReal KH2NandThreshold = 2250.0;
   1.340 +	const TReal KH2RamThreshold = 1000.0;
   1.341 +
   1.342 +	const TReal KH4DpNandThreshold = 1350.0;
   1.343 +	const TReal KH4NandThreshold = 1350.0;
   1.344 +	const TReal KH4RamThreshold = 500.0;
   1.345 +	const TReal KH4MMCThreshold = 1350.0;
   1.346 +	//INFO: 'KH4MMCThreshold' is the threshold in case of WDP enabled configuration on H4.
   1.347 +    //       This was arrived at by running the test on a ROM built without the USE_DATA_PAGING defined.
   1.348 +	//       The time taken by this operation in the above configuration was used to set this threshold
   1.349 +
   1.350 +	TReal threshold = 0.0;
   1.351 +	switch (EComTestUtils::GetHardwareConfiguration())
   1.352 +		{
   1.353 +		case EPlatformH2RAM:
   1.354 +			threshold = KH2RamThreshold;
   1.355 +			break;
   1.356 +		case EPlatformH2NAND:
   1.357 +			threshold = KH2NandThreshold;
   1.358 +			break;
   1.359 +		case EPlatformH2NANDDP:
   1.360 +			threshold = KH2DpNandThreshold;
   1.361 +			break;
   1.362 +		case EPlatformH4RAM:
   1.363 +			threshold = KH4RamThreshold;
   1.364 +			break;
   1.365 +		case EPlatformH4MMC:
   1.366 +			threshold = KH4MMCThreshold;
   1.367 +			break;
   1.368 +		case EPlatformH4NAND:
   1.369 +			threshold = KH4NandThreshold;
   1.370 +			break;
   1.371 +		case EPlatformH4NANDDP:
   1.372 +			threshold = KH4DpNandThreshold;
   1.373 +			break;
   1.374 +		default:
   1.375 +			// Ignore results on winscw and whatever unknown platform.
   1.376 +			test.Printf(_L("Cache miss list perf test: %f ms\n"), aMilliseconds);
   1.377 +			return ETrue;
   1.378 +		}
   1.379 +
   1.380 +		test.Printf(_L("Cache miss list perf test: %f ms (limit %f)\n"), aMilliseconds, threshold);
   1.381 +#ifdef _DEBUG
   1.382 +		// the thresholds are for urel only
   1.383 +		return ETrue;
   1.384 +#else
   1.385 +		return (threshold > aMilliseconds);
   1.386 +#endif
   1.387 +	}
   1.388 +
   1.389 +/** do custom resolver create test
   1.390 +@return total ticks spent during the create request.
   1.391 +*/
   1.392 +LOCAL_D TUint32 DoCreatePerfTestL(const TUid aResolverUid)
   1.393 +	{
   1.394 +	CExampleInterface::TExampleInterfaceInitParams initParams;
   1.395 +	initParams.integer	= 1;
   1.396 +	initParams.descriptor = NULL;
   1.397 +	TAny* p = NULL;
   1.398 +	TUid instanceKey;
   1.399 +	TEComResolverParams resolverparams;
   1.400 +	//Set any resolver data type as it will never reach the resolving part
   1.401 +	resolverparams.SetDataType(KDummyData);
   1.402 +	TUint32 startTime, endTime;
   1.403 +
   1.404 +	startTime = User::FastCounter();
   1.405 +	p = REComSession::CreateImplementationL(KCExampleInterfaceUid,
   1.406 +											instanceKey,
   1.407 +											&initParams,
   1.408 +											resolverparams,
   1.409 +											aResolverUid);
   1.410 +	endTime = User::FastCounter();
   1.411 +
   1.412 +	test(p != NULL);
   1.413 +	REComSession::DestroyedImplementation(instanceKey);
   1.414 +	CExampleInterface* impl = reinterpret_cast<CExampleInterface*>(p);
   1.415 +	delete impl;
   1.416 +
   1.417 +	return ElaspedCounterTicks(startTime, endTime);
   1.418 +	}
   1.419 +
   1.420 +/** do custom resolver list test
   1.421 +@return total ticks spent during the list request.
   1.422 +*/
   1.423 +LOCAL_D TUint32 DoListPerfTestL(const TUid aResolverUid)
   1.424 +	{
   1.425 +	TEComResolverParams resolverparams;
   1.426 +	//Set any resolver data type as it will never reach the resolving part
   1.427 +	resolverparams.SetDataType(KDummyData);
   1.428 +	RImplInfoPtrArray ifArray;
   1.429 +	TUint32 startTime, endTime;
   1.430 +
   1.431 +	startTime = User::FastCounter();
   1.432 +	REComSession::ListImplementationsL(KCExampleInterfaceUid,
   1.433 +									   resolverparams,
   1.434 +									   aResolverUid,
   1.435 +									   ifArray);
   1.436 +	endTime = User::FastCounter();
   1.437 +
   1.438 +	test(ifArray.Count() > 0);
   1.439 +	ifArray.ResetAndDestroy();
   1.440 +
   1.441 +	return ElaspedCounterTicks(startTime, endTime);
   1.442 +	}
   1.443 +
   1.444 +/**
   1.445 +@SYMTestCaseID		SYSLIB-ECOM-PT-4009
   1.446 +@SYMTestCaseDesc 	Time how long it takes to do 100 create requests and
   1.447 +					100 list requests involving custom resolvers.
   1.448 +@SYMTestPriority 	High
   1.449 +@SYMTestActions  	Run create and list requests in a loop.
   1.450 +@SYMTestExpectedResults on hw testing, the time must be within prescribed threshold.
   1.451 +@SYMCR CR1182
   1.452 +*/
   1.453 +LOCAL_D void RunResolverPerfTestL()
   1.454 +	{
   1.455 +	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-PT-4009 Time a number of create and list requests\n "));
   1.456 +
   1.457 +	// If ECOM server is not yet running, the first message will take long
   1.458 +	// time because ECOM has to scandir and parse spi file. So do a dummy run
   1.459 +	// to kick start ECOM.
   1.460 +	DoListPerfTestL(MyResolvers[0]);
   1.461 +
   1.462 +	const TInt KNumLoops = 100;
   1.463 +	TInt j;
   1.464 +
   1.465 +	TUint32 createTicks = 0;
   1.466 +	TUint32 listTicks = 0;
   1.467 +	for (TInt i = 0; i < KNumLoops; i++)
   1.468 +		{
   1.469 +		j = i % KCustomResolverCacheSize;
   1.470 +		createTicks += DoCreatePerfTestL(MyResolvers[j]);
   1.471 +		listTicks += DoListPerfTestL(MyResolvers[j]);
   1.472 +		}
   1.473 +
   1.474 +	REComSession::FinalClose();
   1.475 +
   1.476 +	TReal createMs = FastCountToMilliseconds(createTicks);
   1.477 +	TBool createTestPass = CheckCreatePerf(createMs);
   1.478 +
   1.479 +	TReal listMs = FastCountToMilliseconds(listTicks);
   1.480 +	TBool listTestPass = CheckListPerf(listMs);
   1.481 +
   1.482 +	test(createTestPass);
   1.483 +	test(listTestPass);
   1.484 +	}
   1.485 +
   1.486 +/**
   1.487 +@SYMTestCaseID		SYSLIB-ECOM-PT-4010
   1.488 +@SYMTestCaseDesc 	Verify CR1182 does not slow down list and create
   1.489 +	request significantly if there are a lot of cache misses.
   1.490 +@SYMTestPriority 	High
   1.491 +@SYMTestActions  	Repeatedly do list and create requests with five
   1.492 +	custom resolvers (1 more than max cache size). Time how long it takes.
   1.493 +@SYMTestExpectedResults on hw testing, the time must be within prescribed threshold.
   1.494 +@SYMCR CR1182
   1.495 +*/
   1.496 +LOCAL_D void CacheMissPerfTestL()
   1.497 +	{
   1.498 +	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-PT-4010 Cache miss performance test\n "));
   1.499 +
   1.500 +	test(KArraySize > KCustomResolverCacheSize);
   1.501 +
   1.502 +	const TInt KNumLoops = 100;
   1.503 +	TInt i, j;
   1.504 +
   1.505 +	TUint32 createTicks = 0;
   1.506 +	for (i = 0; i < KNumLoops; i++)
   1.507 +		{
   1.508 +		j = i % KArraySize;
   1.509 +		createTicks += DoCreatePerfTestL(MyResolvers[j]);
   1.510 +		}
   1.511 +
   1.512 +	TUint32 listTicks = 0;
   1.513 +	for (i = 0; i < KNumLoops; i++)
   1.514 +		{
   1.515 +		j = i % KArraySize;
   1.516 +		listTicks += DoListPerfTestL(MyResolvers[j]);
   1.517 +		}
   1.518 +
   1.519 +	REComSession::FinalClose();
   1.520 +
   1.521 +	TReal createMs = FastCountToMilliseconds(createTicks);
   1.522 +	TBool createTestPass = CheckCacheMissCreatePerf(createMs);
   1.523 +
   1.524 +	TReal listMs = FastCountToMilliseconds(listTicks);
   1.525 +	TBool listTestPass = CheckCacheMissListPerf(listMs);
   1.526 +
   1.527 +	test(createTestPass);
   1.528 +	test(listTestPass);
   1.529 +	}
   1.530 +
   1.531 +LOCAL_C void RunTestL()
   1.532 +	{
   1.533 +	__UHEAP_MARK;
   1.534 +	CopyPluginsL();
   1.535 +	WaitForLazyUnloadPassL();
   1.536 +
   1.537 +	RunResolverPerfTestL();
   1.538 +	CacheMissPerfTestL();
   1.539 +
   1.540 +	// pause till ecom server flushes the cache.
   1.541 +	// otherwise may affect the next test to run.
   1.542 +	User::After(KCustomResolverCacheTimeout + 1000000);
   1.543 +
   1.544 +	DeleteTestPlugin();
   1.545 +
   1.546 +	__UHEAP_MARKEND;
   1.547 +	}
   1.548 +
   1.549 +GLDEF_C TInt E32Main()
   1.550 +	{
   1.551 +	TInt err=KErrNone;
   1.552 +	__UHEAP_MARK;
   1.553 +
   1.554 +	test.Title();
   1.555 +	test.Start(_L("CR1182 Perf. tests."));
   1.556 +
   1.557 +	CTrapCleanup* cleanup = CTrapCleanup::New();
   1.558 +	test(cleanup != NULL);
   1.559 +
   1.560 +	TRAP(err,RunTestL());
   1.561 +	test(err == KErrNone);
   1.562 +
   1.563 +	delete cleanup;
   1.564 +
   1.565 +	test.End();
   1.566 +	test.Close();
   1.567 +
   1.568 +	__UHEAP_MARKEND;
   1.569 +	return(err);
   1.570 +	}