First public contribution.
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test/mmu/t_shbuf_perf.cpp
21 * Performance Testing of shared buffers.
23 * Runs a number of tests using descriptors and RShBuf handles and compares
24 * the results to see the improvements in performance.
28 #define __E32TEST_EXTENSION__
33 #include <e32msgqueue.h>
40 #include "t_shbuf_perfclient.h"
44 // Test name (and process name!)...
46 _LIT(KTestProcessName, "T_SHBUF_PERF");
50 * Global test object (must be called 'test' to match some macros)...
52 RTest test(KTestProcessName);
55 // Number of iterations to run for each test. The timings are worked out by
56 // running the test X number of times and dividing the total time by X.
60 * Number of iterations to run for each test (WINS/WINSCW/Target Debug).
62 const TInt KNumberOfIterations(50); // Used for debuging and hence not measurement.
66 * Number of iterations to run for each test (WINS/WINSCW Release).
68 const TInt KNumberOfIterations(5000); // Proper emulator performance testing.
71 * Number of iterations to run for each test (Target Release).
73 const TInt KNumberOfIterations(500); // Proper target performance testing.
78 TUint8 iClearCache[32768];
82 * RShBuf performance test types.
87 * Send buffer from the client to the driver directly and back.
89 ERShBufPerfTestClientToDriverReturn,
92 * Send buffer from the client to the driver directly one way.
94 ERShBufPerfTestClientToDriverOneWay,
97 * Send buffer from the client to a second process to the driver and back.
99 ERShBufPerfTestClientToProcessToDriverReturn,
102 * Send buffer from the client to a second process to the driver one way.
104 ERShBufPerfTestClientToProcessToDriverOneWay,
107 * Read buffer from the driver directly and send it back.
109 ERShBufPerfTestDriverToClientReturn,
112 * Read buffer from the driver directly one way.
114 ERShBufPerfTestDriverToClientOneWay,
117 * Read buffer from the driver via a second process and send it back.
119 ERShBufPerfTestDriverToProcessToClientReturn,
122 * Read buffer from the driver via a second process one way.
124 ERShBufPerfTestDriverToProcessToClientOneWay
128 void StartSecondProcessAndDriver(TRShBufPerfTest aTestType,
129 RShBufTestChannel& aLdd,
130 RShBufTestServerSession& aTestServer,
131 RThread& aTestServerThread,
135 // If a second process is needed start this process as a child...
137 if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn ||
138 aTestType == ERShBufPerfTestClientToProcessToDriverOneWay ||
139 aTestType == ERShBufPerfTestDriverToProcessToClientReturn ||
140 aTestType == ERShBufPerfTestDriverToProcessToClientOneWay)
142 test.Next(_L("Start slave server process..."));
143 test_KErrNone(aTestServer.Connect());
144 test.Next(_L("Find slave server thread..."));
145 test_KErrNone(aTestServerThread.Open(_L("t_shbuf_perf.exe[00000000]0001::!RShBufServer")));
149 // Open the driver (always open it as it is used to get buffers too!)...
151 TInt r = User::LoadLogicalDevice(_L("D_SHBUF_CLIENT.LDD"));
152 test(r == KErrNone || r == KErrAlreadyExists);
153 r = User::LoadLogicalDevice(_L("D_SHBUF_OWN.LDD"));
154 test(r == KErrNone || r == KErrAlreadyExists);
155 test_KErrNone(aLdd.Open(aDriverNum));
156 } // StartSecondProcessAndDriver
159 void StopSecondProcessAndDriver(TRShBufPerfTest aTestType,
160 RShBufTestChannel& aLdd,
161 RShBufTestServerSession& aTestServer,
162 RThread& aTestServerThread)
165 // Close the driver..
169 if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn ||
170 aTestType == ERShBufPerfTestClientToProcessToDriverOneWay ||
171 aTestType == ERShBufPerfTestDriverToProcessToClientReturn ||
172 aTestType == ERShBufPerfTestDriverToProcessToClientOneWay)
174 #ifdef CAN_TRANSFER_SHBUF_TO_ANOTHER_PROCESS
175 test.Next(_L("Stop slave server process..."));
176 test_KErrNone(aTestServer.ShutdownServer());
178 aTestServerThread.Close();
181 } // StopSecondProcessAndDriver
185 * Print the TRShBufPerfTest enum.
187 void PrinTRShBufPerfTestType(const TDesC& aPrefix, TRShBufPerfTest aTestType)
191 case ERShBufPerfTestClientToDriverReturn:
193 test.Printf(_L("%SaTestType=ERShBufPerfTestClientToDriverReturn (%d)"), &aPrefix, aTestType);
197 case ERShBufPerfTestClientToDriverOneWay:
199 test.Printf(_L("%SaTestType=ERShBufPerfTestClientToDriverOneWay (%d)"), &aPrefix, aTestType);
203 case ERShBufPerfTestClientToProcessToDriverReturn:
205 test.Printf(_L("%SaTestType=ERShBufPerfTestClientToProcessToDriverReturn (%d)"), &aPrefix, aTestType);
209 case ERShBufPerfTestClientToProcessToDriverOneWay:
211 test.Printf(_L("%SaTestType=ERShBufPerfTestClientToProcessToDriverOneWay (%d)"), &aPrefix, aTestType);
215 case ERShBufPerfTestDriverToClientReturn:
217 test.Printf(_L("%SaTestType=ERShBufPerfTestDriverToClientReturn (%d)"), &aPrefix, aTestType);
221 case ERShBufPerfTestDriverToClientOneWay:
223 test.Printf(_L("%SaTestType=ERShBufPerfTestDriverToClientOneWay (%d)"), &aPrefix, aTestType);
227 case ERShBufPerfTestDriverToProcessToClientReturn:
229 test.Printf(_L("%SaTestType=ERShBufPerfTestDriverToProcessToClientReturn (%d)"), &aPrefix, aTestType);
233 case ERShBufPerfTestDriverToProcessToClientOneWay:
235 test.Printf(_L("%SaTestType=ERShBufPerfTestDriverToProcessToClientOneWay (%d)"), &aPrefix, aTestType);
241 test.Printf(_L("%SaTestType=<unknown> (%d)"), &aPrefix, aTestType);
245 } // PrinTRShBufPerfTestType
249 * Print the TShPoolCreateInfo object.
251 void PrintTShPoolInfo(const TDesC& aPrefix, TShPoolInfo aShPoolInfo)
253 test.Printf(_L("%SaShPoolInfo.iBufSize=%d"), &aPrefix, aShPoolInfo.iBufSize);
254 test.Printf(_L("%SaShPoolInfo.iInitialBufs=%d"), &aPrefix, aShPoolInfo.iInitialBufs);
255 test.Printf(_L("%SaShPoolInfo.iMaxBufs=%d"), &aPrefix, aShPoolInfo.iMaxBufs);
256 test.Printf(_L("%SaShPoolInfo.iGrowTriggerRatio=%d"), &aPrefix, aShPoolInfo.iGrowTriggerRatio);
257 test.Printf(_L("%SaShPoolInfo.iGrowByRatio=%d"), &aPrefix, aShPoolInfo.iGrowByRatio);
258 test.Printf(_L("%SaShPoolInfo.iShrinkHysteresisRatio=%d"), &aPrefix, aShPoolInfo.iShrinkHysteresisRatio);
259 test.Printf(_L("%SaShPoolInfo.iAlignment=%d (0x%x)"), &aPrefix, aShPoolInfo.iAlignment,
260 2 << (aShPoolInfo.iAlignment - 1));
261 test.Printf(_L("%SaShPoolInfo.iFlags=0x%08x"), &aPrefix, aShPoolInfo.iFlags);
262 } // PrintTShPoolInfo
265 void TestSharedBufferPerformanceL(TRShBufPerfTest aTestType,
266 TInt aMinAllocSize, TInt aMaxAllocSize,
267 TInt aBufferSizeSteps, TInt aTotalIterations,
268 TShPoolCreateFlags aFlags, TInt aDriverNum,
271 TShPoolInfo shPoolInfo;
273 shPoolInfo.iBufSize = aMaxAllocSize;
274 shPoolInfo.iInitialBufs = 5;
275 shPoolInfo.iMaxBufs = 5;
276 shPoolInfo.iGrowTriggerRatio = 0;
277 shPoolInfo.iGrowByRatio = 0;
278 shPoolInfo.iShrinkHysteresisRatio = 0;
279 shPoolInfo.iAlignment = 9;
280 shPoolInfo.iFlags = aFlags;
283 // Start test and print the parameters...
285 test.Printf(_L(" Test parameters:"));
286 PrinTRShBufPerfTestType(_L(" "), aTestType);
287 PrintTShPoolInfo(_L(" "), shPoolInfo);
288 test.Printf(_L(" aMinAllocSize=%d"), aMinAllocSize);
289 test.Printf(_L(" aMaxAllocSize=%d"), aMaxAllocSize);
290 test.Printf(_L(" aBufferSizeSteps=%d"), aBufferSizeSteps);
291 test.Printf(_L(" aTotalIterations=%d"), aTotalIterations);
292 test.Printf(_L(" aDriverNum=%d"), aDriverNum);
295 // Initialise second process and/or open the driver...
297 RShBufTestServerSession testServer;
298 RShBufTestChannel shBufLdd;
299 RThread testServerThread;
301 StartSecondProcessAndDriver(aTestType, shBufLdd, testServer, testServerThread, aDriverNum);
302 CleanupClosePushL(testServer);
305 // Allocate a RShPool...
309 if (aFlags & EShPoolPageAlignedBuffer)
311 TShPoolCreateInfo shPoolCreateInfo(TShPoolCreateInfo::EPageAlignedBuffer,
312 shPoolInfo.iBufSize, shPoolInfo.iInitialBufs);
313 test_KErrNone(shPool.Create(shPoolCreateInfo, KDefaultPoolHandleFlags));
314 CleanupClosePushL(shPool);
316 test_KErrNone(shPool.SetBufferWindow(-1, ETrue));
317 shPoolInfo.iAlignment = 12;
319 else if (aFlags & EShPoolNonPageAlignedBuffer)
321 TShPoolCreateInfo shPoolCreateInfo(TShPoolCreateInfo::ENonPageAlignedBuffer,
322 shPoolInfo.iBufSize, shPoolInfo.iInitialBufs,
323 shPoolInfo.iAlignment);
324 test_KErrNone(shPool.Create(shPoolCreateInfo, KDefaultPoolHandleFlags));
325 CleanupClosePushL(shPool);
328 test(shPool.Handle() != 0);
330 if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn ||
331 aTestType == ERShBufPerfTestClientToProcessToDriverOneWay ||
332 aTestType == ERShBufPerfTestDriverToProcessToClientReturn ||
333 aTestType == ERShBufPerfTestDriverToProcessToClientOneWay)
335 test_KErrNone(testServer.OpenRShBufPool(shPool.Handle(), shPoolInfo));
339 test_KErrNone(shBufLdd.OpenUserPool(shPool.Handle(), shPoolInfo));
343 // Run the test iterations and time the result...
346 HAL::Get(HALData::EFastCounterFrequency, fastTimerFreq);
347 TReal ticksPerMicroSec = 1.0E-6 * fastTimerFreq;
349 // Bind this thread to CPU 0. This is so that timer deltas don't drift from
350 // scheduling - else, it causes spurious failures.
351 if (UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0) > 1)
352 (void)UserSvr::HalFunction(EHalGroupKernel, EKernelHalLockThreadToCpu, (TAny *)0, 0);
354 TReal64 totalLengthOfDesTest(0);
355 TReal64 totalLengthOfShBufTest(0);
356 TInt breakevenPoint = 0;
359 test.Printf(_L("BufSize\tTotalTime(Des)\tAvTime(Des)\tTotalTime(ShBuf)\tAvTime(ShBuf)\tSpeedUp(%%)"));
361 test.Printf(_L("\n"));
363 for (bufferStep = 0; bufferStep < aBufferSizeSteps; bufferStep++)
366 // Run a single buffer size through these tests...
368 TInt bufferSize = aMinAllocSize +
369 (((aMaxAllocSize - aMinAllocSize) * bufferStep) / (aBufferSizeSteps-1));
370 TUint32 startDesTest = 0;
371 TUint32 startShBufTest = 0;
374 TUint32 lengthOfDesTest=0;
377 // Test normal descriptor methods first...
380 for (iteration = 0; iteration < aTotalIterations; iteration++)
383 // Allocate a local buffer for this test...
385 HBufC8* singleBuf = HBufC8::NewLC(bufferSize);
387 startDesTest = User::FastCounter();
388 test(singleBuf != NULL);
390 TPtr8 singleBufPtr = singleBuf->Des();
391 singleBufPtr.SetLength(bufferSize);
394 // Are we sending or receiving?
396 if (aTestType == ERShBufPerfTestClientToDriverOneWay ||
397 aTestType == ERShBufPerfTestClientToProcessToDriverOneWay)
399 #ifdef _DEBUG // do not cache
400 TUint8* bufptr = const_cast<TUint8*>(singleBuf->Ptr());
403 for (TInt pos = 0; pos < bufferSize; pos++)
405 bufptr[pos] = (TUint8)(pos%32);
408 memset(iClearCache, 0xFF, sizeof(iClearCache));
414 // Either send to the driver or to the other process...
416 if (aTestType == ERShBufPerfTestClientToDriverReturn)
418 test_KErrNone(shBufLdd.FromTPtr8ProcessAndReturn(singleBufPtr, bufferSize));
419 test(singleBufPtr.Length() == bufferSize-2);
421 else if (aTestType == ERShBufPerfTestClientToDriverOneWay)
423 test_KErrNone(shBufLdd.FromTPtr8ProcessAndRelease(singleBufPtr));
425 else if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn)
427 test_KErrNone(testServer.FromTPtr8ProcessAndReturn(singleBufPtr, bufferSize));
428 test(singleBufPtr.Length() == bufferSize-2);
430 else if (aTestType == ERShBufPerfTestClientToProcessToDriverOneWay)
432 test_KErrNone(testServer.FromTPtr8ProcessAndRelease(singleBufPtr));
435 lengthOfDesTest += (User::FastCounter() - startDesTest);
437 CleanupStack::PopAndDestroy(singleBuf);
440 TInt64 lengthOfShBufTest = 0;
443 // Test ShBuf methods...
445 for (iteration = 0; iteration < aTotalIterations; iteration++)
450 // Are we sending or receiving?
452 startShBufTest = User::FastCounter();
453 if (aTestType == ERShBufPerfTestClientToDriverOneWay ||
454 aTestType == ERShBufPerfTestClientToProcessToDriverOneWay)
459 // Allocate a buffer (using a pool)...
462 test_KErrNone(shBuf.Alloc(shPool));
463 TUint8* shBufPtr = shBuf.Ptr();
465 lengthPtr = (TInt*)(&shBufPtr[0]); // First 32bit word is length!
466 *lengthPtr = bufferSize;
467 #ifdef _DEBUG // do not cache
468 for (TInt pos = 4; pos < bufferSize; pos++)
470 shBufPtr[pos] = (TUint8)(pos%32);
473 memset(iClearCache, 0xFF, sizeof(iClearCache));
479 // Either send to the driver or to the other process...
481 if (aTestType == ERShBufPerfTestClientToDriverReturn)
484 retHandle = shBufLdd.FromRShBufProcessAndReturn(bufferSize);
485 test_Compare(retHandle, >, 0);
486 shBuf.SetReturnedHandle(retHandle);
488 TInt* retPtr = (TInt*)shBuf.Ptr();
490 test(*retPtr == bufferSize-2);
494 else if (aTestType == ERShBufPerfTestClientToDriverOneWay)
496 test_KErrNone(shBufLdd.FromRShBufProcessAndRelease(shBuf.Handle()));
498 else if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn)
500 test_KErrNone(testServer.FromRShBufProcessAndReturn(shBuf, bufferSize));
501 TInt* retPtr = (TInt*)shBuf.Ptr();
503 test(*retPtr == bufferSize-2);
507 else if (aTestType == ERShBufPerfTestClientToProcessToDriverOneWay)
509 test_KErrNone(testServer.FromRShBufProcessAndRelease(shBuf));
511 lengthOfShBufTest += (User::FastCounter() - startShBufTest);
515 // Print results of this buffer size...
518 test.Printf(_L("%d\t%10.2lfusec\t%10.2lfusec\t%.2f%%"), bufferSize,
519 I64REAL(lengthOfDesTest) / (TReal(aTotalIterations) * ticksPerMicroSec),
520 I64REAL(lengthOfShBufTest) / (TReal(aTotalIterations) * ticksPerMicroSec),
521 ((100.0 / I64REAL(lengthOfShBufTest)) * I64REAL(lengthOfDesTest)) - 100.0);
523 test.Printf(_L("\n"));
526 totalLengthOfDesTest += lengthOfDesTest;
527 totalLengthOfShBufTest += lengthOfShBufTest;
530 // Track the breakeven point (e.g. the buffer size at which RShBuf is
531 // quicker). This is normally when the number of bytes copied by the
532 // descriptor takes longer than the handling of the RShBuf.
534 if (lengthOfShBufTest >= lengthOfDesTest)
536 breakevenPoint = aMinAllocSize +
537 (((aMaxAllocSize - aMinAllocSize) * (bufferStep + 1)) / (aBufferSizeSteps-1));
542 // Display timing information...
544 test.Printf(_L("Average\t%10.2lfusec\t%10.2lfusec\t%.2f%%"),
545 I64REAL(totalLengthOfDesTest) / (TReal(aTotalIterations * aBufferSizeSteps) * ticksPerMicroSec),
546 I64REAL(totalLengthOfShBufTest) / (TReal(aTotalIterations * aBufferSizeSteps) * ticksPerMicroSec),
547 ((100.0 / I64REAL(totalLengthOfShBufTest)) * I64REAL(totalLengthOfDesTest)) - 100.0);
549 test.Printf(_L("\n"));
553 // Record summary info for later use...
557 if (breakevenPoint <= aMaxAllocSize)
559 aSummaryBuf.AppendFormat(_L("%10.2lfusec\t%10.2lfusec\t%.2f%%%%\t%d"),
560 I64REAL(totalLengthOfDesTest) / TReal(aTotalIterations * aBufferSizeSteps * ticksPerMicroSec),
561 I64REAL(totalLengthOfShBufTest) / TReal(aTotalIterations * aBufferSizeSteps * ticksPerMicroSec),
562 ((100.0 / I64REAL(totalLengthOfShBufTest)) * I64REAL(totalLengthOfDesTest)) - 100.0,
567 aSummaryBuf.AppendFormat(_L("%10.2lfusec\t%10.2lfusec\t%.2f%%%%\tFailed to breakeven"),
568 I64REAL(totalLengthOfDesTest) / TReal(aTotalIterations * aBufferSizeSteps * ticksPerMicroSec),
569 I64REAL(totalLengthOfShBufTest) / TReal(aTotalIterations * aBufferSizeSteps * ticksPerMicroSec),
570 ((100.0 / I64REAL(totalLengthOfShBufTest)) * I64REAL(totalLengthOfDesTest)) - 100.0);
576 TInt shPoolHandle = shPool.Handle();
577 CleanupStack::PopAndDestroy(&shPool);
579 if (aTestType == ERShBufPerfTestClientToProcessToDriverReturn ||
580 aTestType == ERShBufPerfTestClientToProcessToDriverOneWay ||
581 aTestType == ERShBufPerfTestDriverToProcessToClientReturn ||
582 aTestType == ERShBufPerfTestDriverToProcessToClientOneWay)
584 testServer.CloseRShBufPool(shPoolHandle);
588 test_KErrNone(shBufLdd.CloseUserPool());
592 // Shutdown the second process and/or close the driver.
594 CleanupStack::Pop(&testServer);
595 StopSecondProcessAndDriver(aTestType, shBufLdd, testServer, testServerThread);
596 } // TestSharedBufferPerformanceL
600 * Main test process which performs the testing.
609 test.Start(_L("Check for Shared Buffers availability"));
612 TShPoolCreateInfo inf(TShPoolCreateInfo::EPageAlignedBuffer, 100, 10);
613 r = pool.Create(inf, KDefaultPoolHandleFlags);
614 if (r == KErrNotSupported)
616 test.Printf(_L("Not supported by this memory model.\n"));
623 test.Next(_L("Performance test shared buffers"));
626 // Create a summary buffer to hold the average speeds of different pools...
628 HBufC* summaryBuf = HBufC::NewLC(16 * 128 * 2);
629 TPtr summaryBufPtr = summaryBuf->Des();
630 TBuf<128> testName, testSummary;
632 summaryBufPtr.Append(_L("Test Type\tAverage Time(Des)\tAverage Time(ShBuf)\tAverage SpeedUp(%%)\tBreakeven Buffer Size\n"));
637 testName.Copy(_L("Client->Driver (non-aligned/client-thread)"));
639 TestSharedBufferPerformanceL(
640 /* Test type */ ERShBufPerfTestClientToDriverOneWay,
641 /* Min Alloc size */ 64,
642 /* Max Alloc size */ 8192,
643 /* Buffer size steps */ 128,
644 /* Total iterations */ KNumberOfIterations,
645 /* Buffer flags */ EShPoolNonPageAlignedBuffer,
646 /* Driver to use */ RShBufTestChannel::EClientThread,
647 /* Summary string */ testSummary);
648 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
650 testName.Copy(_L("Client->Driver (aligned/client-thread)"));
652 TestSharedBufferPerformanceL(
653 /* Test type */ ERShBufPerfTestClientToDriverOneWay,
654 /* Min Alloc size */ 64,
655 /* Max Alloc size */ 8192,
656 /* Buffer size steps */ 128,
657 /* Total iterations */ KNumberOfIterations,
658 /* Buffer flags */ EShPoolPageAlignedBuffer,
659 /* Driver to use */ RShBufTestChannel::EClientThread,
660 /* Summary string */ testSummary);
661 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
663 testName.Copy(_L("Client->Driver (non-aligned/own-thread)"));
665 TestSharedBufferPerformanceL(
666 /* Test type */ ERShBufPerfTestClientToDriverOneWay,
667 /* Min Alloc size */ 64,
668 /* Max Alloc size */ 8192,
669 /* Buffer size steps */ 128,
670 /* Total iterations */ KNumberOfIterations,
671 /* Buffer flags */ EShPoolNonPageAlignedBuffer,
672 /* Driver to use */ RShBufTestChannel::EOwnThread,
673 /* Summary string */ testSummary);
674 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
676 testName.Copy(_L("Client->Driver (aligned/own-thread)"));
678 TestSharedBufferPerformanceL(
679 /* Test type */ ERShBufPerfTestClientToDriverOneWay,
680 /* Min Alloc size */ 64,
681 /* Max Alloc size */ 8192,
682 /* Buffer size steps */ 128,
683 /* Total iterations */ KNumberOfIterations,
684 /* Buffer flags */ EShPoolPageAlignedBuffer,
685 /* Driver to use */ RShBufTestChannel::EOwnThread,
686 /* Summary string */ testSummary);
687 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
689 testName.Copy(_L("Client->Driver->Client (non-aligned/client-thread)"));
691 TestSharedBufferPerformanceL(
692 /* Test type */ ERShBufPerfTestClientToDriverReturn,
693 /* Min Alloc size */ 64,
694 /* Max Alloc size */ 8192,
695 /* Buffer size steps */ 128,
696 /* Total iterations */ KNumberOfIterations,
697 /* Buffer flags */ EShPoolNonPageAlignedBuffer,
698 /* Driver to use */ RShBufTestChannel::EClientThread,
699 /* Summary string */ testSummary);
700 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
702 testName.Copy(_L("Client->Driver->Client (aligned/client-thread)"));
704 TestSharedBufferPerformanceL(
705 /* Test type */ ERShBufPerfTestClientToDriverReturn,
706 /* Min Alloc size */ 64,
707 /* Max Alloc size */ 8192,
708 /* Buffer size steps */ 128,
709 /* Total iterations */ KNumberOfIterations,
710 /* Buffer flags */ EShPoolPageAlignedBuffer,
711 /* Driver to use */ RShBufTestChannel::EClientThread,
712 /* Summary string */ testSummary);
713 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
715 testName.Copy(_L("Client->Driver->Client (non-aligned/own-thread)"));
717 TestSharedBufferPerformanceL(
718 /* Test type */ ERShBufPerfTestClientToDriverReturn,
719 /* Min Alloc size */ 64,
720 /* Max Alloc size */ 8192,
721 /* Buffer size steps */ 128,
722 /* Total iterations */ KNumberOfIterations,
723 /* Buffer flags */ EShPoolNonPageAlignedBuffer,
724 /* Driver to use */ RShBufTestChannel::EOwnThread,
725 /* Summary string */ testSummary);
726 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
728 testName.Copy(_L("Client->Driver->Client (aligned/own-thread)"));
730 TestSharedBufferPerformanceL(
731 /* Test type */ ERShBufPerfTestClientToDriverReturn,
732 /* Min Alloc size */ 64,
733 /* Max Alloc size */ 8192,
734 /* Buffer size steps */ 128,
735 /* Total iterations */ KNumberOfIterations,
736 /* Buffer flags */ EShPoolPageAlignedBuffer,
737 /* Driver to use */ RShBufTestChannel::EOwnThread,
738 /* Summary string */ testSummary);
739 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
741 testName.Copy(_L("Client->Process->Driver (non-aligned/client-thread)"));
743 TestSharedBufferPerformanceL(
744 /* Test type */ ERShBufPerfTestClientToProcessToDriverOneWay,
745 /* Min Alloc size */ 64,
746 /* Max Alloc size */ 8192,
747 /* Buffer size steps */ 128,
748 /* Total iterations */ KNumberOfIterations,
749 /* Buffer flags */ EShPoolNonPageAlignedBuffer,
750 /* Driver to use */ RShBufTestChannel::EClientThread,
751 /* Summary string */ testSummary);
752 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
754 testName.Copy(_L("Client->Process->Driver (aligned/client-thread)"));
756 TestSharedBufferPerformanceL(
757 /* Test type */ ERShBufPerfTestClientToProcessToDriverOneWay,
758 /* Min Alloc size */ 64,
759 /* Max Alloc size */ 8192,
760 /* Buffer size steps */ 128,
761 /* Total iterations */ KNumberOfIterations,
762 /* Buffer flags */ EShPoolPageAlignedBuffer,
763 /* Driver to use */ RShBufTestChannel::EClientThread,
764 /* Summary string */ testSummary);
765 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
767 testName.Copy(_L("Client->Process->Driver (non-aligned/own-thread)"));
769 TestSharedBufferPerformanceL(
770 /* Test type */ ERShBufPerfTestClientToProcessToDriverOneWay,
771 /* Min Alloc size */ 64,
772 /* Max Alloc size */ 8192,
773 /* Buffer size steps */ 128,
774 /* Total iterations */ KNumberOfIterations,
775 /* Buffer flags */ EShPoolNonPageAlignedBuffer,
776 /* Driver to use */ RShBufTestChannel::EOwnThread,
777 /* Summary string */ testSummary);
778 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
780 testName.Copy(_L("Client->Process->Driver (aligned/own-thread)"));
782 TestSharedBufferPerformanceL(
783 /* Test type */ ERShBufPerfTestClientToProcessToDriverOneWay,
784 /* Min Alloc size */ 64,
785 /* Max Alloc size */ 8192,
786 /* Buffer size steps */ 128,
787 /* Total iterations */ KNumberOfIterations,
788 /* Buffer flags */ EShPoolPageAlignedBuffer,
789 /* Driver to use */ RShBufTestChannel::EOwnThread,
790 /* Summary string */ testSummary);
791 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
793 testName.Copy(_L("Client->Process->Driver->Process->Client (non-aligned/client-thread)"));
795 TestSharedBufferPerformanceL(
796 /* Test type */ ERShBufPerfTestClientToProcessToDriverReturn,
797 /* Min Alloc size */ 64,
798 /* Max Alloc size */ 8192,
799 /* Buffer size steps */ 128,
800 /* Total iterations */ KNumberOfIterations,
801 /* Buffer flags */ EShPoolNonPageAlignedBuffer,
802 /* Driver to use */ RShBufTestChannel::EClientThread,
803 /* Summary string */ testSummary);
804 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
806 testName.Copy(_L("Client->Process->Driver->Process->Client (aligned/client-thread)"));
808 TestSharedBufferPerformanceL(
809 /* Test type */ ERShBufPerfTestClientToProcessToDriverReturn,
810 /* Min Alloc size */ 64,
811 /* Max Alloc size */ 8192,
812 /* Buffer size steps */ 128,
813 /* Total iterations */ KNumberOfIterations,
814 /* Buffer flags */ EShPoolPageAlignedBuffer,
815 /* Driver to use */ RShBufTestChannel::EClientThread,
816 /* Summary string */ testSummary);
817 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
819 testName.Copy(_L("Client->Process->Driver->Process->Client (non-aligned/own-thread)"));
821 TestSharedBufferPerformanceL(
822 /* Test type */ ERShBufPerfTestClientToProcessToDriverReturn,
823 /* Min Alloc size */ 64,
824 /* Max Alloc size */ 8192,
825 /* Buffer size steps */ 128,
826 /* Total iterations */ KNumberOfIterations,
827 /* Buffer flags */ EShPoolNonPageAlignedBuffer,
828 /* Driver to use */ RShBufTestChannel::EOwnThread,
829 /* Summary string */ testSummary);
830 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
832 testName.Copy(_L("Client->Process->Driver->Process->Client (aligned/own-thread)"));
834 TestSharedBufferPerformanceL(
835 /* Test type */ ERShBufPerfTestClientToProcessToDriverReturn,
836 /* Min Alloc size */ 64,
837 /* Max Alloc size */ 8192,
838 /* Buffer size steps */ 128,
839 /* Total iterations */ KNumberOfIterations,
840 /* Buffer flags */ EShPoolPageAlignedBuffer,
841 /* Driver to use */ RShBufTestChannel::EOwnThread,
842 /* Summary string */ testSummary);
843 summaryBufPtr.AppendFormat(_L("%S\t%S\n"), &testName, &testSummary);
846 // Print the summary...
848 TInt nextLineBreak = summaryBufPtr.Find(_L("\n"));
850 test.Next(_L("Results summary (average values for each test)"));
852 while (nextLineBreak != KErrNotFound)
854 test.Printf(summaryBufPtr.Left(nextLineBreak));
856 test.Printf(_L("\n"));
859 summaryBufPtr = summaryBufPtr.Mid(nextLineBreak+1);
860 nextLineBreak = summaryBufPtr.Find(_L("\n"));
862 CleanupStack::PopAndDestroy(summaryBuf);
875 // Allocate a clean up stack and top level TRAP...
878 CTrapCleanup* cleanup = CTrapCleanup::New();
879 TInt err = KErrNoMemory;
883 TRAP(err, RunTestsL());