os/kernelhwsrv/kerneltest/e32test/defrag/d_pagemove.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32test\defrag\d_pagemove.cpp
sl@0
    15
// LDD for testing defrag page moving
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
#include <kernel/kern_priv.h>
sl@0
    20
#include "platform.h"
sl@0
    21
#include "d_pagemove.h"
sl@0
    22
#include "nk_priv.h"
sl@0
    23
sl@0
    24
// debug tracing for this test driver is very noisy - off by default
sl@0
    25
#undef DEBUG_PAGEMOVE
sl@0
    26
#ifdef DEBUG_PAGEMOVE
sl@0
    27
#define DBG(a) a
sl@0
    28
#else
sl@0
    29
#define DBG(a)
sl@0
    30
#endif
sl@0
    31
sl@0
    32
const TInt KArbitraryNumber = 4;
sl@0
    33
sl@0
    34
// This driver is ram loaded (see mmp file) so this function will do fine
sl@0
    35
// as a test of RAM-loaded code.
sl@0
    36
TInt RamLoadedFunction()
sl@0
    37
	{
sl@0
    38
	return KArbitraryNumber;
sl@0
    39
	}
sl@0
    40
sl@0
    41
const TInt KMajorVersionNumber=0;
sl@0
    42
const TInt KMinorVersionNumber=1;
sl@0
    43
const TInt KBuildVersionNumber=1;
sl@0
    44
sl@0
    45
class DPageMove;
sl@0
    46
sl@0
    47
class DPageMoveFactory : public DLogicalDevice
sl@0
    48
//
sl@0
    49
// Page move LDD factory
sl@0
    50
//
sl@0
    51
	{
sl@0
    52
public:
sl@0
    53
	DPageMoveFactory();
sl@0
    54
	virtual TInt Install();						//overriding pure virtual
sl@0
    55
	virtual void GetCaps(TDes8& aDes) const;	//overriding pure virtual
sl@0
    56
	virtual TInt Create(DLogicalChannelBase*& aChannel);	//overriding pure virtual
sl@0
    57
	};
sl@0
    58
sl@0
    59
class DPageMove : public DLogicalChannelBase
sl@0
    60
//
sl@0
    61
// Page move logical channel
sl@0
    62
//
sl@0
    63
	{
sl@0
    64
public:
sl@0
    65
	DPageMove();
sl@0
    66
	~DPageMove();
sl@0
    67
protected:
sl@0
    68
	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
sl@0
    69
	virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2);
sl@0
    70
	TInt DoPageMove(TLinAddr aAddr, TBool aEchoOff=EFalse);
sl@0
    71
	TInt KernelDataMovePerformance(void);
sl@0
    72
	TInt iPageSize;
sl@0
    73
	};
sl@0
    74
sl@0
    75
DECLARE_STANDARD_LDD()
sl@0
    76
	{
sl@0
    77
    return new DPageMoveFactory;
sl@0
    78
    }
sl@0
    79
sl@0
    80
DPageMoveFactory::DPageMoveFactory()
sl@0
    81
//
sl@0
    82
// Constructor
sl@0
    83
//
sl@0
    84
    {
sl@0
    85
    iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
sl@0
    86
    //iParseMask=0;//No units, no info, no PDD
sl@0
    87
    //iUnitsMask=0;//Only one thing
sl@0
    88
    }
sl@0
    89
sl@0
    90
TInt DPageMoveFactory::Create(DLogicalChannelBase*& aChannel)
sl@0
    91
//
sl@0
    92
// Create a new DPageMove on this logical device
sl@0
    93
//
sl@0
    94
    {
sl@0
    95
	aChannel=new DPageMove;
sl@0
    96
	return aChannel?KErrNone:KErrNoMemory;
sl@0
    97
    }
sl@0
    98
sl@0
    99
TInt DPageMoveFactory::Install()
sl@0
   100
//
sl@0
   101
// Install the LDD - overriding pure virtual
sl@0
   102
//
sl@0
   103
    {
sl@0
   104
    return SetName(&KPageMoveLddName);
sl@0
   105
    }
sl@0
   106
sl@0
   107
