os/kernelhwsrv/kerneltest/e32test/benchmark/property.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/benchmark/property.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,501 @@
     1.4 +// Copyright (c) 2002-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 the License "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 <e32test.h>
    1.20 +#include <e32property.h>
    1.21 +
    1.22 +#include "bm_suite.h"
    1.23 +
    1.24 +static const TInt32 KUidPropBenchmarkCategoryValue = 0x101f75b7;
    1.25 +static const TUid KPropBenchmarkCategory = { KUidPropBenchmarkCategoryValue };
    1.26 +static _LIT_SECURITY_POLICY_PASS(KPassPolicy);
    1.27 +
    1.28 +typedef void (*MeasurementFunc)(TBMResult*, TBMUInt64 aIter, struct Measurement*);
    1.29 +enum TSetGetType
    1.30 +	{
    1.31 +	EOneArg,
    1.32 +	EThreeArgsInt,
    1.33 +	EThreeArgsBuf8,
    1.34 +	EThreeArgsBuf16
    1.35 +	};
    1.36 +
    1.37 +struct Measurement 
    1.38 +	{
    1.39 +	MeasurementFunc		iFunc;
    1.40 +	TPtrC				iName;
    1.41 +	TBool				iRemote;
    1.42 +	RProperty::TType	iType;
    1.43 +	TInt				iSize;
    1.44 +	TSetGetType			iSetGetType;
    1.45 +
    1.46 +	Measurement(MeasurementFunc aFunc, const TDesC& aName,
    1.47 +				RProperty::TType aType, TInt aSize, TBool aRemote = EFalse, 
    1.48 +				TSetGetType aSetGetType = EOneArg) : 
    1.49 +			iFunc(aFunc), iName(aName), iRemote(aRemote), iType(aType), iSize(aSize), 
    1.50 +			iSetGetType(aSetGetType) {}
    1.51 +	};
    1.52 +
    1.53 +class Property : public BMProgram
    1.54 +	{
    1.55 +public :
    1.56 +	Property() : BMProgram(_L("Properties"))
    1.57 +		{}
    1.58 +	virtual TBMResult* Run(TBMUInt64 aIter, TInt* aCount);
    1.59 +
    1.60 +
    1.61 +	static TBMResult	iResults[];
    1.62 +	static Measurement	iMeasurements[];
    1.63 +
    1.64 +	static void NotificationLatencyParent(TBMResult* aResult, TBMUInt64 aIter, Measurement*);
    1.65 +	static TInt NotificationLatencyChild(TAny*);
    1.66 +
    1.67 +	static void SetOverhead(TBMResult* aResult, TBMUInt64 aIter, struct Measurement* aM);
    1.68 +	static void GetOverhead(TBMResult* aResult, TBMUInt64 aIter, struct Measurement* aM);
    1.69 +
    1.70 +
    1.71 +private:
    1.72 +	static TBuf8<RProperty::KMaxPropertySize> iInBuf;
    1.73 +	static TBuf8<RProperty::KMaxPropertySize> iOutBuf;
    1.74 +	static TBuf16<RProperty::KMaxPropertySize> iInBuf16;
    1.75 +	static TBuf16<RProperty::KMaxPropertySize> iOutBuf16;
    1.76 +	};
    1.77 +
    1.78 +Measurement Property::iMeasurements[] =
    1.79 +	{
    1.80 +	Measurement(&Property::NotificationLatencyParent, _L("Local Int Notification Latency "), 
    1.81 +				RProperty::EInt, 0, EFalse),
    1.82 +	Measurement(&Property::NotificationLatencyParent, _L("Remote Int Notification Latency"),
    1.83 +				RProperty::EInt, 0,ETrue),
    1.84 +	Measurement(&Property::NotificationLatencyParent, _L("Local Byte(1) Notification Latency"),
    1.85 +				RProperty::EByteArray, 1, EFalse),
    1.86 +	Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(1) Notification Latency"), 
    1.87 +				RProperty::EByteArray, 1, ETrue),
    1.88 +	Measurement(&Property::NotificationLatencyParent, _L("Local Byte(8) Notification Latency"),
    1.89 +				RProperty::EByteArray, 8, EFalse),
    1.90 +	Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(8) Notification Latency"), 
    1.91 +				RProperty::EByteArray, 8,ETrue),
    1.92 +	Measurement(&Property::NotificationLatencyParent, _L("Local Byte(512) Notification Latency"), 
    1.93 +				RProperty::EByteArray, 512, EFalse),
    1.94 +	Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(512) Notification Latency"), 
    1.95 +				RProperty::EByteArray, 512,ETrue),
    1.96 +
    1.97 +	Measurement(&Property::NotificationLatencyParent, _L("Local Int Notification Latency ThreeArgsInt"), 
    1.98 +				RProperty::EInt, 0, EFalse, EThreeArgsInt),
    1.99 +	Measurement(&Property::NotificationLatencyParent, _L("Remote Int Notification Latency ThreeArgsInt"),
   1.100 +				RProperty::EInt, 0,ETrue, EThreeArgsInt),
   1.101 +	Measurement(&Property::NotificationLatencyParent, _L("Local Byte(1) Notification Latency ThreeArgsBuf8"),
   1.102 +				RProperty::EByteArray, 1, EFalse, EThreeArgsBuf8),
   1.103 +	Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(1) Notification Latency ThreeArgsBuf8"), 
   1.104 +				RProperty::EByteArray, 1, ETrue, EThreeArgsBuf8),
   1.105 +	Measurement(&Property::NotificationLatencyParent, _L("Local TUint16(1) Notification Latency ThreeArgsBuf16"),
   1.106 +				RProperty::EByteArray, 1, EFalse, EThreeArgsBuf16),
   1.107 +	Measurement(&Property::NotificationLatencyParent, _L("Remote TUint16(1) Notification Latency ThreeArgsBuf16"), 
   1.108 +				RProperty::EByteArray, 1, ETrue, EThreeArgsBuf16),
   1.109 +	Measurement(&Property::NotificationLatencyParent, _L("Local Byte(8) Notification Latency ThreeArgsBuf8"),
   1.110 +				RProperty::EByteArray, 8, EFalse, EThreeArgsBuf8),
   1.111 +	Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(8) Notification Latency ThreeArgsBuf8"), 
   1.112 +				RProperty::EByteArray, 8,ETrue, EThreeArgsBuf8),
   1.113 +	Measurement(&Property::NotificationLatencyParent, _L("Local TUint16(8) Notification Latency ThreeArgsBuf16"),
   1.114 +				RProperty::EByteArray, 8, EFalse, EThreeArgsBuf16),
   1.115 +	Measurement(&Property::NotificationLatencyParent, _L("Remote TUint16(8) Notification Latency ThreeArgsBuf16"), 
   1.116 +				RProperty::EByteArray, 8,ETrue, EThreeArgsBuf16),
   1.117 +	Measurement(&Property::NotificationLatencyParent, _L("Local Byte(512) Notification Latency ThreeArgsBuf8"), 
   1.118 +				RProperty::EByteArray, 512, EFalse, EThreeArgsBuf8),
   1.119 +	Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(512) Notification Latency ThreeArgsBuf8"), 
   1.120 +				RProperty::EByteArray, 512,ETrue, EThreeArgsBuf8),
   1.121 +	Measurement(&Property::NotificationLatencyParent, _L("Local TUint16(512) Notification Latency ThreeArgsBuf16"), 
   1.122 +				RProperty::ELargeByteArray, 512, EFalse, EThreeArgsBuf16),
   1.123 +	Measurement(&Property::NotificationLatencyParent, _L("Remote TUint16(512) Notification Latency ThreeArgsBuf16"), 
   1.124 +				RProperty::ELargeByteArray, 512,ETrue, EThreeArgsBuf16),
   1.125 +
   1.126 +
   1.127 +
   1.128 +	Measurement(&Property::SetOverhead, _L("Int Set Overhead"), 
   1.129 +				RProperty::EInt, 0),
   1.130 +	Measurement(&Property::SetOverhead, _L("Byte(1) Set Overhead"),
   1.131 +				RProperty::EByteArray, 1),
   1.132 +	Measurement(&Property::SetOverhead, _L("Byte(8) Set Overhead"),
   1.133 +				RProperty::EByteArray, 8),
   1.134 +	Measurement(&Property::SetOverhead, _L("Byte(512) Set Overhead"),
   1.135 +				RProperty::EByteArray, 512),
   1.136 +
   1.137 +	Measurement(&Property::SetOverhead, _L("Int Set Overhead ThreeArgsInt"), 
   1.138 +				RProperty::EInt, 0, EFalse, EThreeArgsInt),
   1.139 +	Measurement(&Property::SetOverhead, _L("Byte(1) Set Overhead ThreeArgsBuf8"),
   1.140 +				RProperty::EByteArray, 1, EFalse, EThreeArgsBuf8),
   1.141 +	Measurement(&Property::SetOverhead, _L("TUint16(1) Set Overhead ThreeArgsBuf16"),
   1.142 +				RProperty::EByteArray, 1, EFalse, EThreeArgsBuf16),
   1.143 +	Measurement(&Property::SetOverhead, _L("Byte(8) Set Overhead ThreeArgsBuf8"),
   1.144 +				RProperty::EByteArray, 8, EFalse, EThreeArgsBuf8),
   1.145 +	Measurement(&Property::SetOverhead, _L("TUint16(8) Set Overhead ThreeArgsBuf16"),
   1.146 +				RProperty::EByteArray, 8, EFalse, EThreeArgsBuf16),
   1.147 +	Measurement(&Property::SetOverhead, _L("Byte(512) Set Overhead ThreeArgsBuf8"),
   1.148 +				RProperty::EByteArray, 512, EFalse, EThreeArgsBuf8),
   1.149 +	Measurement(&Property::SetOverhead, _L("TUint16(512) Set Overhead ThreeArgsBuf16"),
   1.150 +				RProperty::ELargeByteArray, 512, EFalse, EThreeArgsBuf16),
   1.151 +
   1.152 +
   1.153 +
   1.154 +	Measurement(&Property::GetOverhead, _L("Int Get Overhead"), 
   1.155 +				RProperty::EInt, 0),
   1.156 +	Measurement(&Property::GetOverhead, _L("Byte(1) Get Overhead"),
   1.157 +				RProperty::EByteArray, 1),
   1.158 +	Measurement(&Property::GetOverhead, _L("Byte(8) Get Overhead"),
   1.159 +				RProperty::EByteArray, 8),
   1.160 +	Measurement(&Property::GetOverhead, _L("Byte(512) Get Overhead"),
   1.161 +				RProperty::EByteArray, 512),
   1.162 +
   1.163 +	Measurement(&Property::GetOverhead, _L("Int Get Overhead ThreeArgsInt"), 
   1.164 +				RProperty::EInt, 0, EFalse, EThreeArgsInt),
   1.165 +	Measurement(&Property::GetOverhead, _L("Byte(1) Get Overhead ThreeArgsBuf8"),
   1.166 +				RProperty::EByteArray, 1, EFalse, EThreeArgsBuf8),
   1.167 +	Measurement(&Property::GetOverhead, _L("TUint16(1) Get Overhead ThreeArgsBuf16"),
   1.168 +				RProperty::EByteArray, 1, EFalse, EThreeArgsBuf16),
   1.169 +	Measurement(&Property::GetOverhead, _L("Byte(8) Get Overhead ThreeArgsBuf8"),
   1.170 +				RProperty::EByteArray, 8, EFalse, EThreeArgsBuf8),
   1.171 +	Measurement(&Property::GetOverhead, _L("TUint16(8) Get Overhead ThreeArgsBuf16"),
   1.172 +				RProperty::EByteArray, 8, EFalse, EThreeArgsBuf16),
   1.173 +	Measurement(&Property::GetOverhead, _L("Byte(512) Get Overhead ThreeArgsBuf8"),
   1.174 +				RProperty::EByteArray, 512, EFalse, EThreeArgsBuf8),
   1.175 +	Measurement(&Property::GetOverhead, _L("TUint16(512) Get Overhead ThreeArgsBuf16"),
   1.176 +				RProperty::ELargeByteArray, 512, EFalse, EThreeArgsBuf16),
   1.177 +
   1.178 +	};
   1.179 +TBMResult	Property::iResults[sizeof(Property::iMeasurements)/sizeof(Property::iMeasurements[0])];
   1.180 +
   1.181 +TBuf8<RProperty::KMaxPropertySize> Property::iInBuf(RProperty::KMaxPropertySize);
   1.182 +TBuf8<RProperty::KMaxPropertySize> Property::iOutBuf(RProperty::KMaxPropertySize);
   1.183 +TBuf16<RProperty::KMaxPropertySize> Property::iInBuf16(RProperty::KMaxPropertySize);
   1.184 +TBuf16<RProperty::KMaxPropertySize> Property::iOutBuf16(RProperty::KMaxPropertySize);
   1.185 +
   1.186 +
   1.187 +static Property property;
   1.188 +
   1.189 +class NotificationLatencyArgs : public TBMSpawnArgs
   1.190 +	{
   1.191 +public:
   1.192 +	
   1.193 +	TBMUInt64		iIterationCount;
   1.194 +	RProperty::TType iType;
   1.195 +	TInt			iSize;
   1.196 +	TSetGetType		iSetGetType;
   1.197 +
   1.198 +	NotificationLatencyArgs(RProperty::TType aType, TInt aSize, TInt aRemote, TBMUInt64 aIter, 
   1.199 +		TSetGetType aSetGetType);
   1.200 +	};
   1.201 +
   1.202 +NotificationLatencyArgs::NotificationLatencyArgs(RProperty::TType aType, TInt aSize, TInt aRemote, 
   1.203 +		 TBMUInt64 aIter, TSetGetType aSetGetType) : 
   1.204 +	TBMSpawnArgs(Property::NotificationLatencyChild, KBMPriorityLow, aRemote, sizeof(*this)),
   1.205 +	iIterationCount(aIter), iType(aType), iSize(aSize), iSetGetType(aSetGetType)
   1.206 +	{
   1.207 +	}
   1.208 +
   1.209 +void Property::NotificationLatencyParent(TBMResult* aResult, TBMUInt64 aIter, struct Measurement* aM)
   1.210 +	{
   1.211 +	RProperty time;
   1.212 +	TInt r = time.Define(KPropBenchmarkCategory, 0, RProperty::EByteArray, KPassPolicy, KPassPolicy);
   1.213 +	BM_ERROR(r, r == KErrNone);	
   1.214 +	r = time.Attach(KPropBenchmarkCategory, 0);
   1.215 +	BM_ERROR(r, r == KErrNone);	
   1.216 +
   1.217 +	RProperty prop;	
   1.218 +	r = prop.Define(KPropBenchmarkCategory, 1, aM->iType, KPassPolicy, KPassPolicy);
   1.219 +	BM_ERROR(r, r == KErrNone);	
   1.220 +	r = prop.Attach(KPropBenchmarkCategory, 1);
   1.221 +	BM_ERROR(r, r == KErrNone);	
   1.222 +
   1.223 +	NotificationLatencyArgs sl(aM->iType, aM->iSize, aM->iRemote, aIter, aM->iSetGetType);
   1.224 +	MBMChild* child = property.SpawnChild(&sl);
   1.225 +	for (TBMUInt64 i = 0; i < aIter; ++i)
   1.226 +		{
   1.227 +		TRequestStatus st;
   1.228 +		prop.Subscribe(st);
   1.229 +		User::WaitForRequest(st);
   1.230 +		switch(aM->iSetGetType)
   1.231 +			{
   1.232 +		case EOneArg:
   1.233 +			if (aM->iType == RProperty::EInt)
   1.234 +				{
   1.235 +				TInt value;
   1.236 +				r = prop.Get(value);
   1.237 +				BM_ERROR(r, r == KErrNone);	
   1.238 +				}
   1.239 +			else 
   1.240 +				{
   1.241 +				r = prop.Get(iInBuf);
   1.242 +				BM_ERROR(r, r == KErrNone);	
   1.243 +				}
   1.244 +			break;
   1.245 +		case EThreeArgsInt:
   1.246 +			{
   1.247 +			TInt value;
   1.248 +			r = prop.Get(KPropBenchmarkCategory, 1, value);
   1.249 +			BM_ERROR(r, r == KErrNone);
   1.250 +			}
   1.251 +			break;
   1.252 +		case EThreeArgsBuf8:
   1.253 +			r = prop.Get(KPropBenchmarkCategory, 1, iInBuf);
   1.254 +			BM_ERROR(r, r == KErrNone);
   1.255 +			break;
   1.256 +		case EThreeArgsBuf16:
   1.257 +			r = prop.Get(KPropBenchmarkCategory, 1, iInBuf16);
   1.258 +			BM_ERROR(r, r == KErrNone);
   1.259 +			break;
   1.260 +			}
   1.261 +
   1.262 +		TBMTicks now;
   1.263 +		::bmTimer.Stamp(&now);
   1.264 +		BM_ERROR(st.Int(), st.Int() == KErrNone);
   1.265 +
   1.266 +		// subscribe for the time just before Set()
   1.267 +		time.Subscribe(st);
   1.268 +		User::WaitForRequest(st);
   1.269 +		BM_ERROR(st.Int(), st.Int() == KErrNone);
   1.270 +		// get the time just before Set()
   1.271 +		TBMTicks propSetTime;
   1.272 +		TPtr8 ptr((TUint8*) &propSetTime, sizeof(propSetTime), sizeof(propSetTime));
   1.273 +		r = time.Get(KPropBenchmarkCategory, 0, ptr);
   1.274 +		BM_ERROR(r, r == KErrNone);	
   1.275 +
   1.276 +		aResult->Cumulate(TBMTicksDelta(propSetTime, now));
   1.277 +		}
   1.278 +	prop.Close();
   1.279 +	time.Close();
   1.280 +	child->WaitChildExit();
   1.281 +	r = prop.Delete(KPropBenchmarkCategory, 1);
   1.282 +	BM_ERROR(r, r == KErrNone);	
   1.283 +	r = time.Delete(KPropBenchmarkCategory, 0);
   1.284 +	BM_ERROR(r, r == KErrNone);	
   1.285 +	}
   1.286 +
   1.287 +TInt Property::NotificationLatencyChild(TAny* cookie)
   1.288 +	{
   1.289 +	NotificationLatencyArgs* sl = (NotificationLatencyArgs*) cookie;
   1.290 +	TInt prio = BMProgram::SetAbsPriority(RThread(), sl->iChildOrigPriority);
   1.291 +
   1.292 +	for (TInt j = 0; j < RProperty::KMaxPropertySize; ++j)
   1.293 +		{
   1.294 +		iOutBuf[j] = (TUint8)(j + 1);
   1.295 +		}
   1.296 +	RProperty time;
   1.297 +	RProperty prop;
   1.298 +	TInt r = prop.Attach(KPropBenchmarkCategory, 1);
   1.299 +	BM_ERROR(r, r == KErrNone);	
   1.300 +	for (TBMUInt64 i = 0; i < sl->iIterationCount; ++i)
   1.301 +		{
   1.302 +		TBMTicks propSetTime;
   1.303 +		::bmTimer.Stamp(&propSetTime);
   1.304 +		switch(sl->iSetGetType)
   1.305 +			{
   1.306 +		case EOneArg:
   1.307 +			if (sl->iType == RProperty::EInt)
   1.308 +				{
   1.309 +				TInt value = 0xdeadbeef;
   1.310 +				r = prop.Set(value);
   1.311 +				BM_ERROR(r, r == KErrNone);
   1.312 +				}
   1.313 +			else 
   1.314 +				{
   1.315 +				TPtrC8 ptr(iOutBuf.Ptr(), sl->iSize);
   1.316 +				r = prop.Set(ptr);
   1.317 +				BM_ERROR(r, r == KErrNone);
   1.318 +				}
   1.319 +			break;
   1.320 +		case EThreeArgsInt:
   1.321 +			{
   1.322 +			TInt value = 0xdeadbeef;
   1.323 +			r = prop.Set(KPropBenchmarkCategory, 1, value);
   1.324 +			BM_ERROR(r, r == KErrNone);
   1.325 +			}
   1.326 +			break;
   1.327 +		case EThreeArgsBuf8:
   1.328 +			{
   1.329 +			TPtrC8 ptr(iOutBuf.Ptr(), sl->iSize);
   1.330 +			r = prop.Set(KPropBenchmarkCategory, 1, ptr);
   1.331 +			BM_ERROR(r, r == KErrNone);
   1.332 +			}
   1.333 +			break;
   1.334 +		case EThreeArgsBuf16:
   1.335 +			{
   1.336 +			TPtrC16 ptr(iOutBuf16.Ptr(), sl->iSize);
   1.337 +			r = prop.Set(KPropBenchmarkCategory, 1, ptr);
   1.338 +			BM_ERROR(r, r == KErrNone);
   1.339 +			}
   1.340 +			break;
   1.341 +			}
   1.342 +		// publish the time just before Set()
   1.343 +		TPtr8 ptr((TUint8*) &propSetTime, sizeof(propSetTime), sizeof(propSetTime));
   1.344 +		r = time.Set(KPropBenchmarkCategory, 0, ptr);
   1.345 +		BM_ERROR(r, r == KErrNone);
   1.346 +		}
   1.347 +	prop.Close();
   1.348 +	time.Close();
   1.349 +
   1.350 +	BMProgram::SetAbsPriority(RThread(), prio);
   1.351 +	return KErrNone;
   1.352 +	}
   1.353 +
   1.354 +						
   1.355 +void Property::SetOverhead(TBMResult* aResult, TBMUInt64 aIter, struct Measurement* aM)
   1.356 +	{
   1.357 +	RProperty prop;	
   1.358 +	TInt r = prop.Define(KPropBenchmarkCategory, 1, aM->iType, KPassPolicy, KPassPolicy);
   1.359 +	BM_ERROR(r, r == KErrNone);	
   1.360 +	r = prop.Attach(KPropBenchmarkCategory, 1);
   1.361 +	BM_ERROR(r, r == KErrNone);	
   1.362 +
   1.363 +	if (aM->iType == RProperty::EByteArray)
   1.364 +		{
   1.365 +		TPtrC8 ptr(iOutBuf.Ptr(), aM->iSize);
   1.366 +		r = prop.Set(ptr);
   1.367 +		BM_ERROR(r, r == KErrNone);
   1.368 +		}
   1.369 +
   1.370 +	TBMTimeInterval ti;
   1.371 +	ti.Begin();
   1.372 +	for (TBMUInt64 i = 0; i < aIter; ++i)
   1.373 +		{
   1.374 +		switch(aM->iSetGetType)
   1.375 +			{
   1.376 +		case EOneArg:
   1.377 +			if (aM->iType == RProperty::EInt)
   1.378 +				{
   1.379 +				TInt value = 1;
   1.380 +				r = prop.Set(value);
   1.381 +				BM_ERROR(r, r == KErrNone);	
   1.382 +				}
   1.383 +			else 
   1.384 +				{
   1.385 +				TPtrC8 ptr(iOutBuf.Ptr(), aM->iSize);
   1.386 +				r = prop.Set(ptr);
   1.387 +				BM_ERROR(r, r == KErrNone);	
   1.388 +				}
   1.389 +			break;
   1.390 +		case EThreeArgsInt:
   1.391 +			{
   1.392 +			TInt value = 1;
   1.393 +			r = prop.Set(KPropBenchmarkCategory, 1, value);
   1.394 +			BM_ERROR(r, r == KErrNone);
   1.395 +			}
   1.396 +			break;
   1.397 +		case EThreeArgsBuf8:
   1.398 +			{
   1.399 +			TPtrC8 ptr(iOutBuf.Ptr(), aM->iSize);
   1.400 +			r = prop.Set(KPropBenchmarkCategory, 1, ptr);
   1.401 +			BM_ERROR(r, r == KErrNone);
   1.402 +			}
   1.403 +			break;
   1.404 +		case EThreeArgsBuf16:
   1.405 +			{
   1.406 +			TPtrC16 ptr(iOutBuf16.Ptr(), aM->iSize);
   1.407 +			r = prop.Set(KPropBenchmarkCategory, 1, ptr);
   1.408 +			BM_ERROR(r, r == KErrNone);
   1.409 +			}
   1.410 +			break;
   1.411 +			}
   1.412 +		}
   1.413 +	TBMTicks t = ti.End();
   1.414 +
   1.415 +	prop.Close();
   1.416 +	r = prop.Delete(KPropBenchmarkCategory, 1);
   1.417 +	BM_ERROR(r, r == KErrNone);	
   1.418 +
   1.419 +	aResult->Cumulate(t, aIter);
   1.420 +	}
   1.421 +
   1.422 +void Property::GetOverhead(TBMResult* aResult, TBMUInt64 aIter, struct Measurement* aM)
   1.423 +	{
   1.424 +	RProperty prop;	
   1.425 +	TInt r = prop.Define(KPropBenchmarkCategory, 1, aM->iType, KPassPolicy, KPassPolicy);
   1.426 +	BM_ERROR(r, r == KErrNone);	
   1.427 +	r = prop.Attach(KPropBenchmarkCategory, 1);
   1.428 +	BM_ERROR(r, r == KErrNone);	
   1.429 +
   1.430 +	if (aM->iType == RProperty::EByteArray)
   1.431 +		{
   1.432 +		TPtrC8 ptr(iOutBuf.Ptr(), aM->iSize);
   1.433 +		r = prop.Set(ptr);
   1.434 +		BM_ERROR(r, r == KErrNone);
   1.435 +		}
   1.436 +
   1.437 +	TBMTimeInterval ti;
   1.438 +	ti.Begin();
   1.439 +	for (TBMUInt64 i = 0; i < aIter; ++i)
   1.440 +		{
   1.441 +		switch(aM->iSetGetType)
   1.442 +			{
   1.443 +		case EOneArg:
   1.444 +			if (aM->iType == RProperty::EInt)
   1.445 +				{
   1.446 +				TInt value = 1;
   1.447 +				r = prop.Get(value);
   1.448 +				BM_ERROR(r, r == KErrNone);	
   1.449 +				}
   1.450 +			else 
   1.451 +				{
   1.452 +				r = prop.Get(iInBuf);
   1.453 +				BM_ERROR(r, r == KErrNone);	
   1.454 +				}
   1.455 +			break;
   1.456 +		case EThreeArgsInt:
   1.457 +			{
   1.458 +			TInt value = 1;
   1.459 +			r = prop.Get(KPropBenchmarkCategory, 1, value);
   1.460 +			BM_ERROR(r, r == KErrNone);
   1.461 +			}
   1.462 +			break;
   1.463 +		case EThreeArgsBuf8:
   1.464 +			r = prop.Get(KPropBenchmarkCategory, 1, iInBuf);
   1.465 +			BM_ERROR(r, r == KErrNone);
   1.466 +			break;
   1.467 +		case EThreeArgsBuf16:
   1.468 +			r = prop.Get(KPropBenchmarkCategory, 1, iInBuf16);
   1.469 +			BM_ERROR(r, r == KErrNone);
   1.470 +			break;
   1.471 +			}
   1.472 +		}
   1.473 +	TBMTicks t = ti.End();
   1.474 +
   1.475 +	prop.Close();
   1.476 +	r = prop.Delete(KPropBenchmarkCategory, 1);
   1.477 +	BM_ERROR(r, r == KErrNone);	
   1.478 +
   1.479 +	aResult->Cumulate(t, aIter);
   1.480 +	}
   1.481 +
   1.482 +
   1.483 +
   1.484 +TBMResult* Property::Run(TBMUInt64 aIter, TInt* aCount)
   1.485 +	{
   1.486 +	TInt count = sizeof(iResults)/sizeof(iResults[0]);
   1.487 +
   1.488 +	for (TInt i = 0; i < count; ++i)
   1.489 +		{
   1.490 +		iResults[i].Reset(iMeasurements[i].iName);
   1.491 +		iMeasurements[i].iFunc(&iResults[i], aIter, &iMeasurements[i]);
   1.492 +		iResults[i].Update();
   1.493 +		}
   1.494 +	
   1.495 +	*aCount = count;
   1.496 +	return iResults;
   1.497 +	}
   1.498 +
   1.499 +void AddProperty()
   1.500 +	{
   1.501 +	BMProgram* next = bmSuite;
   1.502 +	bmSuite=(BMProgram*)&property;
   1.503 +	bmSuite->Next()=next;
   1.504 +	}