Update contrib.
1 // Copyright (c) 2005-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_userbm.h
18 #ifndef __T_USERBM_H__
19 #define __T_USERBM_H__
24 /// Base class for user benchmarks
25 class TUserBenchmark : public TBmInfo
28 virtual void Run(TInt aIts) = 0;
30 TUserBenchmark(const TDesC8& aName, TUint aCategory);
33 class TUserBenchmarkList : public MBenchmarkList
36 virtual TInt Info(TInt aIndex, TBmInfo& aInfoOut);
37 virtual TInt Run(TInt aIndex, const TBmParams& aParams, TInt& aDeltaOut);
40 /// List containing all defined benchmarks
41 extern RPointerArray<TUserBenchmark> UserBenchmarks;
43 #define CALL_10_TIMES(x) x; x; x; x; x; x; x; x; x; x
45 /// Macro to define a benchmark easily
46 #define DEFINE_USER_BENCHMARK(name, pre, test) \
47 _LIT8(KName_##name, #name); \
48 class TBenchmark_##name : public TUserBenchmark \
51 TBenchmark_##name() : \
52 TUserBenchmark(KName_##name, KCategoryGeneral)\
54 virtual void Run(TInt aIts) \
57 for (TInt j = 0 ; j < aIts ; ++j) \
59 CALL_10_TIMES(test); \
64 /// Macro to define a benchmark in category 'extra'
65 #define DEFINE_EXTRA_BENCHMARK(name, pre, test) \
66 _LIT8(KName_##name, #name); \
67 class TBenchmark_##name : public TUserBenchmark \
70 TBenchmark_##name() : \
71 TUserBenchmark(KName_##name, KCategoryExtra) \
73 virtual void Run(TInt aIts) \
76 for (TInt j = 0 ; j < aIts ; ++j) \
78 CALL_10_TIMES(test); \