0
|
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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32test/defrag/perf/t_timer.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#define __E32TEST_EXTENSION__
|
|
19 |
#include <e32test.h>
|
|
20 |
#include <hal.h>
|
|
21 |
|
|
22 |
#include "t_perf.h"
|
|
23 |
|
|
24 |
|
|
25 |
const TInt CalAttempts = 100;
|
|
26 |
|
|
27 |
void DefragLatency::CalibrateTimer(RTest& aTest)
|
|
28 |
{
|
|
29 |
TInt val = 0;
|
|
30 |
TUint time1, time2;
|
|
31 |
|
|
32 |
HAL::Get(HAL::EFastCounterFrequency, iFastCounterFreq);
|
|
33 |
|
|
34 |
///////////////////////////////////////////
|
|
35 |
for (TInt i = 0; i < CalAttempts; i++)
|
|
36 |
{
|
|
37 |
time1 = GetFastCounter();
|
|
38 |
time2 = GetFastCounter();
|
|
39 |
if (time2 < time1)
|
|
40 |
aTest.Printf(_L("CALIBRATION ERROR !!!!!!!!!!!!11\n"));
|
|
41 |
val += time2 - time1;
|
|
42 |
}
|
|
43 |
iCalDelay = val / CalAttempts;
|
|
44 |
}
|
|
45 |
|