void DPageMoveFactory::GetCaps(TDes8& aDes) const
sl@0
   108
//
sl@0
   109
// Get capabilities - overriding pure virtual
sl@0
   110
//
sl@0
   111
    {
sl@0
   112
    TCapsPageMoveV01 b;
sl@0
   113
    b.iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
sl@0
   114
    Kern::InfoCopy(aDes,(TUint8*)&b,sizeof(b));
sl@0
   115
    }
sl@0
   116
sl@0
   117
DPageMove::DPageMove()
sl@0
   118
//
sl@0
   119
// Constructor
sl@0
   120
//
sl@0
   121
    {
sl@0
   122
    }
sl@0
   123
sl@0
   124
TInt DPageMove::DoCreate(TInt /*aUnit*/, const TDesC8* /*anInfo*/, const TVersion& aVer)
sl@0
   125
//
sl@0
   126
// Create channel
sl@0
   127
//
sl@0
   128
    {
sl@0
   129
    if (!Kern::QueryVersionSupported(TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber),aVer))
sl@0
   130
    	return KErrNotSupported;
sl@0
   131
	iPageSize=Kern::RoundToPageSize(1);
sl@0
   132
	return KErrNone;
sl@0
   133
	}
sl@0
   134
sl@0
   135
DPageMove::~DPageMove()
sl@0
   136
//
sl@0
   137
// Destructor
sl@0
   138
//
sl@0
   139
    {
sl@0
   140
    }
sl@0
   141
sl@0
   142
