os/kernelhwsrv/kerneltest/f32test/bench/t_fcachebm.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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
// f32test/bench/t_fcachebm.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <f32file.h>
sl@0
    19
#include <e32test.h>
sl@0
    20
#include <e32math.h>
sl@0
    21
#include "t_select.h"
sl@0
    22
#include "t_benchmain.h"
sl@0
    23
sl@0
    24
//----------------------------------------------------------------------------------------------
sl@0
    25
//! @SYMTestCaseID      PBASE-T_RCACHE-0192
sl@0
    26
//! @SYMTestType        CIT
sl@0
    27
//! @SYMPREQ            PREQ914
sl@0
    28
//! @SYMTestCaseDesc    This test case is testing performance of the File Server Cache.  
sl@0
    29
//! @SYMTestActions     0   setup the environment to execute the tests
sl@0
    30
//!						1	small random reads/writes
sl@0
    31
//!						2	large sequential reads/writes
sl@0
    32
//!						3 	streaming test (100, 200 and 500 kbps)
sl@0
    33
//! @SYMTestExpectedResults Finishes if the system behaves as expected, panics otherwise
sl@0
    34
//! @SYMTestPriority        High
sl@0
    35
//! @SYMTestStatus          Implemented
sl@0
    36
//----------------------------------------------------------------------------------------------
sl@0
    37
sl@0
    38
sl@0
    39
GLDEF_D RTest test(_L("File Cache BM"));
sl@0
    40
sl@0
    41
LOCAL_D RSemaphore client;
sl@0
    42
LOCAL_D const TInt KHeapSize = 0x4000;
sl@0
    43
LOCAL_D const TInt KTobps = 1000;
sl@0
    44
LOCAL_D const TInt KByte = 8;
sl@0
    45
LOCAL_D const TInt KOneSec = 1000000; // One second in microseconds
sl@0
    46
sl@0
    47
// Tests setup
sl@0
    48
LOCAL_D const TInt KSmallRow = 11;
sl@0
    49
LOCAL_D const TInt KSmallCol = 7;
sl@0
    50
LOCAL_D const TInt KSmallThreshold = 64;
sl@0
    51
LOCAL_D const TInt KSeveralTimes = 10;
sl@0
    52
sl@0
    53
LOCAL_D const TInt KLargeRow = 19;
sl@0
    54
LOCAL_D const TInt KLargeCol = 3;
sl@0
    55
sl@0
    56
LOCAL_D TInt gCurrentSpeed = 0; 
sl@0
    57
LOCAL_D TInt gCurrentBS = 0;
sl@0
    58
sl@0
    59
sl@0
    60
LOCAL_D TBuf8<4096> buf;
sl@0
    61
LOCAL_D TDriveList gDriveList;
sl@0
    62
sl@0
    63
// Concurrent thread
sl@0
    64
RThread gSpeedy;
sl@0
    65
RThread gSpeedyII;
sl@0
    66
sl@0
    67
TBuf16<25> gBaseFile;
sl@0
    68
TBuf16<25> gFileA;
sl@0
    69
TBuf16<25> gFileB;
sl@0
    70
TBuf16<25> gStreamFile;
sl@0
    71
TInt64 gMediaSize;
sl@0
    72
sl@0
    73
HBufC8* gBuf = NULL;
sl@0
    74
TPtr8 gBufReadPtr(NULL, 0);	
sl@0
    75
HBufC8* gBufSec = NULL;
sl@0
    76
TPtr8 gBufWritePtr(NULL, 0);	
sl@0
    77
sl@0
    78
sl@0
    79
HBufC8* gBufB = NULL;
sl@0
    80
TPtr8 gBufReadBPtr(NULL, 0);	
sl@0
    81
TBool gWriting = EFalse;
sl@0
    82
sl@0
    83
LOCAL_D TInt ThreadCount=0;
sl@0
    84
sl@0
    85
enum TTestState 
sl@0
    86
	{
sl@0
    87
	ENoThreads,			// No threads 
sl@0
    88
	ETwoThreadsDif,		// Accessing to different files 
sl@0
    89
	ETwoThreadsDifDif, 	// Accessing to different files, different blocksizes
sl@0
    90
	ETwoThreadsSame		// Accessing the same file
sl@0
    91
	};
sl@0
    92
sl@0
    93
sl@0
    94
/** 2 ^ b
sl@0
    95
sl@0
    96
	@param b Power 
sl@0
    97
*/
sl@0
    98
LOCAL_C TInt Pow(TInt b)
sl@0
    99
{
sl@0
   100
	return 1 << b;
sl@0
   101
}
sl@0
   102
sl@0
   103
/** Pseudo-random number generator, random enough for the purpose
sl@0
   104
sl@0
   105
	@param aMax Upper limit of the number. The interval of generated numbers is [0,aMax)
sl@0
   106
*/
sl@0
   107
LOCAL_C TInt Rand(TInt aMax) 
sl@0
   108
{
sl@0
   109
	return (Math::Random() % aMax);
sl@0
   110
}
sl@0
   111
sl@0
   112
sl@0
   113
/** Fills a buffer with character aC, aC+1, aC+2, ..., aC+32, aC, etc 
sl@0
   114
sl@0
   115
	@param aBuffer 	Buffer to fill out
sl@0
   116
	@param aLength 	Length to be filled with characters
sl@0
   117
	@param aC 		Base character to fill the buffer
sl@0
   118
*/
sl@0
   119
LOCAL_C void FillBuffer(TDes8& aBuffer, TInt aLength, TChar aC)
sl@0
   120
	{
sl@0
   121
	test (aBuffer.MaxLength() >= aLength);
sl@0
   122
	
sl@0
   123
	for(TInt i = 0; i < aLength; i++)
sl@0
   124
		{
sl@0
   125
		aBuffer.Append((i%32)+aC);
sl@0
   126
		}
sl@0
   127
	}
sl@0
   128
	
sl@0
   129
/** Send content through the RDebug for trgtest 
sl@0
   130
	not to hung, when the test is not writing
sl@0
   131
sl@0
   132
*/
sl@0
   133
LOCAL_C TInt noise(TAny* )
sl@0
   134
{
sl@0
   135
	FOREVER
sl@0
   136
	{	
sl@0
   137
		User::After(2147483647); // max value, 35 minutes, 47 seconds
sl@0
   138
		if(!gWriting)
sl@0
   139
			RDebug::Print(_L("."));
sl@0
   140
	}
sl@0
   141
}
sl@0
   142
sl@0
   143
/**  Delete content of directory
sl@0
   144
sl@0
   145
	@param aDir Directory to be emptied
sl@0
   146
*/
sl@0
   147
LOCAL_C TInt DeleteAll(TDes16& aDir) 
sl@0
   148
	{
sl@0
   149
		TBuf16<100> dir;
sl@0
   150
		CFileMan* fMan = CFileMan::NewL(TheFs);
sl@0
   151
		TInt r = 0;
sl@0
   152
		
sl@0
   153
		dir = aDir;
sl@0
   154
		dir.Append(_L("F*.*"));
sl@0
   155
		r = fMan->Delete(dir);	
sl@0
   156
sl@0
   157
		delete fMan;
sl@0
   158
		return r;
sl@0
   159
	}
sl@0
   160
sl@0
   161
sl@0
   162
/**   Creates a file of aSize KBytes
sl@0
   163
sl@0
   164
	@param aFile File name 
sl@0
   165
	@param aSize Size of the file to be created
sl@0
   166
*/
sl@0
   167
LOCAL_C void CreateFile(TDes16& aFile, TInt aSize)
sl@0
   168
{
sl@0
   169
	TInt r = 0;
sl@0
   170
	RFile file;
sl@0
   171
	
sl@0
   172
	
sl@0
   173
	r = file.Replace(TheFs, aFile, EFileShareAny|EFileWrite);
sl@0
   174
	FailIfError(r);
sl@0
   175
sl@0
   176
	TInt j = 0;
sl@0
   177
	while(j <= aSize)
sl@0
   178
		{
sl@0
   179
			r = file.Write(gBufWritePtr, KOneK);
sl@0
   180
			FailIfError(r);
sl@0
   181
			j += KOneK;
sl@0
   182
		}					
sl@0
   183
	file.Close();
sl@0
   184
}
sl@0
   185
sl@0
   186
/**   Kills the concurrent session
sl@0
   187
sl@0
   188
*/
sl@0
   189
LOCAL_C void DoTestKill()
sl@0
   190
{
sl@0
   191
	TInt r = 0;
sl@0
   192
	
sl@0
   193
	gSpeedy.Kill(KErrNone);
sl@0
   194
	FailIfError(r);
sl@0
   195
	gSpeedy.Close();	
sl@0
   196
	
sl@0
   197
	gSpeedyII.Kill(KErrNone);
sl@0
   198
	FailIfError(r);
sl@0
   199
	gSpeedyII.Close();	
sl@0
   200
}
sl@0
   201
sl@0
   202
/** Read aSize KBs from aFile file in blocks of aBlockSize bytes
sl@0
   203
sl@0
   204
	@param aFile 		Name of the file
sl@0
   205
	@param aPos			Position from where the read starts within the file
sl@0
   206
	@param aBlockSize 	Block size for the I/O operation
sl@0
   207
	@param aSize 		
sl@0
   208
*/
sl@0
   209
