Update contrib.
1 // Copyright (c) 1997-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_rxbm.cpp
19 #include <e32std_private.h>
21 #include <e32base_private.h>
24 const TInt KHeapSize=0x2000;
25 const TInt KAverageOverInSeconds=10;
26 const TInt KNumberOfCalculationsPerLoop=10;
29 RTest test(_L("T_RXBM"));
31 GLREF_C TInt TRealXAddition(TAny*);
32 GLREF_C TInt TRealXSubtraction(TAny*);
33 GLREF_C TInt TRealXMultiplication(TAny*);
34 GLREF_C TInt TRealXDivision(TAny*);
36 TInt 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 test.Printf(_L("%S executed %d in 1 second\n"),&aTitle,result*KNumberOfCalculationsPerLoop/KAverageOverInSeconds);
59 // Benchmark for TRealX functions
63 test.Start(_L("Benchmarks for TRealX"));
65 runTest(TRealXAddition,_L("Addition"));
66 runTest(TRealXSubtraction,_L("Subtraction"));
67 runTest(TRealXMultiplication,_L("Multiplication"));
68 runTest(TRealXDivision,_L("Division"));