sl@0
|
1 |
// Copyright (c) 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 |
// e32test/mmu/t_shbuf_perf.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
* @file
|
sl@0
|
20 |
*
|
sl@0
|
21 |
* Performance Testing of shared buffers.
|
sl@0
|
22 |
*
|
sl@0
|
23 |
* Runs a number of tests using descriptors and RShBuf handles and compares
|
sl@0
|
24 |
* the results to see the improvements in performance.
|
sl@0
|
25 |
*/
|
sl@0
|
26 |
|
sl@0
|
27 |
|
sl@0
|
28 |
#define __E32TEST_EXTENSION__
|
sl@0
|
29 |
|
sl@0
|
30 |
#include <e32def.h>
|
sl@0
|
31 |
#include <e32test.h>
|
sl@0
|
32 |
#include <e32debug.h>
|
sl@0
|
33 |
#include <e32msgqueue.h>
|
sl@0
|
34 |
#include <e32shbuf.h>
|
sl@0
|
35 |
#include <hal.h>
|
sl@0
|
36 |
#include <u32hal.h>
|
sl@0
|
37 |
#include <e32svr.h>
|
sl@0
|
38 |
|
sl@0
|
39 |
#include "d_shbuf.h"
|
sl@0
|
40 |
#include "t_shbuf_perfclient.h"
|
sl@0
|
41 |
|
sl@0
|
42 |
|
sl@0
|
43 |
//
|
sl@0
|
44 |
// Test name (and process name!)...
|
sl@0
|
45 |
//
|
sl@0
|
46 |
_LIT(KTestProcessName, "T_SHBUF_PERF");
|
sl@0
|
47 |
|
sl@0
|
48 |
|
sl@0
|
49 |
/**
|
sl@0
|
50 |
* Global test object (must be called 'test' to match some macros)...
|
sl@0
|
51 |
*/
|
sl@0
|
52 |
RTest test(KTestProcessName);
|
sl@0
|
53 |
|
sl@0
|
54 |
//
|
sl@0
|
55 |
// Number of iterations to run for each test. The timings are worked out by
|
sl@0
|
56 |
// running the test X number of times and dividing the total time by X.
|
sl@0
|
57 |
//
|
sl@0
|
58 |
#ifdef _DEBUG
|
sl@0
|
59 |
/**
|
sl@0
|
60 |
* Number of iterations to run for each test (WINS/WINSCW/Target Debug).
|
sl@0
|
61 |
*/
|
sl@0
|
62 |
const TInt KNumberOfIterations(50); // Used for debuging and hence not measurement.
|
sl@0
|
63 |
#else
|
sl@0
|
64 |
#ifdef __WINS__
|
sl@0
|
65 |
/**
|
sl@0
|
66 |
* Number of iterations to run for each test (WINS/WINSCW Release).
|
sl@0
|
67 |
*/
|
sl@0
|
68 |
const TInt KNumberOfIterations(5000); // Proper emulator performance testing.
|
sl@0
|
69 |
#else
|
sl@0
|
70 |
/**
|
sl@0
|
71 |
* Number of iterations to run for each test (Target Release).
|
sl@0
|
72 |
*/
|
sl@0
|
73 |
const TInt KNumberOfIterations(500); // Proper target performance testing.
|
sl@0
|
74 |
#endif
|
sl@0
|
75 |
#endif
|
sl@0
|
76 |
|
sl@0
|
77 |
|
sl@0
|
78 |
TUint8 iClearCache[32768];
|
sl@0
|
79 |
|
sl@0
|
80 |
|
sl@0
|
81 |
/**
|
sl@0
|
82 |
* RShBuf performance test types.
|
sl@0
|
83 |
*/
|
sl@0
|
84 |
enum TRShBufPerfTest
|
sl@0
|
85 |
{
|
sl@0
|
86 |
/**
|
sl@0
|
87 |
* Send buffer from the client to the driver directly and back.
|
sl@0
|
88 |
*/
|
sl@0
|
89 |
ERShBufPerfTestClientToDriverReturn,
|
sl@0
|
90 |
|
sl@0
|
91 |
/**
|
sl@0
|
92 |
* Send buffer from the client to the driver directly one way.
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
ERShBufPerfTestClientToDriverOneWay,
|
sl@0
|
95 |
|
sl@0
|
96 |
/**
|
sl@0
|
97 |
* Send buffer from the client to a second process to the driver and back.
|
sl@0
|
98 |
*/
|
sl@0
|
99 |
ERShBufPerfTestClientToProcessToDriverReturn,
|
sl@0
|
100 |
|
sl@0
|
101 |
/**
|
sl@0
|
102 |
* Send buffer from the client to a second process to the driver one way.
|
sl@0
|
103 |
*/
|
sl@0
|
104 |
ERShBufPerfTestClientToProcessToDriverOneWay,
|
sl@0
|
105 |
|
sl@0
|
106 |
/**
|
sl@0
|
107 |
* Read buffer from the driver directly and send it back.
|
sl@0
|
108 |
*/
|
sl@0
|
109 |
ERShBufPerfTestDriverToClientReturn,
|
sl@0
|
110 |
|
sl@0
|
111 |
/**
|
sl@0
|
112 |
* Read buffer from the driver directly one way.
|
sl@0
|
113 |
*/
|
sl@0
|
114 |
ERShBufPerfTestDriverToClientOneWay,
|
sl@0
|
115 |
|
sl@0
|
116 |
/**
|
sl@0
|
117 |
* Read buffer from the driver via a second process and send it back.
|
sl@0
|
118 |
*/
|
sl@0
|
119 |
ERShBufPerfTestDriverToProcessToClientReturn,
|
sl@0
|
120 |
|
sl@0
|
121 |
/**
|
sl@0
|
122 |
* Read buffer from the driver via a second process one way.
|
sl@0
|
123 |
*/
|
sl@0
|
124 |
ERShBufPerfTestDriverToProcessToClientOneWay
|
sl@0
|
125 |
};
|
sl@0
|
126 |
|
sl@0
|
127 |
|
sl@0
|
128 |
void StartSecondProcessAndDriver(TRShBufPerfTest aTestType,
|
sl@0
|
129 |
RShBufTestChannel& aLdd,
|
sl@0
|
130 |
RShBufTestServerSession& aTestServer,
|
sl@0
|
131 |
RThread& aTestServerThread,
|
sl@0
|
132 |
TInt aDriverNum)
|
sl@0
|
133 |
{
|
sl@0
|
134 |
//
|
sl@0
|
135 |
// If a second process is needed start this process as a child...
|
sl@0
|
136 |
//
|
sl@0
|
137 |
if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn ||
|
sl@0
|
138 |
aTestType == ERShBufPerfTestClientToProcessToDriverOneWay ||
|
sl@0
|
139 |
aTestType == ERShBufPerfTestDriverToProcessToClientReturn ||
|
sl@0
|
140 |
aTestType == ERShBufPerfTestDriverToProcessToClientOneWay)
|
sl@0
|
141 |
{
|
sl@0
|
142 |
test.Next(_L("Start slave server process..."));
|
sl@0
|
143 |
test_KErrNone(aTestServer.Connect());
|
sl@0
|
144 |
test.Next(_L("Find slave server thread..."));
|
sl@0
|
145 |
test_KErrNone(aTestServerThread.Open(_L("t_shbuf_perf.exe[00000000]0001::!RShBufServer")));
|
sl@0
|
146 |
}
|
sl@0
|
147 |
|
sl@0
|
148 |
//
|
sl@0
|
149 |
// Open the driver (always open it as it is used to get buffers too!)...
|
sl@0
|
150 |
//
|
sl@0
|
151 |
TInt r = User::LoadLogicalDevice(_L("D_SHBUF_CLIENT.LDD"));
|
sl@0
|
152 |
test(r == KErrNone || r == KErrAlreadyExists);
|
sl@0
|
153 |
r = User::LoadLogicalDevice(_L("D_SHBUF_OWN.LDD"));
|
sl@0
|
154 |
test(r == KErrNone || r == KErrAlreadyExists);
|
sl@0
|
155 |
test_KErrNone(aLdd.Open(aDriverNum));
|
sl@0
|
156 |
} // StartSecondProcessAndDriver
|
sl@0
|
157 |
|
sl@0
|
158 |
|
sl@0
|
159 |
void StopSecondProcessAndDriver(TRShBufPerfTest aTestType,
|
sl@0
|
160 |
RShBufTestChannel& aLdd,
|
sl@0
|
161 |
RShBufTestServerSession& aTestServer,
|
sl@0
|
162 |
RThread& aTestServerThread)
|
sl@0
|
163 |
{
|
sl@0
|
164 |
//
|
sl@0
|
165 |
// Close the driver..
|
sl@0
|
166 |
//
|
sl@0
|
167 |
aLdd.Close();
|
sl@0
|
168 |
|
sl@0
|
169 |
if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn ||
|
sl@0
|
170 |
aTestType == ERShBufPerfTestClientToProcessToDriverOneWay ||
|
sl@0
|
171 |
aTestType == ERShBufPerfTestDriverToProcessToClientReturn ||
|
sl@0
|
172 |
aTestType == ERShBufPerfTestDriverToProcessToClientOneWay)
|
sl@0
|
173 |
{
|
sl@0
|
174 |
#ifdef CAN_TRANSFER_SHBUF_TO_ANOTHER_PROCESS
|
sl@0
|
175 |
test.Next(_L("Stop slave server process..."));
|
sl@0
|
176 |
test_KErrNone(aTestServer.ShutdownServer());
|
sl@0
|
177 |
#endif
|
sl@0
|
178 |
aTestServerThread.Close();
|
sl@0
|
179 |
aTestServer.Close();
|
sl@0
|
180 |
}
|
sl@0
|
181 |
} // StopSecondProcessAndDriver
|
sl@0
|
182 |
|
sl@0
|
183 |
|
sl@0
|
184 |
/**
|
sl@0
|
185 |
* Print the TRShBufPerfTest enum.
|
sl@0
|
186 |
*/
|
sl@0
|
187 |
void PrinTRShBufPerfTestType(const TDesC& aPrefix, TRShBufPerfTest aTestType)
|
sl@0
|
188 |
{
|
sl@0
|
189 |
switch (aTestType)
|
sl@0
|
190 |
{
|
sl@0
|
191 |
case ERShBufPerfTestClientToDriverReturn:
|
sl@0
|
192 |
{
|
sl@0
|
193 |
test.Printf(_L("%SaTestType=ERShBufPerfTestClientToDriverReturn (%d)"), &aPrefix, aTestType);
|
sl@0
|
194 |
}
|
sl@0
|
195 |
break;
|
sl@0
|
196 |
|
sl@0
|
197 |
case ERShBufPerfTestClientToDriverOneWay:
|
sl@0
|
198 |
{
|
sl@0
|
199 |
test.Printf(_L("%SaTestType=ERShBufPerfTestClientToDriverOneWay (%d)"), &aPrefix, aTestType);
|
sl@0
|
200 |
}
|
sl@0
|
201 |
break;
|
sl@0
|
202 |
|
sl@0
|
203 |
case ERShBufPerfTestClientToProcessToDriverReturn:
|
sl@0
|
204 |
{
|
sl@0
|
205 |
test.Printf(_L("%SaTestType=ERShBufPerfTestClientToProcessToDriverReturn (%d)"), &aPrefix, aTestType);
|
sl@0
|
206 |
}
|
sl@0
|
207 |
break;
|
sl@0
|
208 |
|
sl@0
|
209 |
case ERShBufPerfTestClientToProcessToDriverOneWay:
|
sl@0
|
210 |
{
|
sl@0
|
211 |
test.Printf(_L("%SaTestType=ERShBufPerfTestClientToProcessToDriverOneWay (%d)"), &aPrefix, aTestType);
|
sl@0
|
212 |
}
|
sl@0
|
213 |
break;
|
sl@0
|
214 |
|
sl@0
|
215 |
case ERShBufPerfTestDriverToClientReturn:
|
sl@0
|
216 |
{
|
sl@0
|
217 |
test.Printf(_L("%SaTestType=ERShBufPerfTestDriverToClientReturn (%d)"), &aPrefix, aTestType);
|
sl@0
|
218 |
}
|
sl@0
|
219 |
break;
|
sl@0
|
220 |
|
sl@0
|
221 |
case ERShBufPerfTestDriverToClientOneWay:
|
sl@0
|
222 |
{
|
sl@0
|
223 |
test.Printf(_L("%SaTestType=ERShBufPerfTestDriverToClientOneWay (%d)"), &aPrefix, aTestType);
|
sl@0
|
224 |
}
|
sl@0
|
225 |
break;
|
sl@0
|
226 |
|
sl@0
|
227 |
case ERShBufPerfTestDriverToProcessToClientReturn:
|
sl@0
|
228 |
{
|
sl@0
|
229 |
test.Printf(_L("%SaTestType=ERShBufPerfTestDriverToProcessToClientReturn (%d)"), &aPrefix, aTestType);
|
sl@0
|
230 |
}
|
sl@0
|
231 |
break;
|
sl@0
|
232 |
|
sl@0
|
233 |
case ERShBufPerfTestDriverToProcessToClientOneWay:
|
sl@0
|
234 |
{
|
sl@0
|
235 |
test.Printf(_L("%SaTestType=ERShBufPerfTestDriverToProcessToClientOneWay (%d)"), &aPrefix, aTestType);
|
sl@0
|
236 |
}
|
sl@0
|
237 |
break;
|
sl@0
|
238 |
|
sl@0
|
239 |
default:
|
sl@0
|
240 |
{
|
sl@0
|
241 |
test.Printf(_L("%SaTestType=<unknown> (%d)"), &aPrefix, aTestType);
|
sl@0
|
242 |
}
|
sl@0
|
243 |
break;
|
sl@0
|
244 |
}
|
sl@0
|
245 |
} // PrinTRShBufPerfTestType
|
sl@0
|
246 |
|
sl@0
|
247 |
|
sl@0
|
248 |
/**
|
sl@0
|
249 |
* Print the TShPoolCreateInfo object.
|
sl@0
|
250 |
*/
|
sl@0
|
251 |
void PrintTShPoolInfo(const TDesC& aPrefix, TShPoolInfo aShPoolInfo)
|
sl@0
|
252 |
{
|
sl@0
|
253 |
test.Printf(_L("%SaShPoolInfo.iBufSize=%d"), &aPrefix, aShPoolInfo.iBufSize);
|
sl@0
|
254 |
test.Printf(_L("%SaShPoolInfo.iInitialBufs=%d"), &aPrefix, aShPoolInfo.iInitialBufs);
|
sl@0
|
255 |
test.Printf(_L("%SaShPoolInfo.iMaxBufs=%d"), &aPrefix, aShPoolInfo.iMaxBufs);
|
sl@0
|
256 |
test.Printf(_L("%SaShPoolInfo.iGrowTriggerRatio=%d"), &aPrefix, aShPoolInfo.iGrowTriggerRatio);
|
sl@0
|
257 |
test.Printf(_L("%SaShPoolInfo.iGrowByRatio=%d"), &aPrefix, aShPoolInfo.iGrowByRatio);
|
sl@0
|
258 |
test.Printf(_L("%SaShPoolInfo.iShrinkHysteresisRatio=%d"), &aPrefix, aShPoolInfo.iShrinkHysteresisRatio);
|
sl@0
|
259 |
test.Printf(_L("%SaShPoolInfo.iAlignment=%d (0x%x)"), &aPrefix, aShPoolInfo.iAlignment,
|
sl@0
|
260 |
2 << (aShPoolInfo.iAlignment - 1));
|
sl@0
|
261 |
test.Printf(_L("%SaShPoolInfo.iFlags=0x%08x"), &aPrefix, aShPoolInfo.iFlags);
|
sl@0
|
262 |
} // PrintTShPoolInfo
|
sl@0
|
263 |
|
sl@0
|
264 |
|
sl@0
|
265 |
void TestSharedBufferPerformanceL(TRShBufPerfTest aTestType,
|
sl@0
|
266 |
TInt aMinAllocSize, TInt aMaxAllocSize,
|
sl@0
|
267 |
TInt aBufferSizeSteps, TInt aTotalIterations,
|
sl@0
|
268 |
TShPoolCreateFlags aFlags, TInt aDriverNum,
|
sl@0
|
269 |
TDes& aSummaryBuf)
|
sl@0
|
270 |
{
|
sl@0
|
271 |
TShPoolInfo shPoolInfo;
|
sl@0
|
272 |
|
sl@0
|
273 |
shPoolInfo.iBufSize = aMaxAllocSize;
|
sl@0
|
274 |
shPoolInfo.iInitialBufs = 5;
|
sl@0
|
275 |
shPoolInfo.iMaxBufs = 5;
|
sl@0
|
276 |
shPoolInfo.iGrowTriggerRatio = 0;
|
sl@0
|
277 |
shPoolInfo.iGrowByRatio = 0;
|
sl@0
|
278 |
shPoolInfo.iShrinkHysteresisRatio = 0;
|
sl@0
|
279 |
shPoolInfo.iAlignment = 9;
|
sl@0
|
280 |
shPoolInfo.iFlags = aFlags;
|
sl@0
|
281 |
|
sl@0
|
282 |
//
|
sl@0
|
283 |
// Start test and print the parameters...
|
sl@0
|
284 |
//
|
sl@0
|
285 |
test.Printf(_L(" Test parameters:"));
|
sl@0
|
286 |
PrinTRShBufPerfTestType(_L(" "), aTestType);
|
sl@0
|
287 |
PrintTShPoolInfo(_L(" "), shPoolInfo);
|
sl@0
|
288 |
test.Printf(_L(" aMinAllocSize=%d"), aMinAllocSize);
|
sl@0
|
289 |
test.Printf(_L(" aMaxAllocSize=%d"), aMaxAllocSize);
|
sl@0
|
290 |
test.Printf(_L(" aBufferSizeSteps=%d"), aBufferSizeSteps);
|
sl@0
|
291 |
test.Printf(_L(" aTotalIterations=%d"), aTotalIterations);
|
sl@0
|
292 |
test.Printf(_L(" aDriverNum=%d"), aDriverNum);
|
sl@0
|
293 |
|
sl@0
|
294 |
//
|
sl@0
|
295 |
// Initialise second process and/or open the driver...
|
sl@0
|
296 |
//
|
sl@0
|
297 |
RShBufTestServerSession testServer;
|
sl@0
|
298 |
RShBufTestChannel shBufLdd;
|
sl@0
|
299 |
RThread testServerThread;
|
sl@0
|
300 |
|
sl@0
|
301 |
StartSecondProcessAndDriver(aTestType, shBufLdd, testServer, testServerThread, aDriverNum);
|
sl@0
|
302 |
CleanupClosePushL(testServer);
|
sl@0
|
303 |
|
sl@0
|
304 |
//
|
sl@0
|
305 |
// Allocate a RShPool...
|
sl@0
|
306 |
//
|
sl@0
|
307 |
RShPool shPool;
|
sl@0
|
308 |
|
sl@0
|
309 |
if (aFlags & EShPoolPageAlignedBuffer)
|
sl@0
|
310 |
{
|
sl@0
|
311 |
TShPoolCreateInfo shPoolCreateInfo(TShPoolCreateInfo::EPageAlignedBuffer,
|
sl@0
|
312 |
shPoolInfo.iBufSize, shPoolInfo.iInitialBufs);
|
sl@0
|
313 |
test_KErrNone(shPool.Create(shPoolCreateInfo, KDefaultPoolHandleFlags));
|
sl@0
|
314 |
CleanupClosePushL(shPool);
|
sl@0
|
315 |
|
sl@0
|
316 |
test_KErrNone(shPool.SetBufferWindow(-1, ETrue));
|
sl@0
|
317 |
shPoolInfo.iAlignment = 12;
|
sl@0
|
318 |
}
|
sl@0
|
319 |
else if (aFlags & EShPoolNonPageAlignedBuffer)
|
sl@0
|
320 |
{
|
sl@0
|
321 |
TShPoolCreateInfo shPoolCreateInfo(TShPoolCreateInfo::ENonPageAlignedBuffer,
|
sl@0
|
322 |
shPoolInfo.iBufSize, shPoolInfo.iInitialBufs,
|
sl@0
|
323 |
shPoolInfo.iAlignment);
|
sl@0
|
324 |
test_KErrNone(shPool.Create(shPoolCreateInfo, KDefaultPoolHandleFlags));
|
sl@0
|
325 |
CleanupClosePushL(shPool);
|
sl@0
|
326 |
}
|
sl@0
|
327 |
|
sl@0
|
328 |
test(shPool.Handle() != 0);
|
sl@0
|
329 |
|
sl@0
|
330 |
if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn ||
|
sl@0
|
331 |
aTestType == ERShBufPerfTestClientToProcessToDriverOneWay ||
|
sl@0
|
332 |
aTestType == ERShBufPerfTestDriverToProcessToClientReturn ||
|
sl@0
|
333 |
aTestType == ERShBufPerfTestDriverToProcessToClientOneWay)
|
sl@0
|
334 |
{
|
sl@0
|
335 |
test_KErrNone(testServer.OpenRShBufPool(shPool.Handle(), shPoolInfo));
|
sl@0
|
336 |
}
|
sl@0
|
337 |
else
|
sl@0
|
338 |
{
|
sl@0
|
339 |
test_KErrNone(shBufLdd.OpenUserPool(shPool.Handle(), shPoolInfo));
|
sl@0
|
340 |
}
|
sl@0
|
341 |
|
sl@0
|
342 |
//
|
sl@0
|
343 |
// Run the test iterations and time the result...
|
sl@0
|
344 |
//
|
sl@0
|
345 |
TInt fastTimerFreq;
|
sl@0
|
346 |
HAL::Get(HALData::EFastCounterFrequency, fastTimerFreq);
|
sl@0
|
347 |
TReal ticksPerMicroSec = 1.0E-6 * fastTimerFreq;
|
sl@0
|
348 |
|
sl@0
|
349 |
// Bind this thread to CPU 0. This is so that timer deltas don't drift from
|
sl@0
|
350 |
// scheduling - else, it causes spurious failures.
|
sl@0
|
351 |
if (UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0) > 1)
|
sl@0
|
352 |
(void)UserSvr::HalFunction(EHalGroupKernel, EKernelHalLockThreadToCpu, (TAny *)0, 0);
|
sl@0
|
353 |
|
sl@0
|
354 |
TReal64 totalLengthOfDesTest(0);
|
sl@0
|
355 |
TReal64 totalLengthOfShBufTest(0);
|
sl@0
|
356 |
TInt breakevenPoint = 0;
|
sl@0
|
357 |
TInt bufferStep;
|
sl@0
|
358 |
|
sl@0
|
359 |
test.Printf(_L("BufSize\tTotalTime(Des)\tAvTime(Des)\tTotalTime(ShBuf)\tAvTime(ShBuf)\tSpeedUp(%%)"));
|
sl@0
|
360 |
#ifndef __WINS__
|
sl@0
|
361 |
test.Printf(_L("\n"));
|
sl@0
|
362 |
#endif
|
sl@0
|
363 |
for (bufferStep = 0; bufferStep < aBufferSizeSteps; bufferStep++)
|
sl@0
|
364 |
{
|
sl@0
|
365 |
//
|
sl@0
|
366 |
// Run a single buffer size through these tests...
|
sl@0
|
367 |
//
|
sl@0
|
368 |
TInt bufferSize = aMinAllocSize +
|
sl@0
|
369 |
(((aMaxAllocSize - aMinAllocSize) * bufferStep) / (aBufferSizeSteps-1));
|
sl@0
|
370 |
TUint32 startDesTest = 0;
|
sl@0
|
371 |
TUint32 startShBufTest = 0;
|
sl@0
|
372 |
TInt iteration;
|
sl@0
|
373 |
|
sl@0
|
374 |
TUint32 lengthOfDesTest=0;
|
sl@0
|
375 |
|
sl@0
|
376 |
//
|
sl@0
|
377 |
// Test normal descriptor methods first...
|
sl@0
|
378 |
//
|
sl@0
|
379 |
|
sl@0
|
380 |
for (iteration = 0; iteration < aTotalIterations; iteration++)
|
sl@0
|
381 |
{
|
sl@0
|
382 |
//
|
sl@0
|
383 |
// Allocate a local buffer for this test...
|
sl@0
|
384 |
//
|
sl@0
|
385 |
HBufC8* singleBuf = HBufC8::NewLC(bufferSize);
|
sl@0
|
386 |
|
sl@0
|
387 |
startDesTest = User::FastCounter();
|
sl@0
|
388 |
test(singleBuf != NULL);
|
sl@0
|
389 |
|
sl@0
|
390 |
TPtr8 singleBufPtr = singleBuf->Des();
|
sl@0
|
391 |
singleBufPtr.SetLength(bufferSize);
|
sl@0
|
392 |
|
sl@0
|
393 |
//
|
sl@0
|
394 |
// Are we sending or receiving?
|
sl@0
|
395 |
//
|
sl@0
|
396 |
if (aTestType == ERShBufPerfTestClientToDriverOneWay ||
|
sl@0
|
397 |
aTestType == ERShBufPerfTestClientToProcessToDriverOneWay)
|
sl@0
|
398 |
{
|
sl@0
|
399 |
#ifdef _DEBUG // do not cache
|
sl@0
|
400 |
TUint8* bufptr = const_cast<TUint8*>(singleBuf->Ptr());
|
sl@0
|
401 |
|
sl@0
|
402 |
// We are sending...
|
sl@0
|
403 |
for (TInt pos = 0; pos < bufferSize; pos++)
|
sl@0
|
404 |
{
|
sl@0
|
405 |
bufptr[pos] = (TUint8)(pos%32);
|
sl@0
|
406 |
}
|
sl@0
|
407 |
// clear cache
|
sl@0
|
408 |
memset(iClearCache, 0xFF, sizeof(iClearCache));
|
sl@0
|
409 |
#endif
|
sl@0
|
410 |
}
|
sl@0
|
411 |
|
sl@0
|
412 |
|
sl@0
|
413 |
//
|
sl@0
|
414 |
// Either send to the driver or to the other process...
|
sl@0
|
415 |
//
|
sl@0
|
416 |
if (aTestType == ERShBufPerfTestClientToDriverReturn)
|
sl@0
|
417 |
{
|
sl@0
|
418 |
test_KErrNone(shBufLdd.FromTPtr8ProcessAndReturn(singleBufPtr, bufferSize));
|
sl@0
|
419 |
test(singleBufPtr.Length() == bufferSize-2);
|
sl@0
|
420 |
}
|
sl@0
|
421 |
else if (aTestType == ERShBufPerfTestClientToDriverOneWay)
|
sl@0
|
422 |
{
|
sl@0
|
423 |
test_KErrNone(shBufLdd.FromTPtr8ProcessAndRelease(singleBufPtr));
|
sl@0
|
424 |
}
|
sl@0
|
425 |
else if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn)
|
sl@0
|
426 |
{
|
sl@0
|
427 |
test_KErrNone(testServer.FromTPtr8ProcessAndReturn(singleBufPtr, bufferSize));
|
sl@0
|
428 |
test(singleBufPtr.Length() == bufferSize-2);
|
sl@0
|
429 |
}
|
sl@0
|
430 |
else if (aTestType == ERShBufPerfTestClientToProcessToDriverOneWay)
|
sl@0
|
431 |
{
|
sl@0
|
432 |
test_KErrNone(testServer.FromTPtr8ProcessAndRelease(singleBufPtr));
|
sl@0
|
433 |
}
|
sl@0
|
434 |
|
sl@0
|
435 |
lengthOfDesTest += (User::FastCounter() - startDesTest);
|
sl@0
|
436 |
|
sl@0
|
437 |
CleanupStack::PopAndDestroy(singleBuf);
|
sl@0
|
438 |
}
|
sl@0
|
439 |
|
sl@0
|
440 |
TInt64 lengthOfShBufTest = 0;
|
sl@0
|
441 |
|
sl@0
|
442 |
//
|
sl@0
|
443 |
// Test ShBuf methods...
|
sl@0
|
444 |
//
|
sl@0
|
445 |
for (iteration = 0; iteration < aTotalIterations; iteration++)
|
sl@0
|
446 |
{
|
sl@0
|
447 |
RShBuf shBuf;
|
sl@0
|
448 |
TInt* lengthPtr;
|
sl@0
|
449 |
//
|
sl@0
|
450 |
// Are we sending or receiving?
|
sl@0
|
451 |
//
|
sl@0
|
452 |
startShBufTest = User::FastCounter();
|
sl@0
|
453 |
if (aTestType == ERShBufPerfTestClientToDriverOneWay ||
|
sl@0
|
454 |
aTestType == ERShBufPerfTestClientToProcessToDriverOneWay)
|
sl@0
|
455 |
{
|
sl@0
|
456 |
// We are sending...
|
sl@0
|
457 |
|
sl@0
|
458 |
//
|
sl@0
|
459 |
// Allocate a buffer (using a pool)...
|
sl@0
|
460 |
//
|
sl@0
|
461 |
|
sl@0
|
462 |
test_KErrNone(shBuf.Alloc(shPool));
|
sl@0
|
463 |
TUint8* shBufPtr = shBuf.Ptr();
|
sl@0
|
464 |
|
sl@0
|
465 |
lengthPtr = (TInt*)(&shBufPtr[0]); // First 32bit word is length!
|
sl@0
|
466 |
*lengthPtr = bufferSize;
|
sl@0
|
467 |
#ifdef _DEBUG // do not cache
|
sl@0
|
468 |
for (TInt pos = 4; pos < bufferSize; pos++)
|
sl@0
|
469 |
{
|
sl@0
|
470 |
shBufPtr[pos] = (TUint8)(pos%32);
|
sl@0
|
471 |
}
|
sl@0
|
472 |
// clear cache
|
sl@0
|
473 |
memset(iClearCache, 0xFF, sizeof(iClearCache));
|
sl@0
|
474 |
#endif
|
sl@0
|
475 |
}
|
sl@0
|
476 |
|
sl@0
|
477 |
|
sl@0
|
478 |
//
|
sl@0
|
479 |
// Either send to the driver or to the other process...
|
sl@0
|
480 |
//
|
sl@0
|
481 |
if (aTestType == ERShBufPerfTestClientToDriverReturn)
|
sl@0
|
482 |
{
|
sl@0
|
483 |
TInt retHandle;
|
sl@0
|
484 |
retHandle = shBufLdd.FromRShBufProcessAndReturn(bufferSize);
|
sl@0
|
485 |
test_Compare(retHandle, >, 0);
|
sl@0
|
486 |
shBuf.SetReturnedHandle(retHandle);
|
sl@0
|
487 |
|
sl@0
|
488 |
TInt* retPtr = (TInt*)shBuf.Ptr();
|
sl@0
|
489 |
|
sl@0
|
490 |
test(*retPtr == bufferSize-2);
|
sl@0
|
491 |
|
sl@0
|
492 |
shBuf.Close();
|
sl@0
|
493 |
}
|
sl@0
|
494 |
else if (aTestType == ERShBufPerfTestClientToDriverOneWay)
|
sl@0
|
495 |
{
|
sl@0
|
496 |
test_KErrNone(shBufLdd.FromRShBufProcessAndRelease(shBuf.Handle()));
|
sl@0
|
497 |
}
|
sl@0
|
498 |
else if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn)
|
sl@0
|
499 |
{
|
sl@0
|
500 |
test_KErrNone(testServer.FromRShBufProcessAndReturn(shBuf, bufferSize));
|
sl@0
|
501 |
TInt* retPtr = (TInt*)shBuf.Ptr();
|
sl@0
|
502 |
|
sl@0
|
503 |
test(*retPtr == bufferSize-2);
|
sl@0
|
504 |
|
sl@0
|
505 |
shBuf.Close();
|
sl@0
|
506 |
}
|
sl@0
|
507 |
else if (aTestType == ERShBufPerfTestClientToProcessToDriverOneWay)
|
sl@0
|
508 |
{
|
sl@0
|
509 |
test_KErrNone(testServer.FromRShBufProcessAndRelease(shBuf));
|
sl@0
|
510 |
}
|
sl@0
|
511 |
lengthOfShBufTest += (User::FastCounter() - startShBufTest);
|
sl@0
|
512 |
}
|
sl@0
|
513 |
|
sl@0
|
514 |
//
|
sl@0
|
515 |
// Print results of this buffer size...
|
sl@0
|
516 |
//
|
sl@0
|
517 |
|
sl@0
|
518 |
test.Printf(_L("%d\t%10.2lfusec\t%10.2lfusec\t%.2f%%"), bufferSize,
|
sl@0
|
519 |
I64REAL(lengthOfDesTest) / (TReal(aTotalIterations) * ticksPerMicroSec),
|
sl@0
|
520 |
I64REAL(lengthOfShBufTest) / (TReal(aTotalIterations) * ticksPerMicroSec),
|
sl@0
|
521 |
((100.0 / I64REAL(lengthOfShBufTest)) * I64REAL(lengthOfDesTest)) - 100.0);
|
sl@0
|
522 |
#ifndef __WINS__
|
sl@0
|
523 |
test.Printf(_L("\n"));
|
sl@0
|
524 |
#endif
|
sl@0
|
525 |
|
sl@0
|
526 |
totalLengthOfDesTest += lengthOfDesTest;
|
sl@0
|
527 |
totalLengthOfShBufTest += lengthOfShBufTest;
|
sl@0
|
528 |
|
sl@0
|
529 |
//
|
sl@0
|
530 |
// Track the breakeven point (e.g. the buffer size at which RShBuf is
|
sl@0
|
531 |
// quicker). This is normally when the number of bytes copied by the
|
sl@0
|
532 |
// descriptor takes longer than the handling of the RShBuf.
|
sl@0
|
533 |
//
|
sl@0
|
534 |
if (lengthOfShBufTest >= lengthOfDesTest)
|
sl@0
|
535 |
{
|
sl@0
|
536 |
breakevenPoint = aMinAllocSize +
|
sl@0
|
537 |
(((aMaxAllocSize - aMinAllocSize) * (bufferStep + 1)) / (aBufferSizeSteps-1));
|
sl@0
|
538 |
}
|
sl@0
|
539 |
}
|
sl@0
|
540 |
|
sl@0
|
541 |
//
|
sl@0
|
542 |
// Display timing information...
|
sl@0
|
543 |
//
|
sl@0
|
544 |
test.Printf(_L("Average\t%10.2lfusec\t%10.2lfusec\t%.2f%%"),
|
sl@0
|
545 |
I64REAL(totalLengthOfDesTest) / (TReal(aTotalIterations * aBufferSizeSteps) * ticksPerMicroSec),
|
sl@0
|
546 |
I64REAL(totalLengthOfShBufTest) / (TReal(aTotalIterations * aBufferSizeSteps) * ticksPerMicroSec),
|
sl@0
|
547 |
((100.0 / I64REAL(totalLengthOfShBufTest)) * I64REAL(totalLengthOfDesTest)) - 100.0);
|
sl@0
|
548 |
#ifndef __WINS__
|
sl@0
|
549 |
test.Printf(_L("\n"));
|
sl@0
|
550 |
#endif
|
sl@0
|
551 |
|
sl@0
|
552 |
//
|
sl@0
|
553 |
// Record summary info for later use...
|
sl@0
|
554 |
//
|
sl@0
|
555 |
aSummaryBuf.Zero();
|
sl@0
|
556 |
|
sl@0
|
557 |
if (breakevenPoint <= aMaxAllocSize)
|
sl@0
|
558 |
{
|
sl@0
|
559 |
aSummaryBuf.AppendFormat(_L("%10.2lfusec\t%10.2lfusec\t%.2f%%%%\t%d"),
|
sl@0
|
560 |
I64REAL(totalLengthOfDesTest) / TReal(aTotalIterations * aBufferSizeSteps * ticksPerMicroSec),
|
sl@0
|
561 |
I64REAL(totalLengthOfShBufTest) / TReal(aTotalIterations * aBufferSizeSteps * ticksPerMicroSec),
|
sl@0
|
562 |
((100.0 / I64REAL(totalLengthOfShBufTest)) * I64REAL(totalLengthOfDesTest)) - 100.0,
|
sl@0
|
563 |
breakevenPoint);
|
sl@0
|
564 |
}
|
sl@0
|
565 |
else
|
sl@0
|
566 |
{
|
sl@0
|
567 |
aSummaryBuf.AppendFormat(_L("%10.2lfusec\t%10.2lfusec\t%.2f%%%%\tFailed to breakeven"),
|
sl@0
|
568 |
I64REAL(totalLengthOfDesTest) / TReal(aTotalIterations * aBufferSizeSteps * ticksPerMicroSec),
|
sl@0
|
569 |
I64REAL(totalLengthOfShBufTest) / TReal(aTotalIterations * aBufferSizeSteps * ticksPerMicroSec),
|
sl@0
|
570 |
((100.0 / I64REAL(totalLengthOfShBufTest)) * I64REAL(totalLengthOfDesTest)) - 100.0);
|
sl@0
|
571 |
}
|
sl@0
|
572 |
|
sl@0
|
573 |
//
|
sl@0
|
574 |
// Clean up...
|
sl@0
|
575 |
//
|
sl@0
|
576 |
TInt shPoolHandle = shPool.Handle();
|
sl@0
|
577 |
CleanupStack::PopAndDestroy(&shPool);
|
sl@0
|
578 |
|
sl@0
|
579 |
if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn ||
|
sl@0
|
580 |
aTestType == ERShBufPerfTestClientToProcessToDriverOneWay ||
|
sl@0
|
581 |
aTestType == ERShBufPerfTestDriverToProcessToClientReturn ||
|
sl@0
|
582 |
aTestType == ERShBufPerfTestDriverToProcessToClientOneWay)
|
sl@0
|
583 |
{
|
sl@0
|
584 |
testServer.CloseRShBufPool(shPoolHandle);
|
sl@0
|
585 |
}
|
sl@0
|
586 |
else
|
sl@0
|
587 |
{
|
sl@0
|
588 |
test_KErrNone(shBufLdd.CloseUserPool());
|
sl@0
|
589 |
}
|
sl@0
|
590 |
|
sl@0
|
591 |
//
|
sl@0
|
592 |
// Shutdown the second process and/or close the driver.
|
sl@0
|
593 |
//
|
sl@0
|
594 |
CleanupStack::Pop(&testServer);
|
sl@0
|
595 |
StopSecondProcessAndDriver(aTestType, shBufLdd, testServer, testServerThread);
|
sl@0
|
596 |
} // TestSharedBufferPerformanceL
|
sl@0
|
597 |
|
sl@0
|
598 |
|
sl@0
|
599 |
/**
|
sl@0
|
600 |
* Main test process which performs the testing.
|
sl@0
|
601 |
*/
|
sl@0
|
602 |
void RunTestsL()
|
sl@0
|
603 |
{
|
sl@0
|
604 |
//
|
sl@0
|
605 |
// Setup the test...
|
sl@0
|
606 |
//
|
sl@0
|
607 |
test.Title();
|
sl@0
|
608 |
|
sl@0
|
609 |
test.Start(_L("Check for Shared Buffers availability"));
|
sl@0
|
610 |
TInt r;
|
sl@0
|
611 |
RShPool pool;
|
sl@0
|
612 |
TShPoolCreateInfo inf(TShPoolCreateInfo::EPageAlignedBuffer, 100, 10);
|
sl@0
|
613 |
r = pool.Create(inf, KDefaultPoolHandleFlags);
|
sl@0
|
614 |
if (r == KErrNotSupported)
|
sl@0
|
615 |
{
|
sl@0
|
616 |
test.Printf(_L("Not supported by this memory model.\n"));
|
sl@0
|
617 |
}
|
sl@0
|
618 |
else
|
sl@0
|
619 |
{
|
sl@0
|
620 |
test_KErrNone(r);
|
sl@0
|
621 |
pool.Close();
|
sl@0
|
622 |
|
sl@0
|
623 |
test.Next(_L("Performance test shared buffers"));
|
sl@0
|
624 |
|
sl@0
|
625 |
//
|
sl@0
|
626 |
// Create a summary buffer to hold the average speeds of different pools...
|
sl@0
|
627 |
//
|
sl@0
|
628 |
HBufC* summaryBuf = HBufC::NewLC(16 * 128 * 2);
|
sl@0
|
629 |
TPtr summaryBufPtr = summaryBuf->Des();
|
sl@0
|
630 |
TBuf<128> testName, testSummary;
|
sl@0
|
631 |
|
sl@0
|
632 |
summaryBufPtr.Append(_L("Test Type\tAverage Time(Des)\tAverage Time(ShBuf)\tAverage SpeedUp(%%)\tBreakeven Buffer Size\n"));
|
sl@0
|
633 |
|
sl@0
|
634 |
//
|
sl@0
|
635 |
// Run tests...
|
sl@0
|
636 |
//
|
sl@0
|
637 |
testName.Copy(_L("Client->Driver (non-aligned/client-thread)"));
|
sl@0
|
638 |
test.Next(testName);
|
sl@0
|
639 |
TestSharedBufferPerformanceL(
|
sl@0
|
640 |
/* Test type */ ERShBufPerfTestClientToDriverOneWay,
|
sl@0
|
641 |
/* Min Alloc size */ 64,
|
sl@0
|
642 |
/* Max Alloc size */ 8192,
|
sl@0
|
643 |
/* Buffer size steps */ 128,
|
sl@0
|
644 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
645 |
/* Buffer flags */ EShPoolNonPageAlignedBuffer,
|
sl@0
|
646 |
/* Driver to use */ RShBufTestChannel::EClientThread,
|
sl@0
|
647 |
/* Summary string */ testSummary);
|
sl@0
|
648 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
649 |
|
sl@0
|
650 |
testName.Copy(_L("Client->Driver (aligned/client-thread)"));
|
sl@0
|
651 |
test.Next(testName);
|
sl@0
|
652 |
TestSharedBufferPerformanceL(
|
sl@0
|
653 |
/* Test type */ ERShBufPerfTestClientToDriverOneWay,
|
sl@0
|
654 |
/* Min Alloc size */ 64,
|
sl@0
|
655 |
/* Max Alloc size */ 8192,
|
sl@0
|
656 |
/* Buffer size steps */ 128,
|
sl@0
|
657 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
658 |
/* Buffer flags */ EShPoolPageAlignedBuffer,
|
sl@0
|
659 |
/* Driver to use */ RShBufTestChannel::EClientThread,
|
sl@0
|
660 |
/* Summary string */ testSummary);
|
sl@0
|
661 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
662 |
|
sl@0
|
663 |
testName.Copy(_L("Client->Driver (non-aligned/own-thread)"));
|
sl@0
|
664 |
test.Next(testName);
|
sl@0
|
665 |
TestSharedBufferPerformanceL(
|
sl@0
|
666 |
/* Test type */ ERShBufPerfTestClientToDriverOneWay,
|
sl@0
|
667 |
/* Min Alloc size */ 64,
|
sl@0
|
668 |
/* Max Alloc size */ 8192,
|
sl@0
|
669 |
/* Buffer size steps */ 128,
|
sl@0
|
670 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
671 |
/* Buffer flags */ EShPoolNonPageAlignedBuffer,
|
sl@0
|
672 |
/* Driver to use */ RShBufTestChannel::EOwnThread,
|
sl@0
|
673 |
/* Summary string */ testSummary);
|
sl@0
|
674 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
675 |
|
sl@0
|
676 |
testName.Copy(_L("Client->Driver (aligned/own-thread)"));
|
sl@0
|
677 |
test.Next(testName);
|
sl@0
|
678 |
TestSharedBufferPerformanceL(
|
sl@0
|
679 |
/* Test type */ ERShBufPerfTestClientToDriverOneWay,
|
sl@0
|
680 |
/* Min Alloc size */ 64,
|
sl@0
|
681 |
/* Max Alloc size */ 8192,
|
sl@0
|
682 |
/* Buffer size steps */ 128,
|
sl@0
|
683 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
684 |
/* Buffer flags */ EShPoolPageAlignedBuffer,
|
sl@0
|
685 |
/* Driver to use */ RShBufTestChannel::EOwnThread,
|
sl@0
|
686 |
/* Summary string */ testSummary);
|
sl@0
|
687 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
688 |
|
sl@0
|
689 |
testName.Copy(_L("Client->Driver->Client (non-aligned/client-thread)"));
|
sl@0
|
690 |
test.Next(testName);
|
sl@0
|
691 |
TestSharedBufferPerformanceL(
|
sl@0
|
692 |
/* Test type */ ERShBufPerfTestClientToDriverReturn,
|
sl@0
|
693 |
/* Min Alloc size */ 64,
|
sl@0
|
694 |
/* Max Alloc size */ 8192,
|
sl@0
|
695 |
/* Buffer size steps */ 128,
|
sl@0
|
696 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
697 |
/* Buffer flags */ EShPoolNonPageAlignedBuffer,
|
sl@0
|
698 |
/* Driver to use */ RShBufTestChannel::EClientThread,
|
sl@0
|
699 |
/* Summary string */ testSummary);
|
sl@0
|
700 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
701 |
|
sl@0
|
702 |
testName.Copy(_L("Client->Driver->Client (aligned/client-thread)"));
|
sl@0
|
703 |
test.Next(testName);
|
sl@0
|
704 |
TestSharedBufferPerformanceL(
|
sl@0
|
705 |
/* Test type */ ERShBufPerfTestClientToDriverReturn,
|
sl@0
|
706 |
/* Min Alloc size */ 64,
|
sl@0
|
707 |
/* Max Alloc size */ 8192,
|
sl@0
|
708 |
/* Buffer size steps */ 128,
|
sl@0
|
709 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
710 |
/* Buffer flags */ EShPoolPageAlignedBuffer,
|
sl@0
|
711 |
/* Driver to use */ RShBufTestChannel::EClientThread,
|
sl@0
|
712 |
/* Summary string */ testSummary);
|
sl@0
|
713 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
714 |
|
sl@0
|
715 |
testName.Copy(_L("Client->Driver->Client (non-aligned/own-thread)"));
|
sl@0
|
716 |
test.Next(testName);
|
sl@0
|
717 |
TestSharedBufferPerformanceL(
|
sl@0
|
718 |
/* Test type */ ERShBufPerfTestClientToDriverReturn,
|
sl@0
|
719 |
/* Min Alloc size */ 64,
|
sl@0
|
720 |
/* Max Alloc size */ 8192,
|
sl@0
|
721 |
/* Buffer size steps */ 128,
|
sl@0
|
722 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
723 |
/* Buffer flags */ EShPoolNonPageAlignedBuffer,
|
sl@0
|
724 |
/* Driver to use */ RShBufTestChannel::EOwnThread,
|
sl@0
|
725 |
/* Summary string */ testSummary);
|
sl@0
|
726 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
727 |
|
sl@0
|
728 |
testName.Copy(_L("Client->Driver->Client (aligned/own-thread)"));
|
sl@0
|
729 |
test.Next(testName);
|
sl@0
|
730 |
TestSharedBufferPerformanceL(
|
sl@0
|
731 |
/* Test type */ ERShBufPerfTestClientToDriverReturn,
|
sl@0
|
732 |
/* Min Alloc size */ 64,
|
sl@0
|
733 |
/* Max Alloc size */ 8192,
|
sl@0
|
734 |
/* Buffer size steps */ 128,
|
sl@0
|
735 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
736 |
/* Buffer flags */ EShPoolPageAlignedBuffer,
|
sl@0
|
737 |
/* Driver to use */ RShBufTestChannel::EOwnThread,
|
sl@0
|
738 |
/* Summary string */ testSummary);
|
sl@0
|
739 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
740 |
|
sl@0
|
741 |
testName.Copy(_L("Client->Process->Driver (non-aligned/client-thread)"));
|
sl@0
|
742 |
test.Next(testName);
|
sl@0
|
743 |
TestSharedBufferPerformanceL(
|
sl@0
|
744 |
/* Test type */ ERShBufPerfTestClientToProcessToDriverOneWay,
|
sl@0
|
745 |
/* Min Alloc size */ 64,
|
sl@0
|
746 |
/* Max Alloc size */ 8192,
|
sl@0
|
747 |
/* Buffer size steps */ 128,
|
sl@0
|
748 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
749 |
/* Buffer flags */ EShPoolNonPageAlignedBuffer,
|
sl@0
|
750 |
/* Driver to use */ RShBufTestChannel::EClientThread,
|
sl@0
|
751 |
/* Summary string */ testSummary);
|
sl@0
|
752 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
753 |
|
sl@0
|
754 |
testName.Copy(_L("Client->Process->Driver (aligned/client-thread)"));
|
sl@0
|
755 |
test.Next(testName);
|
sl@0
|
756 |
TestSharedBufferPerformanceL(
|
sl@0
|
757 |
/* Test type */ ERShBufPerfTestClientToProcessToDriverOneWay,
|
sl@0
|
758 |
/* Min Alloc size */ 64,
|
sl@0
|
759 |
/* Max Alloc size */ 8192,
|
sl@0
|
760 |
/* Buffer size steps */ 128,
|
sl@0
|
761 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
762 |
/* Buffer flags */ EShPoolPageAlignedBuffer,
|
sl@0
|
763 |
/* Driver to use */ RShBufTestChannel::EClientThread,
|
sl@0
|
764 |
/* Summary string */ testSummary);
|
sl@0
|
765 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
766 |
|
sl@0
|
767 |
testName.Copy(_L("Client->Process->Driver (non-aligned/own-thread)"));
|
sl@0
|
768 |
test.Next(testName);
|
sl@0
|
769 |
TestSharedBufferPerformanceL(
|
sl@0
|
770 |
/* Test type */ ERShBufPerfTestClientToProcessToDriverOneWay,
|
sl@0
|
771 |
/* Min Alloc size */ 64,
|
sl@0
|
772 |
/* Max Alloc size */ 8192,
|
sl@0
|
773 |
/* Buffer size steps */ 128,
|
sl@0
|
774 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
775 |
/* Buffer flags */ EShPoolNonPageAlignedBuffer,
|
sl@0
|
776 |
/* Driver to use */ RShBufTestChannel::EOwnThread,
|
sl@0
|
777 |
/* Summary string */ testSummary);
|
sl@0
|
778 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
779 |
|
sl@0
|
780 |
testName.Copy(_L("Client->Process->Driver (aligned/own-thread)"));
|
sl@0
|
781 |
test.Next(testName);
|
sl@0
|
782 |
TestSharedBufferPerformanceL(
|
sl@0
|
783 |
/* Test type */ ERShBufPerfTestClientToProcessToDriverOneWay,
|
sl@0
|
784 |
/* Min Alloc size */ 64,
|
sl@0
|
785 |
/* Max Alloc size */ 8192,
|
sl@0
|
786 |
/* Buffer size steps */ 128,
|
sl@0
|
787 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
788 |
/* Buffer flags */ EShPoolPageAlignedBuffer,
|
sl@0
|
789 |
/* Driver to use */ RShBufTestChannel::EOwnThread,
|
sl@0
|
790 |
/* Summary string */ testSummary);
|
sl@0
|
791 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
792 |
|
sl@0
|
793 |
testName.Copy(_L("Client->Process->Driver->Process->Client (non-aligned/client-thread)"));
|
sl@0
|
794 |
test.Next(testName);
|
sl@0
|
795 |
TestSharedBufferPerformanceL(
|
sl@0
|
796 |
/* Test type */ ERShBufPerfTestClientToProcessToDriverReturn,
|
sl@0
|
797 |
/* Min Alloc size */ 64,
|
sl@0
|
798 |
/* Max Alloc size */ 8192,
|
sl@0
|
799 |
/* Buffer size steps */ 128,
|
sl@0
|
800 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
801 |
/* Buffer flags */ EShPoolNonPageAlignedBuffer,
|
sl@0
|
802 |
/* Driver to use */ RShBufTestChannel::EClientThread,
|
sl@0
|
803 |
/* Summary string */ testSummary);
|
sl@0
|
804 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
805 |
|
sl@0
|
806 |
testName.Copy(_L("Client->Process->Driver->Process->Client (aligned/client-thread)"));
|
sl@0
|
807 |
test.Next(testName);
|
sl@0
|
808 |
TestSharedBufferPerformanceL(
|
sl@0
|
809 |
/* Test type */ ERShBufPerfTestClientToProcessToDriverReturn,
|
sl@0
|
810 |
/* Min Alloc size */ 64,
|
sl@0
|
811 |
/* Max Alloc size */ 8192,
|
sl@0
|
812 |
/* Buffer size steps */ 128,
|
sl@0
|
813 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
814 |
/* Buffer flags */ EShPoolPageAlignedBuffer,
|
sl@0
|
815 |
/* Driver to use */ RShBufTestChannel::EClientThread,
|
sl@0
|
816 |
/* Summary string */ testSummary);
|
sl@0
|
817 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
818 |
|
sl@0
|
819 |
testName.Copy(_L("Client->Process->Driver->Process->Client (non-aligned/own-thread)"));
|
sl@0
|
820 |
test.Next(testName);
|
sl@0
|
821 |
TestSharedBufferPerformanceL(
|
sl@0
|
822 |
/* Test type */ ERShBufPerfTestClientToProcessToDriverReturn,
|
sl@0
|
823 |
/* Min Alloc size */ 64,
|
sl@0
|
824 |
/* Max Alloc size */ 8192,
|
sl@0
|
825 |
/* Buffer size steps */ 128,
|
sl@0
|
826 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
827 |
/* Buffer flags */ EShPoolNonPageAlignedBuffer,
|
sl@0
|
828 |
/* Driver to use */ RShBufTestChannel::EOwnThread,
|
sl@0
|
829 |
/* Summary string */ testSummary);
|
sl@0
|
830 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
831 |
|
sl@0
|
832 |
testName.Copy(_L("Client->Process->Driver->Process->Client (aligned/own-thread)"));
|
sl@0
|
833 |
test.Next(testName);
|
sl@0
|
834 |
TestSharedBufferPerformanceL(
|
sl@0
|
835 |
/* Test type */ ERShBufPerfTestClientToProcessToDriverReturn,
|
sl@0
|
836 |
/* Min Alloc size */ 64,
|
sl@0
|
837 |
/* Max Alloc size */ 8192,
|
sl@0
|
838 |
/* Buffer size steps */ 128,
|
sl@0
|
839 |
/* Total iterations */ KNumberOfIterations,
|
sl@0
|
840 |
/* Buffer flags */ EShPoolPageAlignedBuffer,
|
sl@0
|
841 |
/* Driver to use */ RShBufTestChannel::EOwnThread,
|
sl@0
|
842 |
/* Summary string */ testSummary);
|
sl@0
|
843 |
summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
|
sl@0
|
844 |
|
sl@0
|
845 |
//
|
sl@0
|
846 |
// Print the summary...
|
sl@0
|
847 |
//
|
sl@0
|
848 |
TInt nextLineBreak = summaryBufPtr.Find(_L("\n"));
|
sl@0
|
849 |
|
sl@0
|
850 |
test.Next(_L("Results summary (average values for each test)"));
|
sl@0
|
851 |
|
sl@0
|
852 |
while (nextLineBreak != KErrNotFound)
|
sl@0
|
853 |
{
|
sl@0
|
854 |
test.Printf(summaryBufPtr.Left(nextLineBreak));
|
sl@0
|
855 |
#ifndef __WINS__
|
sl@0
|
856 |
test.Printf(_L("\n"));
|
sl@0
|
857 |
#endif
|
sl@0
|
858 |
|
sl@0
|
859 |
summaryBufPtr = summaryBufPtr.Mid(nextLineBreak+1);
|
sl@0
|
860 |
nextLineBreak = summaryBufPtr.Find(_L("\n"));
|
sl@0
|
861 |
}
|
sl@0
|
862 |
CleanupStack::PopAndDestroy(summaryBuf);
|
sl@0
|
863 |
}
|
sl@0
|
864 |
test.End();
|
sl@0
|
865 |
test.Close();
|
sl@0
|
866 |
} // RunTestsL
|
sl@0
|
867 |
|
sl@0
|
868 |
|
sl@0
|
869 |
/**
|
sl@0
|
870 |
* Main entry point.
|
sl@0
|
871 |
*/
|
sl@0
|
872 |
TInt E32Main()
|
sl@0
|
873 |
{
|
sl@0
|
874 |
//
|
sl@0
|
875 |
// Allocate a clean up stack and top level TRAP...
|
sl@0
|
876 |
//
|
sl@0
|
877 |
__UHEAP_MARK;
|
sl@0
|
878 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
sl@0
|
879 |
TInt err = KErrNoMemory;
|
sl@0
|
880 |
|
sl@0
|
881 |
if (cleanup)
|
sl@0
|
882 |
{
|
sl@0
|
883 |
TRAP(err, RunTestsL());
|
sl@0
|
884 |
delete cleanup;
|
sl@0
|
885 |
}
|
sl@0
|
886 |
|
sl@0
|
887 |
__UHEAP_MARKEND;
|
sl@0
|
888 |
return err;
|
sl@0
|
889 |
} // E32Main
|
sl@0
|
890 |
|