LOCAL_C TInt ReadFromFile(TDes16& aFile, TInt aPos, TInt aBlockSize, TInt aSize) 
sl@0
   210
{
sl@0
   211
	TInt r = 0;
sl@0
   212
	TTime startTime;
sl@0
   213
	TTime endTime;
sl@0
   214
	RFile file;
sl@0
   215
	TInt j = 0;
sl@0
   216
	TInt size = aSize * KOneK;
sl@0
   217
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
   218
sl@0
   219
	r = file.Open(TheFs,aFile,EFileShareAny|EFileRead);
sl@0
   220
	FailIfError(r);
sl@0
   221
	
sl@0
   222
	startTime.HomeTime();	
sl@0
   223
	r = file.Seek(ESeekStart, aPos);
sl@0
   224
	FailIfError(r);	
sl@0
   225
	
sl@0
   226
	while(j <= size)
sl@0
   227
		{
sl@0
   228
			r = file.Read(gBufReadPtr, aBlockSize);
sl@0
   229
			FailIfError(r);
sl@0
   230
			j += aBlockSize;
sl@0
   231
		}					
sl@0
   232
	endTime.HomeTime();
sl@0
   233
	
sl@0
   234
	file.Close();
sl@0
   235
	timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   236
	
sl@0
   237
	return I64LOW(timeTaken.Int64() / gTimeUnit);
sl@0
   238
}
sl@0
   239
sl@0
   240
/** Read aSize KBs from aFile file in blocks of aBlockSize bytes several times
sl@0
   241
sl@0
   242
	@param aFile 		Name of the file
sl@0
   243
	@param ayMax 		Maximum for the position
sl@0
   244
	@param aBlockSize 	Block size for the I/O operation
sl@0
   245
	@param aSize 		Size of the file in KB
sl@0
   246
*/
sl@0
   247
LOCAL_C TInt ReadFromFileSeveralTimes(TDes16& aFile, TInt ayMax, TInt aBlockSize, TInt aSize) 
sl@0
   248
{
sl@0
   249
	TInt r = 0;
sl@0
   250
	TTime startTime;
sl@0
   251
	TTime endTime;
sl@0
   252
	RFile file;
sl@0
   253
	TInt j = 0, i, pos;
sl@0
   254
	TInt size = aSize * KOneK;
sl@0
   255
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
   256
	TInt64 time = 0;
sl@0
   257
	
sl@0
   258
sl@0
   259
	r = file.Open(TheFs, aFile, EFileShareAny|EFileRead);
sl@0
   260
	FailIfError(r);
sl@0
   261
	
sl@0
   262
	i = 0;
sl@0
   263
	while( i < KSeveralTimes ) 
sl@0
   264
		{
sl@0
   265
		pos = Rand(Pow(ayMax - 1));
sl@0
   266
		startTime.HomeTime();	
sl@0
   267
		r = file.Seek(ESeekStart, pos); 
sl@0
   268
		FailIfError(r);	
sl@0
   269
		
sl@0
   270
		j = 0;
sl@0
   271
		while(j <= size)
sl@0
   272
			{
sl@0
   273
				r = file.Read(gBufReadPtr, aBlockSize);
sl@0
   274
				FailIfError(r);
sl@0
   275
				j += aBlockSize;
sl@0
   276
			}					
sl@0
   277
		endTime.HomeTime();
sl@0
   278
sl@0
   279
		timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   280
		time += I64LOW(timeTaken.Int64());
sl@0
   281
		i++;
sl@0
   282
		}
sl@0
   283
	
sl@0
   284
	file.Close();
sl@0
   285
	
sl@0
   286
	return I64LOW((time / gTimeUnit) / KSeveralTimes); // Overflow not expected here, since the number is not big enough
sl@0
   287
}
sl@0
   288
sl@0
   289
sl@0
   290
/** Write aSize KBs to  aFile file in blocks of aBlockSize bytes
sl@0
   291
sl@0
   292
	@param aFile 		Name of the file
sl@0
   293
	@param aPos			Position from where the read starts within the file
sl@0
   294
	@param aBlockSize 	Block size for the I/O operation
sl@0
   295
	@param aSize 		Size of the file in KB
sl@0
   296
*/
sl@0
   297
LOCAL_C TInt WriteToFile(TDes16& aFile, TInt aPos, TInt aBlockSize, TInt aSize) 
sl@0
   298
{
sl@0
   299
	TInt r = 0;
sl@0
   300
	TTime startTime;
sl@0
   301
	TTime endTime;
sl@0
   302
	RFile file;
sl@0
   303
	TInt j = 0;
sl@0
   304
	TInt size = aSize * KOneK;
sl@0
   305
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
   306
	
sl@0
   307
	r = file.Open(TheFs, aFile, EFileShareAny|EFileWrite);
sl@0
   308
	FailIfError(r);
sl@0
   309
	
sl@0
   310
	startTime.HomeTime();	
sl@0
   311
	r = file.Seek(ESeekStart, aPos);
sl@0
   312
	FailIfError(r);	
sl@0
   313
	while(j <= size)
sl@0
   314
		{
sl@0
   315
			r = file.Write(gBufWritePtr, aBlockSize);
sl@0
   316
			FailIfError(r);
sl@0
   317
			j += aBlockSize;
sl@0
   318
		}					
sl@0
   319
	endTime.HomeTime();
sl@0
   320
	
sl@0
   321
	file.Close();
sl@0
   322
	timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   323
	
sl@0
   324
	return I64LOW(timeTaken.Int64() / gTimeUnit);
sl@0
   325
}
sl@0
   326
sl@0
   327
/** Write aSize KBs to  aFile file in blocks of aBlockSize bytes several times
sl@0
   328
sl@0
   329
	@param aFile 		Name of the file
sl@0
   330
	@param ayMax 		Maximum for the position
sl@0
   331
	@param aBlockSize 	Block size for the I/O operation
sl@0
   332
	@param aSize 		Size of the file in KB
sl@0
   333
*/
sl@0
   334
LOCAL_C TInt WriteToFileSeveralTimes(TDes16& aFile, TInt ayMax, TInt aBlockSize, TInt aSize) 
sl@0
   335
{
sl@0
   336
	TInt r = 0;
sl@0
   337
	TTime startTime;
sl@0
   338
	TTime endTime;
sl@0
   339
	RFile file;
sl@0
   340
	TInt i, j = 0, pos;
sl@0
   341
	TInt size = aSize * KOneK;
sl@0
   342
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
   343
	TInt64 time = 0;
sl@0
   344
	
sl@0
   345
	r = file.Open(TheFs, aFile, EFileShareAny|EFileWrite);
sl@0
   346
	FailIfError(r);
sl@0
   347
	
sl@0
   348
	i = 0;
sl@0
   349
	while( i < KSeveralTimes ) 
sl@0
   350
		{
sl@0
   351
		pos = Rand(Pow(ayMax - 1));
sl@0
   352
		startTime.HomeTime();	
sl@0
   353
		r = file.Seek(ESeekStart, pos);
sl@0
   354
		FailIfError(r);	
sl@0
   355
		
sl@0
   356
		j = 0;
sl@0
   357
		while(j <= size)
sl@0
   358
			{
sl@0
   359
				r = file.Write(gBufWritePtr, aBlockSize);
sl@0
   360
				FailIfError(r);
sl@0
   361
				j += aBlockSize;
sl@0
   362
			}					
sl@0
   363
		endTime.HomeTime();
sl@0
   364
	
sl@0
   365
		timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   366
		time += I64LOW(timeTaken.Int64());
sl@0
   367
		i++;
sl@0
   368
		}
sl@0
   369
		
sl@0
   370
	file.Close();
sl@0
   371
sl@0
   372
	return I64LOW((time / gTimeUnit) / KSeveralTimes); // Overflow not expected here, since the number is not big enough
sl@0
   373
}
sl@0
   374
sl@0
   375
/** Read small blocks in the gBaseFile
sl@0
   376
sl@0
   377
*/
sl@0
   378
LOCAL_C TInt ReadSmallBase(TAny* )
sl@0
   379
{
sl@0
   380
	RTest test(_L("test 2"));
sl@0
   381
	RFs fs;
sl@0
   382
	RFile file;
sl@0
   383
	TBuf8<1024> dummy(1024);
sl@0
   384
	TInt blockSize = 0;
sl@0
   385
	TInt randPos = 0;
sl@0
   386
	TInt i = 0;
sl@0
   387
sl@0
   388
	TInt r = fs.Connect();
sl@0
   389
	
sl@0
   390
	fs.SetSessionPath(gSessionPath);
sl@0
   391
	r = file.Open(fs, gBaseFile, EFileShareAny|EFileRead);
sl@0
   392
	client.Signal();
sl@0
   393
	
sl@0
   394
	FailIfError(r);
sl@0
   395
		
sl@0
   396
	FOREVER
sl@0
   397
	{	
sl@0
   398
			randPos = Rand(64) * KOneK ; 
sl@0
   399
			r = file.Seek(ESeekStart, randPos);
sl@0
   400
			FailIfError(r);
sl@0
   401
			blockSize = i;
sl@0
   402
			
sl@0
   403
			r = file.Read(dummy, blockSize); // Sync operation
sl@0
   404
			if(i >= 1023) i = 0;
sl@0
   405
			else i++;
sl@0
   406
	}
sl@0
   407
}
sl@0
   408
	
