First public contribution.
1 // Copyright (c) 2007-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/defrag/perf/t_perf.h
18 #ifndef _DEFRAG_PERF_T_PERF_H_
19 #define _DEFRAG_PERF_T_PERF_H_
21 #include "t_testdll.h"
22 #include "..\d_pagemove.h"
24 typedef TUint32 DTime_t;
28 #define TEST_PRINTF(x...) test.Printf(x)
30 #define TEST_PRINTF(x...)
33 #define MAXCHUNK_SIZE (40 * 1024 * 1024)
34 #define MINCHUNK_SIZE (2 * 1024 * 1024)
37 extern TInt TestDLLPerformance(TInt aNum);
43 iIterations = iCummulative = iResult = 0;
44 iMaxTime = (DTime_t)0;
45 iMinTime = (DTime_t) -1;
50 void CalibrateTimer(RTest& test);
53 static inline TUint32 GetFastCounter(void)
55 return User::FastCounter();
59 /** Log the new time diff and update iMaxTime and iMinTime appropriately
61 inline void AddIteration(DTime_t aTimeDiff)
66 if (aTimeDiff > iMaxTime)
69 if (aTimeDiff < iMinTime)
72 iCummulative += aTimeDiff;
76 inline void StartTimer(void)
78 iTime1 = GetFastCounter();
81 inline TUint32 StopTimer(RTest& aTest)
83 iTime2 = GetFastCounter();
84 TUint32 diff = iTime2 - iTime1;
87 aTest.Printf(_L("WARNING - Fast Counter rolled over. Assuming only once and continuing\n"));
88 diff = (KMaxTUint32 - iTime1) + iTime2;
94 DTime_t GetResult(DTime_t& aMax, DTime_t& aMin, DTime_t& aDelay)
96 iResult = (iCummulative / iIterations);
104 TInt iFastCounterFreq;
108 DTime_t iTime1, iTime2;
109 DTime_t iMaxTime, iMinTime;
110 DTime_t iCummulative;
120 iFunc0Addr = (TInt8 *)(-1);
121 iFuncNAddr = (TInt8 *)0;
128 TInt LoadTheLib(TInt aIdx, RTest& aTest);
129 TInt TestDLLPerformance(TInt aNum, RPageMove& aPageMove, RTest& aTest);
136 #endif // _DEFRAG_PERF_T_PERF_H_