TInt DPageMove::Request(TInt aFunction, TAny* a1, TAny* a2)
sl@0
   143
	{
sl@0
   144
	TInt r=KErrNone;
sl@0
   145
	DBG(Kern::Printf("DPageMove::Request func=%d a1=%08x a2=%08x", aFunction, a1, a2));
sl@0
   146
	NKern::ThreadEnterCS();
sl@0
   147
	switch (aFunction)
sl@0
   148
		{
sl@0
   149
		case RPageMove::EControlTryMovingKHeap:
sl@0
   150
			// Allocate a large array on the kernel heap and try moving it around.
sl@0
   151
			{
sl@0
   152
			const TInt size=16384;
sl@0
   153
			TUint8* array = new TUint8[size];
sl@0
   154
			if (array == NULL)
sl@0
   155
				r=KErrNoMemory;
sl@0
   156
			else
sl@0
   157
				{
sl@0
   158
				for (TInt i=0; i<size; i++) array[i] = i*i;
sl@0
   159
sl@0
   160
				TUint8* firstpage=(TUint8*)_ALIGN_DOWN((TLinAddr)array, iPageSize);
sl@0
   161
				for (TUint8* page=firstpage; page<array+size; page+=iPageSize)
sl@0
   162
					{
sl@0
   163
					r=DoPageMove((TLinAddr)page);
sl@0
   164
					if (r!=KErrNone)
sl@0
   165
						{
sl@0
   166
						Kern::Printf("Move returned %d", r);
sl@0
   167
						break;
sl@0
   168
						}
sl@0
   169
					}
sl@0
   170
sl@0
   171
				if (r==KErrNone)
sl@0
   172
					{
sl@0
   173
					for (TInt i=0; i<size; i++)
sl@0
   174
						{
sl@0
   175
						if (array[i] != (TUint8)(i*i))
sl@0
   176
							{
sl@0
   177
							r=KErrGeneral;
sl@0
   178
							Kern::Printf("Data differs at index %d address %08x, expected %02x got %02x", i, &array[i], (TUint8)(i*i), array[i]);
sl@0
   179
							}
sl@0
   180
						}
sl@0
   181
					}
sl@0
   182
sl@0
   183
				Kern::ValidateHeap();
sl@0
   184
sl@0
   185
				delete [] array;
sl@0
   186
				}
sl@0
   187
			}
sl@0
   188
			break;
sl@0
   189
sl@0
   190
		case RPageMove::EControlTryMovingKStack:
sl@0
   191
			// Stick a not-too-large array on the current thread's kernel stack and try moving it around.
sl@0
   192
			{
sl@0
   193
			const TInt size=1024;
sl@0
   194
			TUint8 array[size];
sl@0
   195
			for (TInt i=0; i<size; i++) array[i] = i*i;
sl@0
   196
sl@0
   197
			TUint8* firstpage=(TUint8*)_ALIGN_DOWN((TLinAddr)array, iPageSize);
sl@0
   198
			for (TUint8* page=firstpage; page<array+size; page+=iPageSize)
sl@0
   199
				{
sl@0
   200
				r=DoPageMove((TLinAddr)page);
sl@0
   201
				if (r!=KErrNone)
sl@0
   202
					{
sl@0
   203
					Kern::Printf("Move returned %d", r);
sl@0
   204
					break;
sl@0
   205
					}
sl@0
   206
				}
sl@0
   207
sl@0
   208
			if (r==KErrNone)
sl@0
   209
				{
sl@0
   210
				for (TInt i=0; i<size; i++)
sl@0
   211
					{
sl@0
   212
					if (array[i] != (TUint8)(i*i))
sl@0
   213
						{
sl@0
   214
						r=KErrGeneral;
sl@0
   215
						Kern::Printf("Data differs at index %d address %08x, expected %02x got %02x", i, &array[i], (TUint8)(i*i), array[i]);
sl@0
   216
						}
sl@0
   217
					}
sl@0
   218
				}
sl@0
   219
			}
sl@0
   220
			break;
sl@0
   221
sl@0
   222
		case RPageMove::EControlTryMovingUserPage:
sl@0
   223
		case RPageMove::EControlTryMovingLocale:
sl@0
   224
			// Try moving the page that the user part of the test told us to.
sl@0
   225
			r=DoPageMove((TLinAddr)a1, (TBool)a2);
sl@0
   226
			if (r!=KErrNone && !a2)
sl@0
   227
				Kern::Printf("Move returned %d", r);
sl@0
   228
			break;
sl@0
   229
sl@0
   230
		case RPageMove::EControlTryMovingKCode:
sl@0
   231
			{
sl@0
   232
			r=DoPageMove((TLinAddr)&RamLoadedFunction);
sl@0
   233
			if (r==KErrNone)
sl@0
   234
				{
sl@0
   235
				if (RamLoadedFunction()!=KArbitraryNumber)
sl@0
   236
					r=KErrGeneral;
sl@0
   237
				}	
sl@0
   238
			else
sl@0
   239
				Kern::Printf("Move returned %d", r);
sl@0
   240
			}
sl@0
   241
			break;
sl@0
   242
sl@0
   243
		case RPageMove::EControlPerfMovingKData:
sl@0
   244
			r = KernelDataMovePerformance();
sl@0
   245
			break;
sl@0
   246
sl@0
   247
		case RPageMove::EControlGetPhysAddr:
sl@0
   248
			TPhysAddr addr;
sl@0
   249
			addr = (TUint)Epoc::LinearToPhysical((TLinAddr)a1);
sl@0
   250
			Kern::ThreadRawWrite(&Kern::CurrentThread(),a2, &addr, sizeof(TPhysAddr));
sl@0
   251
			break;
sl@0
   252
sl@0
   253
		case RPageMove::EControlTryMovingPhysAddr:
sl@0
   254
			{
sl@0
   255
			TPhysAddr newAddr;
sl@0
   256
			r = Epoc::MovePhysicalPage((TPhysAddr)a1, newAddr);
sl@0
   257
			Kern::ThreadRawWrite(&Kern::CurrentThread(),a2, &newAddr, sizeof(TPhysAddr));
sl@0
   258
			break;
sl@0
   259
			}
sl@0
   260
sl@0
   261
		case RPageMove::EControlTryMovingPageTable:
sl@0
   262
			{
sl@0
   263
			TPhysAddr newAddr;
sl@0
   264
			r = Epoc::MovePhysicalPage((TPhysAddr) a1, newAddr, Epoc::ERamDefragPage_PageTable);
sl@0
   265
			if (newAddr != KPhysAddrInvalid)
sl@0
   266
				r = KErrGeneral;
sl@0
   267
			break;
sl@0
   268
			}
sl@0
   269
sl@0
   270
		case RPageMove::EControlTryMovingPageTableInfo:
sl@0
   271
			{
sl@0
   272
			TPhysAddr newAddr;
sl@0
   273
			r = Epoc::MovePhysicalPage((TPhysAddr) a1, newAddr, Epoc::ERamDefragPage_PageTableInfo);
sl@0
   274
			if (newAddr != KPhysAddrInvalid)
sl@0
   275
				r = KErrGeneral;
sl@0
   276
			break;
sl@0
   277
			}
sl@0
   278
sl@0
   279
		case RPageMove::EControlNumberOfCpus:
sl@0
   280
			r = NKern::NumberOfCpus();
sl@0
   281
			break;
sl@0
   282
		default:
sl@0
   283
			r=KErrNotSupported;
sl@0
   284
			break;
sl@0
   285
		}
sl@0
   286
	NKern::ThreadLeaveCS();
sl@0
   287
	if (r!=KErrNone)
sl@0
   288
		DBG(Kern::Printf("DPageMove::Request returns %d", r));
sl@0
   289
	return r;
sl@0
   290
	}