sl@0
   409
/** Read small blocks in gFileA
sl@0
   410
sl@0
   411
*/
sl@0
   412
LOCAL_C TInt ReadSmallA(TAny* )
sl@0
   413
{
sl@0
   414
	RTest test(_L("test 2"));
sl@0
   415
	RFs fs;
sl@0
   416
	RFile file;
sl@0
   417
	TInt blockSize = 0;
sl@0
   418
	TInt randPos = 0;
sl@0
   419
	TBuf8<1024> dummy(1024);
sl@0
   420
	TInt i = 0;
sl@0
   421
sl@0
   422
	TInt r = fs.Connect();
sl@0
   423
	
sl@0
   424
	fs.SetSessionPath(gSessionPath);
sl@0
   425
sl@0
   426
	r = file.Open(fs,gFileA,EFileShareAny|EFileRead);
sl@0
   427
	
sl@0
   428
	client.Signal();
sl@0
   429
	FailIfError(r);
sl@0
   430
	
sl@0
   431
	FOREVER
sl@0
   432
	{	
sl@0
   433
			randPos = Rand(64) * KOneK ; 
sl@0
   434
			r = file.Seek(ESeekStart, randPos);
sl@0
   435
			FailIfError(r);
sl@0
   436
			
sl@0
   437
			blockSize = i;
sl@0
   438
			
sl@0
   439
			r = file.Read(dummy, blockSize); // Sync operation
sl@0
   440
			FailIfError(r);
sl@0
   441
			if(i >= 1023) i = 0;
sl@0
   442
			else i++;
sl@0
   443
	}
sl@0
   444
}
sl@0
   445
	
sl@0
   446
/** Read small blocks in gFileB
sl@0
   447
sl@0
   448
*/
sl@0
   449
LOCAL_C TInt ReadSmallB(TAny* )
sl@0
   450
	{
sl@0
   451
	RTest test(_L("test 2"));
sl@0
   452
	RFs fs;
sl@0
   453
	RFile file;
sl@0
   454
	TBuf8<1024> dummy(1024);
sl@0
   455
	TInt blockSize = 0;
sl@0
   456
	TInt randPos = 0;
sl@0
   457
	TInt i = 0;
sl@0
   458
sl@0
   459
	TInt r = fs.Connect();
sl@0
   460
	
sl@0
   461
	fs.SetSessionPath(gSessionPath);
sl@0
   462
	r = file.Open(fs, gFileB, EFileShareAny|EFileRead);
sl@0
   463
	
sl@0
   464
	client.Signal();
sl@0
   465
	FailIfError(r);
sl@0
   466
	
sl@0
   467
	FOREVER
sl@0
   468
	{
sl@0
   469
		randPos = Rand(64) * KOneK ; 
sl@0
   470
		r = file.Seek(ESeekStart, randPos);
sl@0
   471
		FailIfError(r);
sl@0
   472
		blockSize = i;
sl@0
   473
		
sl@0
   474
		r = file.Read(dummy, blockSize); // Sync operation
sl@0
   475
		FailIfError(r);
sl@0
   476
		if(i >= 1023) i = 0;
sl@0
   477
		else i++;
sl@0
   478
	}
sl@0
   479
}
sl@0
   480
sl@0
   481
sl@0
   482
/** Read large blocks in gBaseFile
sl@0
   483
sl@0
   484
*/
sl@0
   485
LOCAL_C TInt ReadLargeBase(TAny* )
sl@0
   486
	{
sl@0
   487
	RTest test(_L("test 2"));
sl@0
   488
	RFs fs;
sl@0
   489
	RFile file;
sl@0
   490
	TInt pos = 0;
sl@0
   491
	TInt blockSize = 128 * KOneK;
sl@0
   492
	
sl@0
   493
	TInt r = fs.Connect();
sl@0
   494
	
sl@0
   495
	fs.SetSessionPath(gSessionPath);
sl@0
   496
	r = file.Open(fs,gBaseFile,EFileShareAny|EFileRead);
sl@0
   497
	
sl@0
   498
	client.Signal();
sl@0
   499
	FailIfError(r);
sl@0
   500
	
sl@0
   501
	FOREVER
sl@0
   502
	{	
sl@0
   503
			r = file.Seek(ESeekStart, pos);
sl@0
   504
			FailIfError(r);
sl@0
   505
			
sl@0
   506
			r = file.Read(gBufReadBPtr, blockSize); // Sync operation
sl@0
   507
			FailIfError(r);
sl@0
   508
	}
sl@0
   509
}
sl@0
   510
sl@0
   511
/** Read large blocks in gFileA
sl@0
   512
sl@0
   513
*/
sl@0
   514
LOCAL_C TInt ReadLargeA(TAny* )
sl@0
   515
{
sl@0
   516
	RTest test(_L("test 2"));
sl@0
   517
	RFs fs;
sl@0
   518
	RFile file;
sl@0
   519
	TInt blockSize = 128 * KOneK;
sl@0
   520
	TInt pos = 0;
sl@0
   521
sl@0
   522
	TInt r = fs.Connect();
sl@0
   523
sl@0
   524
	fs.SetSessionPath(gSessionPath);
sl@0
   525
	
sl@0
   526
	r = file.Open(fs,gFileA,EFileShareAny|EFileRead);
sl@0
   527
	
sl@0
   528
	client.Signal();
sl@0
   529
	FailIfError(r);
sl@0
   530
		
sl@0
   531
	FOREVER
sl@0
   532
	{	
sl@0
   533
		r = file.Seek(ESeekStart, pos);
sl@0
   534
		FailIfError(r);
sl@0
   535
		
sl@0
   536
		r = file.Read(gBufReadBPtr, blockSize); // Sync operation
sl@0
   537
		FailIfError(r);
sl@0
   538
	}
sl@0
   539
}
sl@0
   540
	
sl@0
   541
/** Read large blocks in gFileB
sl@0
   542
sl@0
   543
*/
sl@0
   544
LOCAL_C TInt ReadLargeB(TAny* )
sl@0
   545
{
sl@0
   546
	RTest test(_L("test 2"));
sl@0
   547
	RFs fs;
sl@0
   548
	RFile file;
sl@0
   549
	TInt blockSize = 128 * KOneK;
sl@0
   550
	TInt pos = 0;
sl@0
   551
sl@0
   552
	TInt r=fs.Connect();
sl@0
   553
	FailIfError(r);
sl@0
   554
	
sl@0
   555
	fs.SetSessionPath(gSessionPath);
sl@0
   556
sl@0
   557
	r = file.Open(fs,gFileB,EFileShareAny|EFileRead);
sl@0
   558
sl@0
   559
	client.Signal();
sl@0
   560
	FailIfError(r);
sl@0
   561
	
sl@0
   562
	FOREVER
sl@0
   563
	{
sl@0
   564
		r = file.Seek(ESeekStart, pos);
sl@0
   565
		FailIfError(r);
sl@0
   566
		
sl@0
   567
		r = file.Read(gBufReadBPtr, blockSize); // Sync operation
sl@0
   568
		FailIfError(r);
sl@0
   569
	}
sl@0
   570
}
sl@0
   571
sl@0
   572
/** Small reads from a file
sl@0
   573
 
sl@0
   574
	@param xMax 	Maximum position on the x axe
sl@0
   575
	@param yMax		Maximum position on the y axe
sl@0
   576
	@param aCase	Type of test. Possible values:
sl@0
   577
		 - ENoThreads : isolated
sl@0
   578
		 - ETwoThreadsSame : with two threads accessing same file
sl@0
   579
		 - ETwoThreadsDif : with two threads accessing dif. files 
sl@0
   580
*/
sl@0
   581
