sl@0
|
1 |
// Copyright (c) 2002-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 the License "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 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <e32test.h>
|
sl@0
|
17 |
#include <e32property.h>
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "bm_suite.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
static const TInt32 KUidPropBenchmarkCategoryValue = 0x101f75b7;
|
sl@0
|
22 |
static const TUid KPropBenchmarkCategory = { KUidPropBenchmarkCategoryValue };
|
sl@0
|
23 |
static _LIT_SECURITY_POLICY_PASS(KPassPolicy);
|
sl@0
|
24 |
|
sl@0
|
25 |
typedef void (*MeasurementFunc)(TBMResult*, TBMUInt64 aIter, struct Measurement*);
|
sl@0
|
26 |
enum TSetGetType
|
sl@0
|
27 |
{
|
sl@0
|
28 |
EOneArg,
|
sl@0
|
29 |
EThreeArgsInt,
|
sl@0
|
30 |
EThreeArgsBuf8,
|
sl@0
|
31 |
EThreeArgsBuf16
|
sl@0
|
32 |
};
|
sl@0
|
33 |
|
sl@0
|
34 |
struct Measurement
|
sl@0
|
35 |
{
|
sl@0
|
36 |
MeasurementFunc iFunc;
|
sl@0
|
37 |
TPtrC iName;
|
sl@0
|
38 |
TBool iRemote;
|
sl@0
|
39 |
RProperty::TType iType;
|
sl@0
|
40 |
TInt iSize;
|
sl@0
|
41 |
TSetGetType iSetGetType;
|
sl@0
|
42 |
|
sl@0
|
43 |
Measurement(MeasurementFunc aFunc, const TDesC& aName,
|
sl@0
|
44 |
RProperty::TType aType, TInt aSize, TBool aRemote = EFalse,
|
sl@0
|
45 |
TSetGetType aSetGetType = EOneArg) :
|
sl@0
|
46 |
iFunc(aFunc), iName(aName), iRemote(aRemote), iType(aType), iSize(aSize),
|
sl@0
|
47 |
iSetGetType(aSetGetType) {}
|
sl@0
|
48 |
};
|
sl@0
|
49 |
|
sl@0
|
50 |
class Property : public BMProgram
|
sl@0
|
51 |
{
|
sl@0
|
52 |
public :
|
sl@0
|
53 |
Property() : BMProgram(_L("Properties"))
|
sl@0
|
54 |
{}
|
sl@0
|
55 |
virtual TBMResult* Run(TBMUInt64 aIter, TInt* aCount);
|
sl@0
|
56 |
|
sl@0
|
57 |
|
sl@0
|
58 |
static TBMResult iResults[];
|
sl@0
|
59 |
static Measurement iMeasurements[];
|
sl@0
|
60 |
|
sl@0
|
61 |
static void NotificationLatencyParent(TBMResult* aResult, TBMUInt64 aIter, Measurement*);
|
sl@0
|
62 |
static TInt NotificationLatencyChild(TAny*);
|
sl@0
|
63 |
|
sl@0
|
64 |
static void SetOverhead(TBMResult* aResult, TBMUInt64 aIter, struct Measurement* aM);
|
sl@0
|
65 |
static void GetOverhead(TBMResult* aResult, TBMUInt64 aIter, struct Measurement* aM);
|
sl@0
|
66 |
|
sl@0
|
67 |
|
sl@0
|
68 |
private:
|
sl@0
|
69 |
static TBuf8<RProperty::KMaxPropertySize> iInBuf;
|
sl@0
|
70 |
static TBuf8<RProperty::KMaxPropertySize> iOutBuf;
|
sl@0
|
71 |
static TBuf16<RProperty::KMaxPropertySize> iInBuf16;
|
sl@0
|
72 |
static TBuf16<RProperty::KMaxPropertySize> iOutBuf16;
|
sl@0
|
73 |
};
|
sl@0
|
74 |
|
sl@0
|
75 |
Measurement Property::iMeasurements[] =
|
sl@0
|
76 |
{
|
sl@0
|
77 |
Measurement(&Property::NotificationLatencyParent, _L("Local Int Notification Latency "),
|
sl@0
|
78 |
RProperty::EInt, 0, EFalse),
|
sl@0
|
79 |
Measurement(&Property::NotificationLatencyParent, _L("Remote Int Notification Latency"),
|
sl@0
|
80 |
RProperty::EInt, 0,ETrue),
|
sl@0
|
81 |
Measurement(&Property::NotificationLatencyParent, _L("Local Byte(1) Notification Latency"),
|
sl@0
|
82 |
RProperty::EByteArray, 1, EFalse),
|
sl@0
|
83 |
Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(1) Notification Latency"),
|
sl@0
|
84 |
RProperty::EByteArray, 1, ETrue),
|
sl@0
|
85 |
Measurement(&Property::NotificationLatencyParent, _L("Local Byte(8) Notification Latency"),
|
sl@0
|
86 |
RProperty::EByteArray, 8, EFalse),
|
sl@0
|
87 |
Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(8) Notification Latency"),
|
sl@0
|
88 |
RProperty::EByteArray, 8,ETrue),
|
sl@0
|
89 |
Measurement(&Property::NotificationLatencyParent, _L("Local Byte(512) Notification Latency"),
|
sl@0
|
90 |
RProperty::EByteArray, 512, EFalse),
|
sl@0
|
91 |
Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(512) Notification Latency"),
|
sl@0
|
92 |
RProperty::EByteArray, 512,ETrue),
|
sl@0
|
93 |
|
sl@0
|
94 |
Measurement(&Property::NotificationLatencyParent, _L("Local Int Notification Latency ThreeArgsInt"),
|
sl@0
|
95 |
RProperty::EInt, 0, EFalse, EThreeArgsInt),
|
sl@0
|
96 |
Measurement(&Property::NotificationLatencyParent, _L("Remote Int Notification Latency ThreeArgsInt"),
|
sl@0
|
97 |
RProperty::EInt, 0,ETrue, EThreeArgsInt),
|
sl@0
|
98 |
Measurement(&Property::NotificationLatencyParent, _L("Local Byte(1) Notification Latency ThreeArgsBuf8"),
|
sl@0
|
99 |
RProperty::EByteArray, 1, EFalse, EThreeArgsBuf8),
|
sl@0
|
100 |
Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(1) Notification Latency ThreeArgsBuf8"),
|
sl@0
|
101 |
RProperty::EByteArray, 1, ETrue, EThreeArgsBuf8),
|
sl@0
|
102 |
Measurement(&Property::NotificationLatencyParent, _L("Local TUint16(1) Notification Latency ThreeArgsBuf16"),
|
sl@0
|
103 |
RProperty::EByteArray, 1, EFalse, EThreeArgsBuf16),
|
sl@0
|
104 |
Measurement(&Property::NotificationLatencyParent, _L("Remote TUint16(1) Notification Latency ThreeArgsBuf16"),
|
sl@0
|
105 |
RProperty::EByteArray, 1, ETrue, EThreeArgsBuf16),
|
sl@0
|
106 |
Measurement(&Property::NotificationLatencyParent, _L("Local Byte(8) Notification Latency ThreeArgsBuf8"),
|
sl@0
|
107 |
RProperty::EByteArray, 8, EFalse, EThreeArgsBuf8),
|
sl@0
|
108 |
Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(8) Notification Latency ThreeArgsBuf8"),
|
sl@0
|
109 |
RProperty::EByteArray, 8,ETrue, EThreeArgsBuf8),
|
sl@0
|
110 |
Measurement(&Property::NotificationLatencyParent, _L("Local TUint16(8) Notification Latency ThreeArgsBuf16"),
|
sl@0
|
111 |
RProperty::EByteArray, 8, EFalse, EThreeArgsBuf16),
|
sl@0
|
112 |
Measurement(&Property::NotificationLatencyParent, _L("Remote TUint16(8) Notification Latency ThreeArgsBuf16"),
|
sl@0
|
113 |
RProperty::EByteArray, 8,ETrue, EThreeArgsBuf16),
|
sl@0
|
114 |
Measurement(&Property::NotificationLatencyParent, _L("Local Byte(512) Notification Latency ThreeArgsBuf8"),
|
sl@0
|
115 |
RProperty::EByteArray, 512, EFalse, EThreeArgsBuf8),
|
sl@0
|
116 |
Measurement(&Property::NotificationLatencyParent, _L("Remote Byte(512) Notification Latency ThreeArgsBuf8"),
|
sl@0
|
117 |
RProperty::EByteArray, 512,ETrue, EThreeArgsBuf8),
|
sl@0
|
118 |
Measurement(&Property::NotificationLatencyParent, _L("Local TUint16(512) Notification Latency ThreeArgsBuf16"),
|
sl@0
|
119 |
RProperty::ELargeByteArray, 512, EFalse, EThreeArgsBuf16),
|
sl@0
|
120 |
Measurement(&Property::NotificationLatencyParent, _L("Remote TUint16(512) Notification Latency ThreeArgsBuf16"),
|
sl@0
|
121 |
RProperty::ELargeByteArray, 512,ETrue, EThreeArgsBuf16),
|
sl@0
|
122 |
|
sl@0
|
123 |
|
sl@0
|
124 |
|
sl@0
|
125 |
Measurement(&Property::SetOverhead, _L("Int Set Overhead"),
|
sl@0
|
126 |
RProperty::EInt, 0),
|
sl@0
|
127 |
Measurement(&Property::SetOverhead, _L("Byte(1) Set Overhead"),
|
sl@0
|
128 |
RProperty::EByteArray, 1),
|
sl@0
|
129 |
Measurement(&Property::SetOverhead, _L("Byte(8) Set Overhead"),
|
sl@0
|
130 |
RProperty::EByteArray, 8),
|
sl@0
|
131 |
Measurement(&Property::SetOverhead, _L("Byte(512) Set Overhead"),
|
sl@0
|
132 |
RProperty::EByteArray, 512),
|
sl@0
|
133 |
|
sl@0
|
134 |
Measurement(&Property::SetOverhead, _L("Int Set Overhead ThreeArgsInt"),
|
sl@0
|
135 |
RProperty::EInt, 0, EFalse, EThreeArgsInt),
|
sl@0
|
136 |
Measurement(&Property::SetOverhead, _L("Byte(1) Set Overhead ThreeArgsBuf8"),
|
sl@0
|
137 |
RProperty::EByteArray, 1, EFalse, EThreeArgsBuf8),
|
sl@0
|
138 |
Measurement(&Property::SetOverhead, _L("TUint16(1) Set Overhead ThreeArgsBuf16"),
|
sl@0
|
139 |
RProperty::EByteArray, 1, EFalse, EThreeArgsBuf16),
|
sl@0
|
140 |
Measurement(&Property::SetOverhead, _L("Byte(8) Set Overhead ThreeArgsBuf8"),
|
sl@0
|
141 |
RProperty::EByteArray, 8, EFalse, EThreeArgsBuf8),
|
sl@0
|
142 |
Measurement(&Property::SetOverhead, _L("TUint16(8) Set Overhead ThreeArgsBuf16"),
|
sl@0
|
143 |
RProperty::EByteArray, 8, EFalse, EThreeArgsBuf16),
|
sl@0
|
144 |
Measurement(&Property::SetOverhead, _L("Byte(512) Set Overhead ThreeArgsBuf8"),
|
sl@0
|
145 |
RProperty::EByteArray, 512, EFalse, EThreeArgsBuf8),
|
sl@0
|
146 |
Measurement(&Property::SetOverhead, _L("TUint16(512) Set Overhead ThreeArgsBuf16"),
|
sl@0
|
147 |
RProperty::ELargeByteArray, 512, EFalse, EThreeArgsBuf16),
|
sl@0
|
148 |
|
sl@0
|
149 |
|
sl@0
|
150 |
|
sl@0
|
151 |
Measurement(&Property::GetOverhead, _L("Int Get Overhead"),
|
sl@0
|
152 |
RProperty::EInt, 0),
|
sl@0
|
153 |
Measurement(&Property::GetOverhead, _L("Byte(1) Get Overhead"),
|
sl@0
|
154 |
RProperty::EByteArray, 1),
|
sl@0
|
155 |
Measurement(&Property::GetOverhead, _L("Byte(8) Get Overhead"),
|
sl@0
|
156 |
RProperty::EByteArray, 8),
|
sl@0
|
157 |
Measurement(&Property::GetOverhead, _L("Byte(512) Get Overhead"),
|
sl@0
|
158 |
RProperty::EByteArray, 512),
|
sl@0
|
159 |
|
sl@0
|
160 |
Measurement(&Property::GetOverhead, _L("Int Get Overhead ThreeArgsInt"),
|
sl@0
|
161 |
RProperty::EInt, 0, EFalse, EThreeArgsInt),
|
sl@0
|
162 |
Measurement(&Property::GetOverhead, _L("Byte(1) Get Overhead ThreeArgsBuf8"),
|
sl@0
|
163 |
RProperty::EByteArray, 1, EFalse, EThreeArgsBuf8),
|
sl@0
|
164 |
Measurement(&Property::GetOverhead, _L("TUint16(1) Get Overhead ThreeArgsBuf16"),
|
sl@0
|
165 |
RProperty::EByteArray, 1, EFalse, EThreeArgsBuf16),
|
sl@0
|
166 |
Measurement(&Property::GetOverhead, _L("Byte(8) Get Overhead ThreeArgsBuf8"),
|
sl@0
|
167 |
RProperty::EByteArray, 8, EFalse, EThreeArgsBuf8),
|
sl@0
|
168 |
Measurement(&Property::GetOverhead, _L("TUint16(8) Get Overhead ThreeArgsBuf16"),
|
sl@0
|
169 |
RProperty::EByteArray, 8, EFalse, EThreeArgsBuf16),
|
sl@0
|
170 |
Measurement(&Property::GetOverhead, _L("Byte(512) Get Overhead ThreeArgsBuf8"),
|
sl@0
|
171 |
RProperty::EByteArray, 512, EFalse, EThreeArgsBuf8),
|
sl@0
|
172 |
Measurement(&Property::GetOverhead, _L("TUint16(512) Get Overhead ThreeArgsBuf16"),
|
sl@0
|
173 |
RProperty::ELargeByteArray, 512, EFalse, EThreeArgsBuf16),
|
sl@0
|
174 |
|
sl@0
|
175 |
};
|
sl@0
|
176 |
TBMResult Property::iResults[sizeof(Property::iMeasurements)/sizeof(Property::iMeasurements[0])];
|
sl@0
|
177 |
|
sl@0
|
178 |
TBuf8<RProperty::KMaxPropertySize> Property::iInBuf(RProperty::KMaxPropertySize);
|
sl@0
|
179 |
TBuf8<RProperty::KMaxPropertySize> Property::iOutBuf(RProperty::KMaxPropertySize);
|
sl@0
|
180 |
TBuf16<RProperty::KMaxPropertySize> Property::iInBuf16(RProperty::KMaxPropertySize);
|
sl@0
|
181 |
TBuf16<RProperty::KMaxPropertySize> Property::iOutBuf16(RProperty::KMaxPropertySize);
|
sl@0
|
182 |
|
sl@0
|
183 |
|
sl@0
|
184 |
static Property property;
|
sl@0
|
185 |
|
sl@0
|
186 |
class NotificationLatencyArgs : public TBMSpawnArgs
|
sl@0
|
187 |
{
|
sl@0
|
188 |
public:
|
sl@0
|
189 |
|
sl@0
|
190 |
TBMUInt64 iIterationCount;
|
sl@0
|
191 |
RProperty::TType iType;
|
sl@0
|
192 |
TInt iSize;
|
sl@0
|
193 |
TSetGetType iSetGetType;
|
sl@0
|
194 |
|
sl@0
|
195 |
NotificationLatencyArgs(RProperty::TType aType, TInt aSize, TInt aRemote, TBMUInt64 aIter,
|
sl@0
|
196 |
TSetGetType aSetGetType);
|
sl@0
|
197 |
};
|
sl@0
|
198 |
|
sl@0
|
199 |
NotificationLatencyArgs::NotificationLatencyArgs(RProperty::TType aType, TInt aSize, TInt aRemote,
|
sl@0
|
200 |
TBMUInt64 aIter, TSetGetType aSetGetType) :
|
sl@0
|
201 |
TBMSpawnArgs(Property::NotificationLatencyChild, KBMPriorityLow, aRemote, sizeof(*this)),
|
sl@0
|
202 |
iIterationCount(aIter), iType(aType), iSize(aSize), iSetGetType(aSetGetType)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
}
|
sl@0
|
205 |
|
sl@0
|
206 |
void Property::NotificationLatencyParent(TBMResult* aResult, TBMUInt64 aIter, struct Measurement* aM)
|
sl@0
|
207 |
{
|
sl@0
|
208 |
RProperty time;
|
sl@0
|
209 |
TInt r = time.Define(KPropBenchmarkCategory, 0, RProperty::EByteArray, KPassPolicy, KPassPolicy);
|
sl@0
|
210 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
211 |
r = time.Attach(KPropBenchmarkCategory, 0);
|
sl@0
|
212 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
213 |
|
sl@0
|
214 |
RProperty prop;
|
sl@0
|
215 |
r = prop.Define(KPropBenchmarkCategory, 1, aM->iType, KPassPolicy, KPassPolicy);
|
sl@0
|
216 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
217 |
r = prop.Attach(KPropBenchmarkCategory, 1);
|
sl@0
|
218 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
219 |
|
sl@0
|
220 |
NotificationLatencyArgs sl(aM->iType, aM->iSize, aM->iRemote, aIter, aM->iSetGetType);
|
sl@0
|
221 |
MBMChild* child = property.SpawnChild(&sl);
|
sl@0
|
222 |
for (TBMUInt64 i = 0; i < aIter; ++i)
|
sl@0
|
223 |
{
|
sl@0
|
224 |
TRequestStatus st;
|
sl@0
|
225 |
prop.Subscribe(st);
|
sl@0
|
226 |
User::WaitForRequest(st);
|
sl@0
|
227 |
switch(aM->iSetGetType)
|
sl@0
|
228 |
{
|
sl@0
|
229 |
case EOneArg:
|
sl@0
|
230 |
if (aM->iType == RProperty::EInt)
|
sl@0
|
231 |
{
|
sl@0
|
232 |
TInt value;
|
sl@0
|
233 |
r = prop.Get(value);
|
sl@0
|
234 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
235 |
}
|
sl@0
|
236 |
else
|
sl@0
|
237 |
{
|
sl@0
|
238 |
r = prop.Get(iInBuf);
|
sl@0
|
239 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
240 |
}
|
sl@0
|
241 |
break;
|
sl@0
|
242 |
case EThreeArgsInt:
|
sl@0
|
243 |
{
|
sl@0
|
244 |
TInt value;
|
sl@0
|
245 |
r = prop.Get(KPropBenchmarkCategory, 1, value);
|
sl@0
|
246 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
247 |
}
|
sl@0
|
248 |
break;
|
sl@0
|
249 |
case EThreeArgsBuf8:
|
sl@0
|
250 |
r = prop.Get(KPropBenchmarkCategory, 1, iInBuf);
|
sl@0
|
251 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
252 |
break;
|
sl@0
|
253 |
case EThreeArgsBuf16:
|
sl@0
|
254 |
r = prop.Get(KPropBenchmarkCategory, 1, iInBuf16);
|
sl@0
|
255 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
256 |
break;
|
sl@0
|
257 |
}
|
sl@0
|
258 |
|
sl@0
|
259 |
TBMTicks now;
|
sl@0
|
260 |
::bmTimer.Stamp(&now);
|
sl@0
|
261 |
BM_ERROR(st.Int(), st.Int() == KErrNone);
|
sl@0
|
262 |
|
sl@0
|
263 |
// subscribe for the time just before Set()
|
sl@0
|
264 |
time.Subscribe(st);
|
sl@0
|
265 |
User::WaitForRequest(st);
|
sl@0
|
266 |
BM_ERROR(st.Int(), st.Int() == KErrNone);
|
sl@0
|
267 |
// get the time just before Set()
|
sl@0
|
268 |
TBMTicks propSetTime;
|
sl@0
|
269 |
TPtr8 ptr((TUint8*) &propSetTime, sizeof(propSetTime), sizeof(propSetTime));
|
sl@0
|
270 |
r = time.Get(KPropBenchmarkCategory, 0, ptr);
|
sl@0
|
271 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
272 |
|
sl@0
|
273 |
aResult->Cumulate(TBMTicksDelta(propSetTime, now));
|
sl@0
|
274 |
}
|
sl@0
|
275 |
prop.Close();
|
sl@0
|
276 |
time.Close();
|
sl@0
|
277 |
child->WaitChildExit();
|
sl@0
|
278 |
r = prop.Delete(KPropBenchmarkCategory, 1);
|
sl@0
|
279 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
280 |
r = time.Delete(KPropBenchmarkCategory, 0);
|
sl@0
|
281 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
282 |
}
|
sl@0
|
283 |
|
sl@0
|
284 |
TInt Property::NotificationLatencyChild(TAny* cookie)
|
sl@0
|
285 |
{
|
sl@0
|
286 |
NotificationLatencyArgs* sl = (NotificationLatencyArgs*) cookie;
|
sl@0
|
287 |
TInt prio = BMProgram::SetAbsPriority(RThread(), sl->iChildOrigPriority);
|
sl@0
|
288 |
|
sl@0
|
289 |
for (TInt j = 0; j < RProperty::KMaxPropertySize; ++j)
|
sl@0
|
290 |
{
|
sl@0
|
291 |
iOutBuf[j] = (TUint8)(j + 1);
|
sl@0
|
292 |
}
|
sl@0
|
293 |
RProperty time;
|
sl@0
|
294 |
RProperty prop;
|
sl@0
|
295 |
TInt r = prop.Attach(KPropBenchmarkCategory, 1);
|
sl@0
|
296 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
297 |
for (TBMUInt64 i = 0; i < sl->iIterationCount; ++i)
|
sl@0
|
298 |
{
|
sl@0
|
299 |
TBMTicks propSetTime;
|
sl@0
|
300 |
::bmTimer.Stamp(&propSetTime);
|
sl@0
|
301 |
switch(sl->iSetGetType)
|
sl@0
|
302 |
{
|
sl@0
|
303 |
case EOneArg:
|
sl@0
|
304 |
if (sl->iType == RProperty::EInt)
|
sl@0
|
305 |
{
|
sl@0
|
306 |
TInt value = 0xdeadbeef;
|
sl@0
|
307 |
r = prop.Set(value);
|
sl@0
|
308 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
309 |
}
|
sl@0
|
310 |
else
|
sl@0
|
311 |
{
|
sl@0
|
312 |
TPtrC8 ptr(iOutBuf.Ptr(), sl->iSize);
|
sl@0
|
313 |
r = prop.Set(ptr);
|
sl@0
|
314 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
315 |
}
|
sl@0
|
316 |
break;
|
sl@0
|
317 |
case EThreeArgsInt:
|
sl@0
|
318 |
{
|
sl@0
|
319 |
TInt value = 0xdeadbeef;
|
sl@0
|
320 |
r = prop.Set(KPropBenchmarkCategory, 1, value);
|
sl@0
|
321 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
322 |
}
|
sl@0
|
323 |
break;
|
sl@0
|
324 |
case EThreeArgsBuf8:
|
sl@0
|
325 |
{
|
sl@0
|
326 |
TPtrC8 ptr(iOutBuf.Ptr(), sl->iSize);
|
sl@0
|
327 |
r = prop.Set(KPropBenchmarkCategory, 1, ptr);
|
sl@0
|
328 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
329 |
}
|
sl@0
|
330 |
break;
|
sl@0
|
331 |
case EThreeArgsBuf16:
|
sl@0
|
332 |
{
|
sl@0
|
333 |
TPtrC16 ptr(iOutBuf16.Ptr(), sl->iSize);
|
sl@0
|
334 |
r = prop.Set(KPropBenchmarkCategory, 1, ptr);
|
sl@0
|
335 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
336 |
}
|
sl@0
|
337 |
break;
|
sl@0
|
338 |
}
|
sl@0
|
339 |
// publish the time just before Set()
|
sl@0
|
340 |
TPtr8 ptr((TUint8*) &propSetTime, sizeof(propSetTime), sizeof(propSetTime));
|
sl@0
|
341 |
r = time.Set(KPropBenchmarkCategory, 0, ptr);
|
sl@0
|
342 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
343 |
}
|
sl@0
|
344 |
prop.Close();
|
sl@0
|
345 |
time.Close();
|
sl@0
|
346 |
|
sl@0
|
347 |
BMProgram::SetAbsPriority(RThread(), prio);
|
sl@0
|
348 |
return KErrNone;
|
sl@0
|
349 |
}
|
sl@0
|
350 |
|
sl@0
|
351 |
|
sl@0
|
352 |
void Property::SetOverhead(TBMResult* aResult, TBMUInt64 aIter, struct Measurement* aM)
|
sl@0
|
353 |
{
|
sl@0
|
354 |
RProperty prop;
|
sl@0
|
355 |
TInt r = prop.Define(KPropBenchmarkCategory, 1, aM->iType, KPassPolicy, KPassPolicy);
|
sl@0
|
356 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
357 |
r = prop.Attach(KPropBenchmarkCategory, 1);
|
sl@0
|
358 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
359 |
|
sl@0
|
360 |
if (aM->iType == RProperty::EByteArray)
|
sl@0
|
361 |
{
|
sl@0
|
362 |
TPtrC8 ptr(iOutBuf.Ptr(), aM->iSize);
|
sl@0
|
363 |
r = prop.Set(ptr);
|
sl@0
|
364 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
365 |
}
|
sl@0
|
366 |
|
sl@0
|
367 |
TBMTimeInterval ti;
|
sl@0
|
368 |
ti.Begin();
|
sl@0
|
369 |
for (TBMUInt64 i = 0; i < aIter; ++i)
|
sl@0
|
370 |
{
|
sl@0
|
371 |
switch(aM->iSetGetType)
|
sl@0
|
372 |
{
|
sl@0
|
373 |
case EOneArg:
|
sl@0
|
374 |
if (aM->iType == RProperty::EInt)
|
sl@0
|
375 |
{
|
sl@0
|
376 |
TInt value = 1;
|
sl@0
|
377 |
r = prop.Set(value);
|
sl@0
|
378 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
379 |
}
|
sl@0
|
380 |
else
|
sl@0
|
381 |
{
|
sl@0
|
382 |
TPtrC8 ptr(iOutBuf.Ptr(), aM->iSize);
|
sl@0
|
383 |
r = prop.Set(ptr);
|
sl@0
|
384 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
385 |
}
|
sl@0
|
386 |
break;
|
sl@0
|
387 |
case EThreeArgsInt:
|
sl@0
|
388 |
{
|
sl@0
|
389 |
TInt value = 1;
|
sl@0
|
390 |
r = prop.Set(KPropBenchmarkCategory, 1, value);
|
sl@0
|
391 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
392 |
}
|
sl@0
|
393 |
break;
|
sl@0
|
394 |
case EThreeArgsBuf8:
|
sl@0
|
395 |
{
|
sl@0
|
396 |
TPtrC8 ptr(iOutBuf.Ptr(), aM->iSize);
|
sl@0
|
397 |
r = prop.Set(KPropBenchmarkCategory, 1, ptr);
|
sl@0
|
398 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
399 |
}
|
sl@0
|
400 |
break;
|
sl@0
|
401 |
case EThreeArgsBuf16:
|
sl@0
|
402 |
{
|
sl@0
|
403 |
TPtrC16 ptr(iOutBuf16.Ptr(), aM->iSize);
|
sl@0
|
404 |
r = prop.Set(KPropBenchmarkCategory, 1, ptr);
|
sl@0
|
405 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
406 |
}
|
sl@0
|
407 |
break;
|
sl@0
|
408 |
}
|
sl@0
|
409 |
}
|
sl@0
|
410 |
TBMTicks t = ti.End();
|
sl@0
|
411 |
|
sl@0
|
412 |
prop.Close();
|
sl@0
|
413 |
r = prop.Delete(KPropBenchmarkCategory, 1);
|
sl@0
|
414 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
415 |
|
sl@0
|
416 |
aResult->Cumulate(t, aIter);
|
sl@0
|
417 |
}
|
sl@0
|
418 |
|
sl@0
|
419 |
void Property::GetOverhead(TBMResult* aResult, TBMUInt64 aIter, struct Measurement* aM)
|
sl@0
|
420 |
{
|
sl@0
|
421 |
RProperty prop;
|
sl@0
|
422 |
TInt r = prop.Define(KPropBenchmarkCategory, 1, aM->iType, KPassPolicy, KPassPolicy);
|
sl@0
|
423 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
424 |
r = prop.Attach(KPropBenchmarkCategory, 1);
|
sl@0
|
425 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
426 |
|
sl@0
|
427 |
if (aM->iType == RProperty::EByteArray)
|
sl@0
|
428 |
{
|
sl@0
|
429 |
TPtrC8 ptr(iOutBuf.Ptr(), aM->iSize);
|
sl@0
|
430 |
r = prop.Set(ptr);
|
sl@0
|
431 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
432 |
}
|
sl@0
|
433 |
|
sl@0
|
434 |
TBMTimeInterval ti;
|
sl@0
|
435 |
ti.Begin();
|
sl@0
|
436 |
for (TBMUInt64 i = 0; i < aIter; ++i)
|
sl@0
|
437 |
{
|
sl@0
|
438 |
switch(aM->iSetGetType)
|
sl@0
|
439 |
{
|
sl@0
|
440 |
case EOneArg:
|
sl@0
|
441 |
if (aM->iType == RProperty::EInt)
|
sl@0
|
442 |
{
|
sl@0
|
443 |
TInt value = 1;
|
sl@0
|
444 |
r = prop.Get(value);
|
sl@0
|
445 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
446 |
}
|
sl@0
|
447 |
else
|
sl@0
|
448 |
{
|
sl@0
|
449 |
r = prop.Get(iInBuf);
|
sl@0
|
450 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
451 |
}
|
sl@0
|
452 |
break;
|
sl@0
|
453 |
case EThreeArgsInt:
|
sl@0
|
454 |
{
|
sl@0
|
455 |
TInt value = 1;
|
sl@0
|
456 |
r = prop.Get(KPropBenchmarkCategory, 1, value);
|
sl@0
|
457 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
458 |
}
|
sl@0
|
459 |
break;
|
sl@0
|
460 |
case EThreeArgsBuf8:
|
sl@0
|
461 |
r = prop.Get(KPropBenchmarkCategory, 1, iInBuf);
|
sl@0
|
462 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
463 |
break;
|
sl@0
|
464 |
case EThreeArgsBuf16:
|
sl@0
|
465 |
r = prop.Get(KPropBenchmarkCategory, 1, iInBuf16);
|
sl@0
|
466 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
467 |
break;
|
sl@0
|
468 |
}
|
sl@0
|
469 |
}
|
sl@0
|
470 |
TBMTicks t = ti.End();
|
sl@0
|
471 |
|
sl@0
|
472 |
prop.Close();
|
sl@0
|
473 |
r = prop.Delete(KPropBenchmarkCategory, 1);
|
sl@0
|
474 |
BM_ERROR(r, r == KErrNone);
|
sl@0
|
475 |
|
sl@0
|
476 |
aResult->Cumulate(t, aIter);
|
sl@0
|
477 |
}
|
sl@0
|
478 |
|
sl@0
|
479 |
|
sl@0
|
480 |
|
sl@0
|
481 |
TBMResult* Property::Run(TBMUInt64 aIter, TInt* aCount)
|
sl@0
|
482 |
{
|
sl@0
|
483 |
TInt count = sizeof(iResults)/sizeof(iResults[0]);
|
sl@0
|
484 |
|
sl@0
|
485 |
for (TInt i = 0; i < count; ++i)
|
sl@0
|
486 |
{
|
sl@0
|
487 |
iResults[i].Reset(iMeasurements[i].iName);
|
sl@0
|
488 |
iMeasurements[i].iFunc(&iResults[i], aIter, &iMeasurements[i]);
|
sl@0
|
489 |
iResults[i].Update();
|
sl@0
|
490 |
}
|
sl@0
|
491 |
|
sl@0
|
492 |
*aCount = count;
|
sl@0
|
493 |
return iResults;
|
sl@0
|
494 |
}
|
sl@0
|
495 |
|
sl@0
|
496 |
void AddProperty()
|
sl@0
|
497 |
{
|
sl@0
|
498 |
BMProgram* next = bmSuite;
|
sl@0
|
499 |
bmSuite=(BMProgram*)&property;
|
sl@0
|
500 |
bmSuite->Next()=next;
|
sl@0
|
501 |
}
|