sl@0
   291
sl@0
   292
TInt DPageMove::DoPageMove(TLinAddr aAddr, TBool aEchoOff)
sl@0
   293
	{
sl@0
   294
	DBG(Kern::Printf("DPageMove::DoPageMove() addr=%08x",aAddr));
sl@0
   295
	aAddr = _ALIGN_DOWN(aAddr, iPageSize);
sl@0
   296
sl@0
   297
	TPhysAddr aOld = Epoc::LinearToPhysical(aAddr);
sl@0
   298
	TInt r;
sl@0
   299
	if (aOld == KPhysAddrInvalid)
sl@0
   300
		r=KErrArgument;
sl@0
   301
	else
sl@0
   302
		{
sl@0
   303
		TPhysAddr aNew;
sl@0
   304
		r=Epoc::MovePhysicalPage(aOld, aNew);
sl@0
   305
		if (r==KErrNone)
sl@0
   306
			{
sl@0
   307
			TPhysAddr aNewCheck = Epoc::LinearToPhysical(aAddr);
sl@0
   308
			if (aNewCheck != aNew)
sl@0
   309
				{
sl@0
   310
				if (!aEchoOff)
sl@0
   311
					Kern::Printf("Address mismatch: expected %08x actual %08x\n",aNew,aNewCheck);
sl@0
   312
				if (aNew != KPhysAddrInvalid && aNewCheck != KPhysAddrInvalid)
sl@0
   313
					{// The page was not paged out by the moving so don't allow 
sl@0
   314
					// addresses to differ.  If is was paged out then it may have 
sl@0
   315
					// been paged back in again but to any free page so the addresses will differ.
sl@0
   316
					r=KErrGeneral;
sl@0
   317
					}
sl@0
   318
				}
sl@0
   319
			}
sl@0
   320
		}
sl@0
   321
	if (r!=KErrNone)
sl@0
   322
		DBG(Kern::Printf("DPageMove::DoPageMove() returns %d", r));
sl@0
   323
	return r;
sl@0
   324
	}
sl@0
   325
sl@0
   326
sl@0
   327
#ifndef __MSVC6__ 	// VC6 can't cope with variable arguments in macros.
sl@0
   328
#define KERN_PRINTF(x...) Kern::Printf(x)
sl@0
   329
#endif
sl@0
   330
sl@0
   331
//#define EXTRA_TRACE
sl@0
   332
#ifdef EXTRA_TRACE
sl@0
   333
#define PRINTF(x)	x
sl@0
   334
#else
sl@0
   335
#define PRINTF(x)
sl@0
   336
#endif
sl@0
   337
sl@0
   338
sl@0
   339