LOCAL_C void smallReads(TInt xMax, TInt yMax, TTestState aCase)
sl@0
   582
	{	
sl@0
   583
	TInt i = 0;
sl@0
   584
	TInt j = 0;
sl@0
   585
	TInt r = 0;
sl@0
   586
	TInt timeRes = 0;
sl@0
   587
	
sl@0
   588
	CreateFile(gBaseFile, Pow(yMax-1));
sl@0
   589
	
sl@0
   590
	if(aCase == ETwoThreadsSame) 
sl@0
   591
		{ // Start two different threads accessing the same file
sl@0
   592
		TBuf<20> buf = _L("Speedy");
sl@0
   593
		buf.AppendNum(ThreadCount++);
sl@0
   594
		r = gSpeedy.Create(buf, ReadSmallBase, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   595
		FailIfError(r);
sl@0
   596
		
sl@0
   597
		buf = _L("Speedy");
sl@0
   598
		buf.AppendNum(ThreadCount++);
sl@0
   599
		
sl@0
   600
		r = gSpeedyII.Create(buf, ReadSmallBase, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   601
		FailIfError(r);
sl@0
   602
		
sl@0
   603
		gSpeedy.Resume();
sl@0
   604
		gSpeedyII.Resume();
sl@0
   605
sl@0
   606
		client.Wait();
sl@0
   607
		client.Wait();
sl@0
   608
		}
sl@0
   609
	
sl@0
   610
	if(aCase == ETwoThreadsDif)
sl@0
   611
		{ // Start two different threads accessing different files
sl@0
   612
		CreateFile(gFileA, Pow(yMax-1));
sl@0
   613
		CreateFile(gFileB, Pow(yMax-1));
sl@0
   614
		
sl@0
   615
		TBuf<20> buf = _L("Speedy");
sl@0
   616
		buf.AppendNum(ThreadCount++);
sl@0
   617
		r = gSpeedy.Create(buf, ReadSmallA, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   618
		FailIfError(r);
sl@0
   619
		
sl@0
   620
		buf = _L("Speedy");
sl@0
   621
		buf.AppendNum(ThreadCount++);
sl@0
   622
		
sl@0
   623
		r = gSpeedyII.Create(buf, ReadSmallB, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   624
		FailIfError(r);
sl@0
   625
		
sl@0
   626
		gSpeedy.Resume();
sl@0
   627
		gSpeedyII.Resume();
sl@0
   628
				
sl@0
   629
		client.Wait();
sl@0
   630
		client.Wait();
sl@0
   631
		}
sl@0
   632
	
sl@0
   633
	while(i < xMax)
sl@0
   634
		{ // Actual accesses and timing to the main file
sl@0
   635
		j = 0;
sl@0
   636
		PrintResult(i + 1, j + 1, Pow(i));
sl@0
   637
		while(j < yMax) 
sl@0
   638
			{
sl@0
   639
			if(Pow(i) < KSmallThreshold) 
sl@0
   640
				{
sl@0
   641
				timeRes = ReadFromFile(gBaseFile, Rand(Pow(yMax - 1)), Pow(i), Pow(j));
sl@0
   642
				}
sl@0
   643
			else
sl@0
   644
				{ // Too small for only one time measure
sl@0
   645
				timeRes = ReadFromFileSeveralTimes(gBaseFile, yMax, Pow(i), Pow(j)); 			
sl@0
   646
				}
sl@0
   647
			
sl@0
   648
			gWriting = ETrue; 
sl@0
   649
			User::After(1000000);
sl@0
   650
sl@0
   651
			PrintResultTime(i + 1, j + 2, timeRes); 
sl@0
   652
			
sl@0
   653
			gWriting = EFalse;
sl@0
   654
			
sl@0
   655
			j++;
sl@0
   656
			}
sl@0
   657
		i++;
sl@0
   658
		}
sl@0
   659
		
sl@0
   660
	
sl@0
   661
	if((aCase == ETwoThreadsSame) || (aCase == ETwoThreadsDif))
sl@0
   662
		{ // Finish the threads
sl@0
   663
		DoTestKill();			
sl@0
   664
		}
sl@0
   665
	}
sl@0
   666
sl@0
   667
/** Large reads from a file
sl@0
   668
 
sl@0
   669
 	@param xMax 	Maximum position on the x axe
sl@0
   670
	@param yMax		Maximum position on the y axe
sl@0
   671
	@param aCase	Type of test. Possible values:
sl@0
   672
		 - ENoThreads : isolated
sl@0
   673
		 - ETwoThreadsSame : with two threads accessing same file
sl@0
   674
		 - ETwoThreadsDif : with two threads accessing dif. files 
sl@0
   675
		 - ETwoThreadsDifDif : with two threads accessing dif. files, different block sizes (big/small)
sl@0
   676
*/
sl@0
   677
LOCAL_C void largeReads(TInt xMax, TInt yMax, TTestState aCase)
sl@0
   678
{
sl@0
   679
	TInt i = 0;
sl@0
   680
	TInt j = 0;
sl@0
   681
	TInt r = 0;
sl@0
   682
	TInt timeRes = 0;
sl@0
   683
	
sl@0
   684
	CreateFile(gBaseFile, 10 * KOneK * KOneK); // 10 Mb 
sl@0
   685
	
sl@0
   686
	if(aCase == ETwoThreadsSame) 
sl@0
   687
	{ // Start two different threads accessing the same file
sl@0
   688
sl@0
   689
		TRAPD(res, gBufB = HBufC8::NewL(256 * KOneK));
sl@0
   690
		test(res == KErrNone && gBufB != NULL);
sl@0
   691
		gBufReadBPtr.Set(gBufSec->Des());
sl@0
   692
sl@0
   693
		TBuf<20> buf = _L("Speedy");
sl@0
   694
		buf.AppendNum(ThreadCount++);
sl@0
   695
		r = gSpeedy.Create(buf, ReadLargeBase, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   696
		FailIfError(r);
sl@0
   697
		
sl@0
   698
		buf = _L("Speedy");
sl@0
   699
		buf.AppendNum(ThreadCount++);
sl@0
   700
		
sl@0
   701
		r = gSpeedyII.Create(buf, ReadLargeBase, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   702
		FailIfError(r);
sl@0
   703
		
sl@0
   704
		gSpeedy.Resume();
sl@0
   705
		gSpeedyII.Resume();
sl@0
   706
sl@0
   707
		client.Wait();
sl@0
   708
		client.Wait();
sl@0
   709
	}
sl@0
   710
	
sl@0
   711
	if(aCase == ETwoThreadsDif)
sl@0
   712
	{ // Start two different threads accessing different files
sl@0
   713
	
sl@0
   714
		CreateFile(gFileA, KOneK * KOneK);
sl@0
   715
		CreateFile(gFileB, KOneK * KOneK);
sl@0
   716
		
sl@0
   717
		TRAPD(res, gBufB = HBufC8::NewL(256 * KOneK));
sl@0
   718
		test(res == KErrNone && gBufB != NULL);
sl@0
   719
		gBufReadBPtr.Set(gBufSec->Des());
sl@0
   720
		
sl@0
   721
		TBuf<20> buf = _L("Speedy");
sl@0
   722
		buf.AppendNum(ThreadCount++);
sl@0
   723
		r = gSpeedy.Create(buf, ReadLargeA, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   724
		FailIfError(r);
sl@0
   725
		
sl@0
   726
		buf = _L("Speedy");
sl@0
   727
		buf.AppendNum(ThreadCount++);
sl@0
   728
		
sl@0
   729
		r = gSpeedyII.Create(buf, ReadLargeB, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   730
		FailIfError(r);
sl@0
   731
		
sl@0
   732
		gSpeedy.Resume();
sl@0
   733
		gSpeedyII.Resume();
sl@0
   734
				
sl@0
   735
		client.Wait();
sl@0
   736
		client.Wait();
sl@0
   737
	}
sl@0
   738
	
sl@0
   739
	if(aCase == ETwoThreadsDifDif)
sl@0
   740
	{ // Start two different threads accessing different files
sl@0
   741
	
sl@0
   742
		CreateFile(gFileA, KOneK * KOneK);
sl@0
   743
		CreateFile(gFileB, KOneK * KOneK);
sl@0
   744
		
sl@0
   745
		TRAPD(res,gBufB = HBufC8::NewL(256 * KOneK));
sl@0
   746
		test(res == KErrNone && gBufB != NULL);
sl@0
   747
		gBufReadBPtr.Set(gBufSec->Des());
sl@0
   748
		
sl@0
   749
		TBuf<20> buf=_L("Speedy");
sl@0
   750
		buf.AppendNum(ThreadCount++);
sl@0
   751
		r = gSpeedy.Create(buf, ReadLargeA, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   752
		FailIfError(r);
sl@0
   753
		
sl@0
   754
		buf = _L("Speedy");
sl@0
   755
		buf.AppendNum(ThreadCount++);
sl@0
   756
		
sl@0
   757
		r = gSpeedyII.Create(buf, ReadSmallB, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   758
		FailIfError(r);
sl@0
   759
		
sl@0
   760
		gSpeedy.Resume();
sl@0
   761
		gSpeedyII.Resume();
sl@0
   762
				
sl@0
   763
		client.Wait();
sl@0
   764
		client.Wait();
sl@0
   765
	}
sl@0
   766
sl@0
   767
	i = 11;
sl@0
   768
	while(i < xMax )
sl@0
   769
	{ // Actual accesses and timing to the main file
sl@0
   770
		j = 0;
sl@0
   771
		PrintResult(i - 10, j + 1, Pow(i));
sl@0
   772
		while(j < yMax) 
sl@0
   773
		{
sl@0
   774
			TInt size=0;
sl@0
   775
			if(j == 0) 	size = 100 ; // 100 Kb
sl@0
   776
			if(j == 1) 	size = KOneK ; // 1 Mb
sl@0
   777
			if(j == 2) 	size = 10 * KOneK ; // 10 Mb
sl@0
   778
			
sl@0
   779
			timeRes = ReadFromFile(gBaseFile, 0, Pow(i), size); 
sl@0
   780
sl@0
   781
			gWriting = ETrue; 
sl@0
   782
			User::After(1000000);
sl@0
   783
sl@0
   784
			PrintResultTime(i - 10, j + 2, timeRes); 
sl@0
   785
				
sl@0
   786
			gWriting = EFalse;
sl@0
   787
sl@0
   788
			j++;
sl@0
   789
		}
sl@0
   790
		i++;
sl@0
   791
	}
sl@0
   792
	
sl@0
   793
	if((aCase == ETwoThreadsSame) || (aCase == ETwoThreadsDif) || (aCase == ETwoThreadsDifDif))
sl@0
   794
	{ // Finish the threads
sl@0
   795
		DoTestKill();			
sl@0
   796
		delete gBufB;
sl@0
   797
	}
sl@0
   798
	
sl@0
   799
}
sl@0
   800
sl@0
   801
/** Large writes to a file
sl@0
   802
 
sl@0
   803
	@param xMax 	Maximum position on the x axe
sl@0
   804
	@param yMax		Maximum position on the y axe
sl@0
   805
	@param aCase	Type of test. Possible values:
sl@0
   806
		 - ENoThreads : isolated
sl@0
   807
		 - ETwoThreadsSame : with two threads accessing same file
sl@0
   808
		 - ETwoThreadsDif : with two threads accessing dif. files 
sl@0
   809
*/
sl@0
   810
LOCAL_C void largeWrites(TInt xMax, TInt yMax, TTestState aCase)
sl@0
   811
{
sl@0
   812
	TInt i = 0;
sl@0
   813
	TInt j = 0;
sl@0
   814
	TInt r = 0;
sl@0
   815
	TInt timeRes = 0;
sl@0
   816
		
sl@0
   817
	CreateFile(gBaseFile, 10 * KOneK * KOneK); // 10 Mb 
sl@0
   818
	
sl@0
   819
	if(aCase == ETwoThreadsSame) 
sl@0
   820
	{ // Start two different threads accessing the same file
sl@0
   821
sl@0
   822
		TRAPD(res, gBufB = HBufC8::NewL(256 * KOneK));
sl@0
   823
		test(res == KErrNone && gBufB != NULL);
sl@0
   824
		gBufReadBPtr.Set(gBufSec->Des());
sl@0
   825
sl@0
   826
		TBuf<20> buf = _L("Speedy");
sl@0
   827
		buf.AppendNum(ThreadCount++);
sl@0
   828
		r = gSpeedy.Create(buf, ReadLargeBase, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   829
		FailIfError(r);
sl@0
   830
		
sl@0
   831
		buf = _L("Speedy");
sl@0
   832
		buf.AppendNum(ThreadCount++);
sl@0
   833
		
sl@0
   834
		r = gSpeedyII.Create(buf, ReadLargeBase, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   835
		FailIfError(r);
sl@0
   836
		
sl@0
   837
		gSpeedy.Resume();
sl@0
   838
		gSpeedyII.Resume();
sl@0
   839
sl@0
   840
		client.Wait();
sl@0
   841
		client.Wait();
sl@0
   842
	}
sl@0
   843
	
sl@0
   844
	if(aCase == ETwoThreadsDif)
sl@0
   845
	{ // Start two different threads accessing different files
sl@0
   846
	
sl@0
   847
		CreateFile(gFileA, KOneK * KOneK);
sl@0
   848
		CreateFile(gFileB, KOneK * KOneK);
sl@0
   849
		
sl@0
   850
		TRAPD(res, gBufB = HBufC8::NewL(256 * KOneK));
sl@0
   851
		test(res == KErrNone && gBufB != NULL);
sl@0
   852
		gBufReadBPtr.Set(gBufSec->Des());
sl@0
   853
		
sl@0
   854
		TBuf<20> buf = _L("Speedy");
sl@0
   855
		buf.AppendNum(ThreadCount++);
sl@0
   856
		r = gSpeedy.Create(buf, ReadLargeA, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   857
		FailIfError(r);
sl@0
   858
		
sl@0
   859
		buf = _L("Speedy");
sl@0
   860
		buf.AppendNum(ThreadCount++);
sl@0
   861
		
sl@0
   862
		r = gSpeedyII.Create(buf, ReadLargeB, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   863
		FailIfError(r);
sl@0
   864
		
sl@0
   865
		gSpeedy.Resume();
sl@0
   866
		gSpeedyII.Resume();
sl@0
   867
				
sl@0
   868
		client.Wait();
sl@0
   869
		client.Wait();
sl@0
   870
	}
sl@0
   871
	
sl@0
   872
	i = 11;
sl@0
   873
	while(i < xMax )
sl@0
   874
	{ // Actual accesses and timing to the main file
sl@0
   875
		j = 0;
sl@0
   876
		PrintResult(i - 10 , j + 1, Pow(i));
sl@0
   877
		while(j < yMax) 
sl@0
   878
		{
sl@0
   879
			TInt size=0;
sl@0
   880
			if(j == 0) 	size = 100 ; // 100 Kb
sl@0
   881
			if(j == 1) 	size = KOneK ; // 1 Mb
sl@0
   882
			if(j == 2) 	size = 10 * KOneK ; // 10 Mb
sl@0
   883
			timeRes = WriteToFile(gBaseFile, 0, Pow(i), size); 
sl@0
   884
			
sl@0
   885
			gWriting = ETrue; 
sl@0
   886
			User::After(1000000);
sl@0
   887
sl@0
   888
			PrintResultTime(i - 10, j + 2, timeRes); 
sl@0
   889
			
sl@0
   890
			gWriting = EFalse;			
sl@0
   891
			j++;
sl@0
   892
		}
sl@0
   893
		i++;
sl@0
   894
	}
sl@0
   895
	
sl@0
   896
	if((aCase == ETwoThreadsSame) || (aCase == ETwoThreadsDif) || (aCase == ETwoThreadsDifDif))
sl@0
   897
	{ // Finish the threads
sl@0
   898
		DoTestKill();			
sl@0
   899
		delete gBufB;
sl@0
   900
	}
sl@0
   901
	
sl@0
   902
}
sl@0
   903
sl@0
   904
/** Small writes to a file
sl@0
   905
 
sl@0
   906
	@param xMax 	Maximum position on the x axe
sl@0
   907
	@param yMax		Maximum position on the y axe
sl@0
   908
	@param aCase	Type of test. Possible values:
sl@0
   909
		 - ENoThreads : isolated
sl@0
   910
		 - ETwoThreadsSame : with two threads accessing same file
sl@0
   911
		 - ETwoThreadsDif : with two threads accessing dif. files 
sl@0
   912
*/
sl@0
   913
LOCAL_C void smallWrites(TInt xMax, TInt yMax, TTestState aCase)
sl@0
   914
{
sl@0
   915
	TInt i = 0;
sl@0
   916
	TInt j = 0;
sl@0
   917
	TInt r = 0;
sl@0
   918
	TInt timeRes = 0;
sl@0
   919
	
sl@0
   920
	CreateFile(gBaseFile, Pow(yMax-1));
sl@0
   921
	
sl@0
   922
	if(aCase == ETwoThreadsSame) 
sl@0
   923
	{ // Start two different threads accessing the same file
sl@0
   924
		TBuf<20> buf = _L("Speedy");
sl@0
   925
		buf.AppendNum(ThreadCount++);
sl@0
   926
		r = gSpeedy.Create(buf, ReadSmallBase, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   927
		FailIfError(r);
sl@0
   928
		
sl@0
   929
		buf = _L("Speedy");
sl@0
   930
		buf.AppendNum(ThreadCount++);
sl@0
   931
		
sl@0
   932
		r = gSpeedyII.Create(buf, ReadSmallBase, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   933
		FailIfError(r);
sl@0
   934
		
sl@0
   935
		gSpeedy.Resume();
sl@0
   936
		gSpeedyII.Resume();
sl@0
   937
sl@0
   938
		client.Wait();
sl@0
   939
		client.Wait();
sl@0
   940
	}
sl@0
   941
	
sl@0
   942
	if(aCase == ETwoThreadsDif)
sl@0
   943
	{ // Start two different threads accessing different files
sl@0
   944
		CreateFile(gFileA, Pow(yMax-1));
sl@0
   945
		CreateFile(gFileB, Pow(yMax-1));
sl@0
   946
		
sl@0
   947
		TBuf<20> buf = _L("Speedy");
sl@0
   948
		buf.AppendNum(ThreadCount++);
sl@0
   949
		r = gSpeedy.Create(buf, ReadSmallA, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   950
		FailIfError(r);
sl@0
   951
		
sl@0
   952
		buf = _L("Speedy");
sl@0
   953
		buf.AppendNum(ThreadCount++);
sl@0
   954
		
sl@0
   955
		r = gSpeedyII.Create(buf, ReadSmallB, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   956
		FailIfError(r);
sl@0
   957
		
sl@0
   958
		gSpeedy.Resume();
sl@0
   959
		gSpeedyII.Resume();
sl@0
   960
				
sl@0
   961
		client.Wait();
sl@0
   962
		client.Wait();
sl@0
   963
	}
sl@0
   964
	
sl@0
   965
	while(i < xMax)
sl@0
   966
	{
sl@0
   967
		j = 0;
sl@0
   968
		PrintResult(i + 1, j + 1, Pow(i));
sl@0
   969
		while(j < yMax) 
sl@0
   970
		{
sl@0
   971
			if(Pow(i) < KSmallThreshold) 
sl@0
   972
				{
sl@0
   973
				timeRes = WriteToFile(gBaseFile, Rand(Pow(yMax-1)), Pow(i), Pow(j)); 
sl@0
   974
				}
sl@0
   975
			else
sl@0
   976
				{
sl@0
   977
				timeRes = WriteToFileSeveralTimes(gBaseFile, yMax, Pow(i), Pow(j)); 
sl@0
   978
				}
sl@0
   979
							
sl@0
   980
			gWriting = ETrue; 
sl@0
   981
			User::After(1000000);
sl@0
   982
sl@0
   983
			PrintResultTime(i + 1, j + 2, timeRes); 
sl@0
   984
			
sl@0
   985
			gWriting = EFalse;
sl@0
   986
				
sl@0
   987
			j++;
sl@0
   988
		}
sl@0
   989
		i++;
sl@0
   990
	}
sl@0
   991
	
sl@0
   992
	if((aCase == ETwoThreadsSame) || (aCase == ETwoThreadsDif))
sl@0
   993
	{ // Finish the threads
sl@0
   994
		DoTestKill();
sl@0
   995
	}
sl@0
   996
	
sl@0
   997
}
sl@0
   998
sl@0
   999
/** This test benchmarks small random r/w (e.g. database access)
sl@0
  1000
sl@0
  1001
	@param aSelector Selection array for manual tests
sl@0
  1002
*/
sl@0
  1003
LOCAL_C TInt TestSmall(TAny* aSelector)
sl@0
  1004
{
sl@0
  1005
	
sl@0
  1006
	Validate(aSelector);
sl@0
  1007
	
sl@0
  1008
	// Each test case of the suite has an identifyer for parsing purposes of the results
sl@0
  1009
	gTestHarness = 7;	
sl@0
  1010
	gTestCase = 1;
sl@0
  1011
	gTimeUnit = 1;
sl@0
  1012
	
sl@0
  1013
	PrintHeaders(4, _L("t_fcachebm. Small Random r/w"));
sl@0
  1014
	
sl@0
  1015
	// Small reads
sl@0
  1016
	test.Printf(_L("#~TS_Title_%d,%d: Small reads, no threads \n"), gTestHarness, gTestCase);
sl@0
  1017
sl@0
  1018
	smallReads(KSmallRow, KSmallCol, ENoThreads); 
sl@0
  1019
sl@0
  1020
	gTestCase++;
sl@0
  1021
	test.Printf(_L("#~TS_Title_%d,%d: Small reads, threads accessing same file \n"), 
sl@0
  1022
														gTestHarness, gTestCase);
sl@0
  1023
	
sl@0
  1024
	smallReads(KSmallRow, KSmallCol, ETwoThreadsSame); 
sl@0
  1025
	
sl@0
  1026
	gTestCase++;
sl@0
  1027
	test.Printf(_L("#~TS_Title_%d,%d: Small reads, threads accessing dif files \n"),
sl@0
  1028
															 gTestHarness, gTestCase);
sl@0
  1029
	
sl@0
  1030
	smallReads(KSmallRow, KSmallCol, ETwoThreadsDif); 
sl@0
  1031
	
sl@0
  1032
	gTestCase++;
sl@0
  1033
	DeleteAll(gSessionPath);
sl@0
  1034
	
sl@0
  1035
	// Small writes test case 
sl@0
  1036
	
sl@0
  1037
	test.Printf(_L("#~TS_Title_%d,%d: Test small writes\n"), gTestHarness, gTestCase);
sl@0
  1038
sl@0
  1039
	smallWrites(KSmallRow, KSmallCol, ENoThreads); 
sl@0
  1040
sl@0
  1041
	gTestCase++;
sl@0
  1042
	test.Printf(_L("#~TS_Title_%d,%d: Small writes, threads accessing same file \n"), 
sl@0
  1043
															gTestHarness, gTestCase);
sl@0
  1044
	smallWrites(KSmallRow, KSmallCol, ETwoThreadsSame); 
sl@0
  1045
sl@0
  1046
	gTestCase++;
sl@0
  1047
	test.Printf(_L("#~TS_Title_%d,%d: Small writes, threads accessing dif files \n"),
sl@0
  1048
															 gTestHarness, gTestCase);
sl@0
  1049
	smallWrites(KSmallRow, KSmallCol, ETwoThreadsDif); 
sl@0
  1050
sl@0
  1051
	gTestCase++;
sl@0
  1052
	DeleteAll(gSessionPath);
sl@0
  1053
	test.Printf(_L("#~TestEnd_%d\n"), gTestHarness);
sl@0
  1054
	
sl@0
  1055
	return(KErrNone);
sl@0
  1056
}
sl@0
  1057
sl@0
  1058
/** This test benchmarks large sequential r/w (e.g. MM)
sl@0
  1059
sl@0
  1060
	@param aSelector Selection array for manual tests
sl@0
  1061
*/
sl@0
  1062
LOCAL_C TInt TestLarge(TAny* aSelector)
sl@0
  1063
{
sl@0
  1064
	
sl@0
  1065
	Validate(aSelector);
sl@0
  1066
sl@0
  1067
	// Each test case of the suite has an identifyer for parsing purposes of the results
sl@0
  1068
	gTestHarness = 8;	
sl@0
  1069
	gTestCase = 1;
sl@0
  1070
	gTimeUnit = 1000;
sl@0
  1071
	
sl@0
  1072
	PrintHeaders(3, _L("t_fcachebm. Large sequential r/w"));
sl@0
  1073
	
sl@0
  1074
	// Large reads
sl@0
  1075
	test.Printf(_L("#~TS_Title_%d,%d: Large sequential reads\n"), gTestHarness, gTestCase);
sl@0
  1076
	
sl@0
  1077
	largeReads(KLargeRow, KLargeCol, ENoThreads); 
sl@0
  1078
sl@0
  1079
	gTestCase++;
sl@0
  1080
	test.Printf(_L("#~TS_Title_%d,%d: Large sequential reads, threads accessing same file\n"), 
sl@0
  1081
																	gTestHarness, gTestCase);
sl@0
  1082
	largeReads(KLargeRow, KLargeCol, ETwoThreadsSame); 
sl@0
  1083
sl@0
  1084
	gTestCase++;
sl@0
  1085
	test.Printf(_L("#~TS_Title_%d,%d: Large sequential reads, threads accessing dif files\n"), 
sl@0
  1086
																	gTestHarness, gTestCase);
sl@0
  1087
	largeReads(KLargeRow, KLargeCol, ETwoThreadsDif); 
sl@0
  1088
sl@0
  1089
	gTestCase++;
sl@0
  1090
	test.Printf(_L("#~TS_Title_%d,%d: Large sequential reads, threads accessing dif files some big some small blocks\n"),
sl@0
  1091
																	gTestHarness, gTestCase);
sl@0
  1092
	largeReads(KLargeRow, KLargeCol, ETwoThreadsDifDif); 
sl@0
  1093
sl@0
  1094
	gTestCase++;
sl@0
  1095
	DeleteAll(gSessionPath);
sl@0
  1096
sl@0
  1097
	// Large writings		
sl@0
  1098
	test.Printf(_L("#~TS_Title_%d,%d: Large sequential writes\n"), gTestHarness, gTestCase);
sl@0
  1099
sl@0
  1100
	largeWrites(KLargeRow, KLargeCol, ENoThreads); 
sl@0
  1101
sl@0
  1102
	gTestCase++;
sl@0
  1103
	test.Printf(_L("#~TS_Title_%d,%d: Large sequential writes, threads accessing same file\n"), 
sl@0
  1104
																	gTestHarness, gTestCase);
sl@0
  1105
	largeWrites(KLargeRow, KLargeCol, ETwoThreadsSame); 
sl@0
  1106
sl@0
  1107
	gTestCase++;
sl@0
  1108
	test.Printf(_L("#~TS_Title_%d,%d: Large sequential writes, threads accessing dif files\n"), 
sl@0
  1109
																	gTestHarness, gTestCase);
sl@0
  1110
	largeWrites(KLargeRow, KLargeCol, ETwoThreadsDif); 
sl@0
  1111
sl@0
  1112
	gTestCase++;
sl@0
  1113
	DeleteAll(gSessionPath);
sl@0
  1114
	test.Printf(_L("#~TestEnd_%d\n"), gTestHarness);
sl@0
  1115
	
sl@0
  1116
	return(KErrNone);
sl@0
  1117
}
sl@0
  1118
sl@0
  1119
/** Writes aSize bytes of data in aBlockSize during aTime seconds 
sl@0
  1120
	if the aSize bps is not met, it fails
sl@0
  1121
sl@0
  1122
	@param f 			File to write to
sl@0
  1123
	@param aSize 		Size in bytes of data to be written 
sl@0
  1124
	@param aBlockSize 	Block size to be used
sl@0
  1125
	@param aTime 		Time during which the write has to happen in seconds 
sl@0
  1126
*/
sl@0
  1127
LOCAL_C TBool writeStr( RFile f, TInt aSize, TInt aBlockSize, TInt aTime) 
sl@0
  1128
{
sl@0
  1129
	TInt r = 0, j = 0;
sl@0
  1130
	TTime startTime, endTime;
sl@0
  1131
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
  1132
	TTimeIntervalMicroSeconds32 timeLeft(0);
sl@0
  1133
	TBool onTarget = ETrue;
sl@0
  1134
	
sl@0
  1135
	TInt time;
sl@0
  1136
sl@0
  1137
	TInt i = 0;
sl@0
  1138
	while((i < aTime) && onTarget) 
sl@0
  1139
	{
sl@0
  1140
		// If measuring the CPU time
sl@0
  1141
		
sl@0
  1142
		startTime.HomeTime();	
sl@0
  1143
		j = 0;
sl@0
  1144
		while(j < aSize)
sl@0
  1145
			{
sl@0
  1146
				r = f.Write(gBufWritePtr, aBlockSize);
sl@0
  1147
				FailIfError(r);
sl@0
  1148
				j += aBlockSize;
sl@0
  1149
			}					
sl@0
  1150
		endTime.HomeTime();
sl@0
  1151
		
sl@0
  1152
		timeTaken = endTime.MicroSecondsFrom(startTime);	
sl@0
  1153
		time = I64LOW(timeTaken.Int64());
sl@0
  1154
		if(time > KOneSec) 
sl@0
  1155
		{
sl@0
  1156
			onTarget = EFalse; 			
sl@0
  1157
		}
sl@0
  1158
		
sl@0
  1159
		timeLeft = KOneSec - time;
sl@0
  1160
		if(timeLeft.Int() >= 0) 
sl@0
  1161
		{
sl@0
  1162
			User::After(timeLeft);
sl@0
  1163
		}
sl@0
  1164
		i++;
sl@0
  1165
	}
sl@0
  1166
	
sl@0
  1167
	return onTarget;
sl@0
  1168
}
sl@0
  1169
sl@0
  1170
/** Reads streaming
sl@0
  1171
sl@0
  1172
*/
sl@0
  1173
LOCAL_C TInt ReadStream(TAny*)
sl@0
  1174
{
sl@0
  1175
	RTest test(_L("test 2"));
sl@0
  1176
	RFs fs;
sl@0
  1177
	RFile file;
sl@0
  1178
	TInt j = 0;
sl@0
  1179
	TTime startTime, endTime;
sl@0
  1180
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
  1181
	TTimeIntervalMicroSeconds32 timeLeft(0);
sl@0
  1182
	TInt time;
sl@0
  1183
	TInt size , currentPos = 0; 
sl@0
  1184
sl@0
  1185
	TInt r = fs.Connect();
sl@0
  1186
	
sl@0
  1187
	fs.SetSessionPath(gSessionPath);
sl@0
  1188
	
sl@0
  1189
	r = file.Open(fs, gStreamFile, EFileShareAny|EFileRead);
sl@0
  1190
	
sl@0
  1191
	client.Signal();
sl@0
  1192
sl@0
  1193
	FailIfError(r);
sl@0
  1194
	r = file.Size(size);
sl@0
  1195
	FailIfError(r);
sl@0
  1196
sl@0
  1197
	FOREVER
sl@0
  1198
	{
sl@0
  1199
		startTime.HomeTime();	
sl@0
  1200
		j = 0;
sl@0
  1201
		while(j < (gCurrentSpeed * KOneK))
sl@0
  1202
			{
sl@0
  1203
				r=file.Read(gBufReadPtr,gCurrentBS);
sl@0
  1204
				FailIfError(r);
sl@0
  1205
				j += gCurrentBS;
sl@0
  1206
			}					
sl@0
  1207
		endTime.HomeTime();
sl@0
  1208
		
sl@0
  1209
		timeTaken = endTime.MicroSecondsFrom(startTime);	
sl@0
  1210
		time = I64LOW(timeTaken.Int64());
sl@0
  1211
		
sl@0
  1212
		if(time > KOneSec) 
sl@0
  1213
		{
sl@0
  1214
			test.Printf(_L("Background Thread: Speed failed to be achieved: %d kbps\n"), gCurrentSpeed);			
sl@0
  1215
		}
sl@0
  1216
		
sl@0
  1217
sl@0
  1218
		
sl@0
  1219
		timeLeft = KOneSec - time;
sl@0
  1220
		User::After(timeLeft);
sl@0
  1221
		currentPos += (gCurrentSpeed * KOneK); 
sl@0
  1222
		r = file.Size(size);
sl@0
  1223
		FailIfError(r);
sl@0
  1224
		if(currentPos > size ) 
sl@0
  1225
		{
sl@0
  1226
			currentPos = 0;
sl@0
  1227
			file.Seek(ESeekStart, currentPos);
sl@0
  1228
		}
sl@0
  1229
sl@0
  1230
	}
sl@0
  1231
	
sl@0
  1232
}
sl@0
  1233
sl@0
  1234
/** Test case layout, read/write at aSpeed during aWtime and aRTime
sl@0
  1235
sl@0
  1236
	@param aSpeed 		Target speed in kbps
sl@0
  1237
	@param aBlockSize 	Block size for the I/O operation
sl@0
  1238
	@param aWTime		Writing time
sl@0
  1239
	@param aRTime 		Reading time 		
sl@0
  1240
*/
sl@0
  1241
LOCAL_C void streamIt ( TInt aSpeed, TInt aBlockSize, TInt aWTime, TInt aRTime, TInt aStep)
sl@0
  1242
{
sl@0
  1243
	TInt iSize = (aSpeed * KTobps) / KByte;  // Size in bytes
sl@0
  1244
	RFile file;
sl@0
  1245
	TInt pos = 0;
sl@0
  1246
	TInt r = 0;
sl@0
  1247
	
sl@0
  1248
	PrintResult(aStep, 1, aBlockSize);
sl@0
  1249
	
sl@0
  1250
	r = file.Replace(TheFs, gStreamFile, EFileShareAny|EFileWrite);
sl@0
  1251
	FailIfError(r);
sl@0
  1252
sl@0
  1253
	// Streaming to the media during aWTime seconds
sl@0
  1254
	if(writeStr(file, iSize, aBlockSize, aWTime))
sl@0
  1255
	{	//Pass (1)
sl@0
  1256
		PrintResult(aStep, 2, 1); 
sl@0
  1257
	}
sl@0
  1258
	else 
sl@0
  1259
	{ //Fail (0)
sl@0
  1260
		PrintResult(aStep, 2, 0); 
sl@0
  1261
	}
sl@0
  1262
	
sl@0
  1263
	// Create a different thread for reading from the beginning during aRTime
sl@0
  1264
	TBuf<20> buf = _L("Speedy");
sl@0
  1265
	buf.AppendNum(ThreadCount++);
sl@0
  1266
	
sl@0
  1267
	gCurrentSpeed = aSpeed; 
sl@0
  1268
	gCurrentBS = aBlockSize; 
sl@0
  1269
	r = gSpeedy.Create(buf, ReadStream, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
  1270
	FailIfError(r);
sl@0
  1271
sl@0
  1272
	gSpeedy.Resume();
sl@0
  1273
	client.Wait();
sl@0
  1274
sl@0
  1275
	// Keep writing during the time the other thread is reading
sl@0
  1276
	if(writeStr(file, iSize, aBlockSize, aRTime))
sl@0
  1277
	{ //Pass (1)
sl@0
  1278
		PrintResult(aStep, 3, 1); 	
sl@0
  1279
	}
sl@0
  1280
	else
sl@0
  1281
	{ //Fail (0)
sl@0
  1282
		PrintResult(aStep, 3, 0); 
sl@0
  1283
	}
sl@0
  1284
	
sl@0
  1285
	// Writing from the beginning again 
sl@0
  1286
	file.Seek(ESeekStart, pos);
sl@0
  1287
	if(writeStr(file, iSize, aBlockSize, aRTime))
sl@0
  1288
	{ //Pass (1)
sl@0
  1289
		PrintResult(aStep, 4, 1); 	
sl@0
  1290
	}
sl@0
  1291
	else
sl@0
  1292
	{ //Fail (0)
sl@0
  1293
		PrintResult(aStep, 4, 0); 
sl@0
  1294
	}
sl@0
  1295
	
sl@0
  1296
sl@0
  1297
	// Kill the thread for reading
sl@0
  1298
	gSpeedy.Kill(KErrNone);
sl@0
  1299
	FailIfError(r);
sl@0
  1300
	gSpeedy.Close();	
sl@0
  1301
	
sl@0
  1302
	file.Close();	
sl@0
  1303
}
sl@0
  1304
sl@0
  1305
/** Iterating through different blocksizes
sl@0
  1306
sl@0
  1307
	@param aSpeed Speed at which the test happens
sl@0
  1308
*/
sl@0
  1309
LOCAL_C void streaming(TInt aSpeed)
sl@0
  1310
{
sl@0
  1311
	TInt i = 9; // Pow(i) = 512 bytes
sl@0
  1312
	TInt blockSize = 0;
sl@0
  1313
	TInt testStep = 1;
sl@0
  1314
	
sl@0
  1315
	while( i < 15 ) // Pow(i) = 16 Kb
sl@0
  1316
	{
sl@0
  1317
		blockSize = Pow(i) ; 
sl@0
  1318
		streamIt(aSpeed, blockSize, 5 * 60, 15, testStep++); // 5 minutes writing , then 15 secs reading
sl@0
  1319
		i++;
sl@0
  1320
	}
sl@0
  1321
}
sl@0
  1322
sl@0
  1323
/** High level test routine. Different test cases executed
sl@0
  1324
sl@0
  1325
	@param aSelector 	Test case configuration in case of manual execution
sl@0
  1326
*/
sl@0
  1327
LOCAL_C TInt TestStreaming(TAny* aSelector)
sl@0
  1328
{
sl@0
  1329
	
sl@0
  1330
	Validate(aSelector);
sl@0
  1331
	// Each test case of the suite has an identifyer for parsing purposes of the results
sl@0
  1332
	gTestHarness = 9;	
sl@0
  1333
	gTestCase = 1;
sl@0
  1334
sl@0
  1335
sl@0
  1336
	PrintHeaders(5, _L("t_fcachebm. Streaming"));
sl@0
  1337
	
sl@0
  1338
	test.Printf(_L("#~TS_Title_%d,%d: Writing / reading at 100 kbps\n"), 
sl@0
  1339
												gTestHarness, gTestCase);
sl@0
  1340
	
sl@0
  1341
	streaming(100);
sl@0
  1342
	
sl@0
  1343
	test.Printf(_L("#~TS_Title_%d,%d: Writing / reading at 200 kbps\n"), 
sl@0
  1344
												gTestHarness, ++gTestCase);
sl@0
  1345
sl@0
  1346
	streaming(200);
sl@0
  1347
sl@0
  1348
	test.Printf(_L("#~TS_Title_%d,%d: Writing / reading at 500 kbps\n"), 
sl@0
  1349
												gTestHarness, ++gTestCase);
sl@0
  1350
sl@0
  1351
	streaming(500);
sl@0
  1352
sl@0
  1353
sl@0
  1354
	DeleteAll(gSessionPath);
sl@0
  1355
sl@0
  1356
	// Start the small random reads in the background
sl@0
  1357
	CreateFile(gBaseFile, Pow(KSmallCol-1));
sl@0
  1358
	
sl@0
  1359
	TBuf<20> buf=_L("Speedy");
sl@0
  1360
	buf.AppendNum(ThreadCount++);
sl@0
  1361
	
sl@0
  1362
	TInt r = gSpeedyII.Create(buf, ReadSmallBase, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
  1363
	FailIfError(r);
sl@0
  1364
sl@0
  1365
	gSpeedyII.Resume();
sl@0
  1366
	client.Wait();
sl@0
  1367
	
sl@0
  1368
	// Measure the throughput with background activity
sl@0
  1369
	test.Printf(_L("#~TS_Title_%d,%d: Writing / reading at 100 kbps, while small reads\n"), 
sl@0
  1370
																gTestHarness, ++gTestCase);
sl@0
  1371
sl@0
  1372
	streaming(100);	
sl@0
  1373
sl@0
  1374
	test.Printf(_L("#~TS_Title_%d,%d: Writing / reading at 200 kbps, while small reads\n"), 
sl@0
  1375
																gTestHarness, ++gTestCase);
sl@0
  1376
sl@0
  1377
	streaming(200);
sl@0
  1378
	
sl@0
  1379
	test.Printf(_L("#~TS_Title_%d,%d: Writing / reading at 500 kbps, while small reads\n"), 
sl@0
  1380
																gTestHarness, ++gTestCase);
sl@0
  1381
	
sl@0
  1382
	streaming(500);
sl@0
  1383
	
sl@0
  1384
	// Kill the small random reads and writes 
sl@0
  1385
	gSpeedyII.Kill(KErrNone);
sl@0
  1386
	FailIfError(r);
sl@0
  1387
	
sl@0
  1388
	gSpeedyII.Close();	
sl@0
  1389
	
sl@0
  1390
	DeleteAll(gSessionPath);
sl@0
  1391
sl@0
  1392
	gTestCase++;
sl@0
  1393
	test.Printf(_L("#~TestEnd_%d\n"), gTestHarness);
sl@0
  1394
	
sl@0
  1395
	return(KErrNone);
sl@0
  1396
}
sl@0
  1397
sl@0
  1398
/** It goes automatically through all the options
sl@0
  1399
sl@0
  1400
	@param aSelector Configuration in case of manual execution
sl@0
  1401
*/
sl@0
  1402
LOCAL_C TInt TestAll(TAny* aSelector)
sl@0
  1403
{
sl@0
  1404
 	TestSmall(aSelector);
sl@0
  1405
 	TestLarge(aSelector);
sl@0
  1406
 	TestStreaming(aSelector);
sl@0
  1407
sl@0
  1408
	return(KErrNone);
sl@0
  1409
}
sl@0
  1410
sl@0
  1411
/** Call all tests
sl@0
  1412
sl@0
  1413
*/
sl@0
  1414
GLDEF_C void CallTestsL()
sl@0
  1415
{
sl@0
  1416
	TBuf16<25> temp;
sl@0
  1417
	
sl@0
  1418
	TInt r=client.CreateLocal(0);
sl@0
  1419
	FailIfError(r);
sl@0
  1420
	
sl@0
  1421
	// Setting up the environment and creating the needed files
sl@0
  1422
	gSessionPath = _L("?:\\F32-TST\\");
sl@0
  1423
	gSessionPath[0] = (TText) gDriveToTest;
sl@0
  1424
	
sl@0
  1425
	FileNamesGeneration(temp, 8, 0, 1);	
sl@0
  1426
	gBaseFile = gSessionPath;
sl@0
  1427
	gBaseFile.Append(temp);
sl@0
  1428
	
sl@0
  1429
	FileNamesGeneration(temp, 8, 1, 1);	
sl@0
  1430
	gFileA = gSessionPath;
sl@0
  1431
	gFileA.Append(temp);
sl@0
  1432
	
sl@0
  1433
	FileNamesGeneration(temp, 8, 2, 1);	
sl@0
  1434
	gFileB = gSessionPath;
sl@0
  1435
	gFileB.Append(temp);
sl@0
  1436
sl@0
  1437
	FileNamesGeneration(temp, 8, 3, 1);	
sl@0
  1438
	gStreamFile = gSessionPath;
sl@0
  1439
	gStreamFile.Append(temp);
sl@0
  1440
sl@0
  1441
	TRAPD(res,gBuf = HBufC8::NewL(256 * KOneK));
sl@0
  1442
	test(res == KErrNone && gBuf != NULL);
sl@0
  1443
		
sl@0
  1444
	gBufWritePtr.Set(gBuf->Des());
sl@0
  1445
	FillBuffer(gBufWritePtr, 256 * KOneK, 'A');
sl@0
  1446
	
sl@0
  1447
	TRAPD(res2, gBufSec = HBufC8::NewL(256 * KOneK));
sl@0
  1448
	test(res2 == KErrNone && gBufSec != NULL);
sl@0
  1449
	gBufReadPtr.Set(gBufSec->Des());
sl@0
  1450
sl@0
  1451
	TVolumeInfo volInfo;
sl@0
  1452
	TInt drive;
sl@0
  1453
	
sl@0
  1454
	r = TheFs.CharToDrive(gDriveToTest,drive);
sl@0
  1455
	FailIfError(r);
sl@0
  1456
	r = TheFs.Volume(volInfo, drive);
sl@0
  1457
	FailIfError(r);
sl@0
  1458
	
sl@0
  1459
	gMediaSize = volInfo.iSize;
sl@0
  1460
	
sl@0
  1461
	FormatFat(gSessionPath[0]-'A');
sl@0
  1462
	TheFs.MkDirAll(gSessionPath);
sl@0
  1463
sl@0
  1464
	RThread noisy; 
sl@0
  1465
	TBuf<20> buf = _L("Noisy");
sl@0
  1466
	r = noisy.Create(buf, noise, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
  1467
	FailIfError(r);
sl@0
  1468
	
sl@0
  1469
	noisy.Resume();
sl@0
  1470
sl@0
  1471
	CSelectionBox* TheSelector=CSelectionBox::NewL(test.Console());
sl@0
  1472
	
sl@0
  1473
	if(gMode == 0) 
sl@0
  1474
	{ // Manual
sl@0
  1475
		gSessionPath=_L("?:\\");
sl@0
  1476
		TCallBack smallOps(TestSmall, TheSelector);
sl@0
  1477
		TCallBack largeOps(TestLarge, TheSelector);
sl@0
  1478
		TCallBack simulOps(TestStreaming, TheSelector);
sl@0
  1479
		TCallBack tAll(TestAll, TheSelector);
sl@0
  1480
		TheSelector->AddDriveSelectorL(TheFs);
sl@0
  1481
		TheSelector->AddLineL(_L("Small random r/w"), smallOps);
sl@0
  1482
		TheSelector->AddLineL(_L("Large conseq r/w"), largeOps);
sl@0
  1483
		TheSelector->AddLineL(_L("Streaming"), simulOps);
sl@0
  1484
		TheSelector->AddLineL(_L("Execute all options"), tAll);
sl@0
  1485
		TheSelector->Run();
sl@0
  1486
	}
sl@0
  1487
	else 
sl@0
  1488
	{ // Automatic
sl@0
  1489
		TestAll(TheSelector);
sl@0
  1490
	}
sl@0
  1491
	
sl@0
  1492
	DeleteAll(gSessionPath);
sl@0
  1493
			
sl@0
  1494
	client.Close();
sl@0
  1495
	delete TheSelector;
sl@0
  1496
	delete gBuf;
sl@0
  1497
	delete gBufSec;
sl@0
  1498
	noisy.Kill(KErrNone);
sl@0
  1499
	noisy.Close();	
sl@0
  1500
}