diff -r 000000000000 -r bde4ae8d615e os/kernelhwsrv/kerneltest/e32test/active/t_timerduration.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/kernelhwsrv/kerneltest/e32test/active/t_timerduration.cpp Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,177 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Overview: +// The test measures the duration of the user-side timer services. +// API Information: +// User::After(...) +// User::At(...) +// User::AfterHighRes(...) +// Details: +// - Calls time services a number of times with the same input arguments. +// - Records and prints the minimum and maximum duration of each test case. +// - Tests the duration of User::After and User::AfterHighRes on target. +// Platforms/Drives/Compatibility: +// Emulator and Hardware (Automatic). +// Assumptions/Requirement/Pre-requisites: +// Failures and causes: +// The test can fail only on target. +// - The duration of Timer::After(aTime) is not within the limits (from to ) +// - The duration of Timer::AfterHighRes(aTime) is not within the limits (from to ) +// Base Port information: +// +// + +#include +#include +#include +#include +#include +#include + +LOCAL_D RTest test(_L("T_TIMERDURATION")); + +// Max number of different time values measured +const TInt KMaxTimeValues = 12; + +// number of times measurement taken to average +const TInt KMaxTimeMeasurements = 20; +TInt MaxTimeMeasurements; +TInt TimeRawMS[KMaxTimeMeasurements];//Holds the ROW time in Kernel ticks + +TInt* TimeValue; +TInt TimeMin[KMaxTimeValues]; +TInt TimeMax[KMaxTimeValues]; + +void calcStats(TInt i) + { + TimeMin[i]=TimeRawMS[0]; + TimeMax[i]=TimeRawMS[0]; + for (TInt j=1; jTimeRawMS[j]) TimeMin[i]=TimeRawMS[j]; + if (TimeMax[i]= TimeMax[k]); + } +#endif +/////////////////////////////////////////// + test.Next(_L("User::At")); + MaxTimeMeasurements = KMaxTimeMeasurements/2; + TInt TimeValues3[KMaxTimeValues]={950000,1000000,-1}; + TimeValue = &TimeValues3[0]; + TTime time; + time.Set(_L("20050101:000001.000000")); + User::SetHomeTime(time); + __BEFORE_WAIT__ + time.HomeTime(); + time += (TTimeIntervalMicroSeconds32)value; + __MEASURE1__ + User::At(time); + __MEASURE2__ + __AFTER_WAIT__ +/////////////////////////////////////////// + test.Next(_L("User::AfterHighRes")); + MaxTimeMeasurements = KMaxTimeMeasurements; + TInt TimeValues4[KMaxTimeValues]={1000,2000,4000,8000,16000,32000,64000,128000,-1}; + TimeValue = &TimeValues4[0]; + __BEFORE_WAIT__ + __MEASURE1__ + User::AfterHighRes(value); + __MEASURE2__ + __AFTER_WAIT__ +#if defined(__EPOC32__) + //Check that User::AfterHighRes calls completed within boundaries + for (k = 0; k= TimeMax[k]); + } +#endif +/////////////////////////////////////////// + test.End(); + return(KErrNone); + }