TInt DPageMove::KernelDataMovePerformance(void)
sl@0
   340
{
sl@0
   341
	const TInt KHeapPagesToMove = 2000;
sl@0
   342
	const TInt KMoveAttempts = 50;
sl@0
   343
	const TInt KStackSize=1024;
sl@0
   344
	enum TKMoveMode
sl@0
   345
		{
sl@0
   346
		EKMoveHeap,
sl@0
   347
		EKMoveStack,
sl@0
   348
		EKMoveModes,
sl@0
   349
		};
sl@0
   350
sl@0
   351
	TInt r = KErrNone;
sl@0
   352
sl@0
   353
	// Create some kernel stack pages
sl@0
   354
	TUint8 stackArray[KStackSize];
sl@0
   355
sl@0
   356
	/// Create some kernel heap pages
sl@0
   357
	TUint actualHeapPages = KHeapPagesToMove;
sl@0
   358
	TInt heapArraySize = iPageSize * KHeapPagesToMove;
sl@0
   359
	TUint8* heapArray = new TUint8[heapArraySize];
sl@0
   360
	if (heapArray == NULL)
sl@0
   361
		return KErrNoMemory;
sl@0
   362
	
sl@0
   363
	TInt i = 0;
sl@0
   364
	for (; i < heapArraySize; i++)
sl@0
   365
		{
sl@0
   366
		heapArray[i] = i;
sl@0
   367
		}
sl@0
   368
sl@0
   369
	PRINTF(KERN_PRINTF("Testing Performance of Moving Kernel Data Pages"));
sl@0
   370
sl@0
   371
	TInt moveMode = EKMoveStack;
sl@0
   372
	for (; moveMode < EKMoveModes; moveMode++)
sl@0
   373
		{
sl@0
   374
		TLinAddr pageAddr = NULL;
sl@0
   375
		TLinAddr endAddr = NULL;
sl@0
   376
		TLinAddr baseAddr = NULL;
sl@0
   377
		switch (moveMode)
sl@0
   378
			{
sl@0
   379
			case EKMoveHeap:
sl@0
   380
				pageAddr = _ALIGN_DOWN((TLinAddr)heapArray, iPageSize);
sl@0
   381
				baseAddr = pageAddr;
sl@0
   382
				endAddr = _ALIGN_UP((TLinAddr)heapArray + heapArraySize, iPageSize);
sl@0
   383
				actualHeapPages = (endAddr - baseAddr) / iPageSize;
sl@0
   384
				PRINTF(KERN_PRINTF("heap baseAddr %x endAddr %x", baseAddr, endAddr));
sl@0
   385
				break;
sl@0
   386
sl@0
   387
			case EKMoveStack:
sl@0
   388
				pageAddr = _ALIGN_DOWN((TLinAddr)stackArray, iPageSize);
sl@0
   389
				baseAddr = pageAddr;
sl@0
   390
				endAddr = _ALIGN_UP((TLinAddr)stackArray + KStackSize, iPageSize);
sl@0
   391
				PRINTF(KERN_PRINTF("stack baseAddr %x endAddr %x", baseAddr, endAddr));
sl@0
   392
				break;
sl@0
   393
			}
sl@0
   394
sl@0
   395
		TUint32 minTime = KMaxTUint32;
sl@0
   396
		TUint32 maxTime = 0; 
sl@0
   397
		TUint32 cummulative = 0;
sl@0
   398
		TInt iterations = KMoveAttempts;
sl@0
   399
		TInt tot = iterations;
sl@0
   400
		TUint pagesMoved = (endAddr - baseAddr) / iPageSize;
sl@0
   401
		while (iterations--)
sl@0
   402
			{
sl@0
   403
			TUint32 diff;
sl@0
   404
			TUint32 startTime=0;
sl@0
   405
			TUint32 endTime=0;
sl@0
   406
			switch (moveMode)
sl@0
   407
				{
sl@0
   408
				case EKMoveHeap:
sl@0
   409
					startTime = NKern::FastCounter(); 
sl@0
   410
				
sl@0
   411
					while (pageAddr < endAddr) 
sl@0
   412
						{
sl@0
   413
						r = DoPageMove(pageAddr);
sl@0
   414
sl@0
   415
						if (r != KErrNone)
sl@0
   416
							{
sl@0
   417
							goto exit;
sl@0
   418
							}
sl@0
   419
						pageAddr += iPageSize;
sl@0
   420
						}
sl@0
   421
					endTime = NKern::FastCounter();
sl@0
   422
					break;
sl@0
   423
			
sl@0
   424
				case EKMoveStack:
sl@0
   425
					// Normally will move same number of pages as heap to make comparison easier
sl@0
   426
					TUint i = actualHeapPages;
sl@0
   427
					startTime = NKern::FastCounter();
sl@0
   428
					for (; i > 0; i--)
sl@0
   429
						{
sl@0
   430
						while (pageAddr < endAddr) 
sl@0
   431
							{
sl@0
   432
							r = DoPageMove(pageAddr);
sl@0
   433
sl@0
   434
							if (r != KErrNone)
sl@0
   435
								{
sl@0
   436
								goto exit;
sl@0
   437
								}
sl@0
   438
							pageAddr += iPageSize;
sl@0
   439
							}
sl@0
   440
						pageAddr = baseAddr;
sl@0
   441
						}
sl@0
   442
					endTime = NKern::FastCounter();
sl@0
   443
					break;
sl@0
   444
				}
sl@0
   445
			diff = endTime - startTime;
sl@0
   446
			if (endTime < startTime) 
sl@0
   447
				{
sl@0
   448
				Kern::Printf("WARNING - fast counter overflowed. Assuming only once and continuing");
sl@0
   449
				diff = (KMaxTUint32 - startTime) + endTime;
sl@0
   450
				}
sl@0
   451
sl@0
   452
			if (diff == 0)
sl@0
   453
				{
sl@0
   454
				Kern::Printf("difference 0!");
sl@0
   455
				tot--;
sl@0
   456
				}
sl@0
   457
sl@0
   458
			if (diff > maxTime)
sl@0
   459
				maxTime = diff;
sl@0
   460
			if (diff < minTime)
sl@0
   461
				minTime = diff;
sl@0
   462
sl@0
   463
			if (cummulative + diff < cummulative)
sl@0
   464
				{
sl@0
   465
				Kern::Printf("OverFlow!!!");
sl@0
   466
				r = KErrOverflow;
sl@0
   467
				goto exit;
sl@0
   468
				}
sl@0
   469
			pageAddr = baseAddr;
sl@0
   470
			cummulative += diff;
sl@0
   471
			}
sl@0
   472
		switch (moveMode)
sl@0
   473
			{
sl@0
   474
			case EKMoveHeap:				
sl@0
   475
				if (tot != 0)
sl@0
   476
					{
sl@0
   477
					TUint average = (cummulative / tot);
sl@0
   478
					Kern::Printf("Fast counter ticks to move %d kernel heap pages: Av %d Min %d Max %d (non zero iterations = %d out of %d)", pagesMoved, average, minTime, maxTime, tot, KMoveAttempts);
sl@0
   479
					Kern::Printf("Average of %d ticks to move one page\n", average / pagesMoved);
sl@0
   480
					}
sl@0
   481
				else
sl@0
   482
					Kern::Printf("WARNING - all kernel heap page moves took 0 fast counter ticks");
sl@0
   483
				break;
sl@0
   484
			
sl@0
   485
			case EKMoveStack:
sl@0
   486
				if (tot != 0)
sl@0
   487
					{
sl@0
   488
					TUint average = (cummulative / tot);
sl@0
   489
					Kern::Printf("Fast counter ticks to move %d kernel stack pages %d times: Av %d Min %d Max %d (non zero iterations = %d out of %d)", pagesMoved, actualHeapPages, average, minTime, maxTime, tot, KMoveAttempts);
sl@0
   490
					Kern::Printf("Average of %d ticks to move one page\n", average / (pagesMoved * actualHeapPages));
sl@0
   491
					}
sl@0
   492
				else
sl@0
   493
					Kern::Printf("WARNING - all kernel stack page moves took 0 fast counter ticks");
sl@0
   494
				break;
sl@0
   495
			}
sl@0
   496
		}
sl@0
   497
sl@0
   498
	r = KErrNone;
sl@0
   499
exit:
sl@0
   500
	delete [] heapArray;
sl@0
   501
	return r;
sl@0
   502
	}
sl@0
   503
	
sl@0
   504