First public contribution.
1 // Copyright (c) 1996-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\bench\t_excbm.cpp
19 #include <e32std_private.h>
21 #include <e32base_private.h>
25 const TInt KHeapSize=132*1024;
26 const TInt KAverageOverInSeconds=10;
27 const TInt KNumberOfCalculationsPerLoop=20;
31 RTest test(_L("T_EXCBM"));
33 GLREF_C TInt SlowExec(TAny*);
34 GLREF_C TInt FastExec(TAny*);
36 TInt64 runTest(TThreadFunction aFunction,const TDesC& aTitle)
40 TInt r=thread.Create(aTitle,aFunction,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
43 test.Printf(_L("Failed to create thread with error %d\n"),r);
49 User::After(KAverageOverInSeconds*1000000);
53 result *= KNumberOfCalculationsPerLoop;
54 result /= KAverageOverInSeconds;
55 TInt r2 = I64INT(result);
56 test.Printf(_L("%S executed %d in 1 second\n"),&aTitle,r2);
62 // Benchmark for Exec functions
67 test.Start(_L("Benchmarks for Exec functions"));
68 runTest(SlowExec,_L("Slow Exec"));
69 runTest(FastExec,_L("Fast Exec"));