os/kernelhwsrv/kerneltest/e32test/pccd/t_med_writebm.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) 1996-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\pccd\t_med_writebm.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
*/
sl@0
    21
sl@0
    22
#define __E32TEST_EXTENSION__
sl@0
    23
sl@0
    24
#include <e32test.h>
sl@0
    25
#include <f32fsys.h>
sl@0
    26
#include <e32math.h>
sl@0
    27
sl@0
    28
/*
sl@0
    29
    SD/MMC/other media benchmark test
sl@0
    30
    Writes data to the media and prints out time taken (microseconds).
sl@0
    31
    Works on TBusLocalDrive level. May require a script to filter the results.
sl@0
    32
sl@0
    33
    Principle of operation:
sl@0
    34
    In the simple case scenario the user specifies media start and end position in bytes,
sl@0
    35
    write buffer size (window size), the number of write repetitions (optional) and write position increment.
sl@0
    36
    
sl@0
    37
    The test fills buffer with random data, writes it to the media (probably several times); prints out the time taken;
sl@0
    38
    increments or decrements window position; goto begin.  Test finishes when the window slides outside specified beginning or end media position.
sl@0
    39
sl@0
    40
    It more complex case we have 2 windows. It is useful for FAT emulation.
sl@0
    41
    
sl@0
    42
    -------------------------------------------
sl@0
    43
    Command line shall look like this:
sl@0
    44
    drv=[0..25] pos=xxx:yyy [wrep=<number>] wn=[1,2] w1sz=<number> w1pi=<number> [w2sz=<number> w2pi=<number>]
sl@0
    45
sl@0
    46
    where:
sl@0
    47
    drv=N           local drive physical number for 1st MMC slot on H2 & H4 it will be 1, see variantmediadef.h
sl@0
    48
    pos=xxx:yyy     xxx start media position, yyy end media position in bytes. The test will be writing data in the range xxx-yyy
sl@0
    49
    wrep=N          optional. Specifies how many times the window will be written to the media, just for more precise time calculation. Default is 1.
sl@0
    50
    wn=N            Number of data windows being written on the media. can be 1 or 2
sl@0
    51
    
sl@0
    52
    w1sz=N          Size of the data window #1 in bytes. Must be > 0
sl@0
    53
    w1pi=N          Media position increment for the window #1. if positive, the window will be moving from xxx to yyy (see media pos parameter); 
sl@0
    54
                    if 0, the window won't change its position; if <0, the window will be moving from yyy to xxx
sl@0
    55
sl@0
    56
    w2sz            the same for the window #2 if it is specified
sl@0
    57
    w2pi            the same for the window #2 if it is specified
sl@0
    58
sl@0
    59
    The test will finish when one of the windows slides across the media boundaries xxx of yyy. If you specify w1pi=0 or both w1pi=0 w2pi=0
sl@0
    60
    it may run forever :)
sl@0
    61
sl@0
    62
    Be careful, all information on the medium will be lost !!!
sl@0
    63
*/
sl@0
    64
sl@0
    65
RTest test(_L("MMC/SD write performance test"));
sl@0
    66
sl@0
    67
TBusLocalDrive BusLocalDrv;
sl@0
    68
RFs            Fs;
sl@0
    69
sl@0
    70
RBuf8   gWriteBuffer1;
sl@0
    71
RBuf8   gWriteBuffer2;
sl@0
    72
sl@0
    73
TInt    gLocalDrvNum = -1;       //-- LOCAL physical drive number (see Estart.txt)
sl@0
    74
TBool   gChangeFlag;
sl@0
    75
sl@0
    76
TUint   gWindowsNum = 0;         //-- number of windows being written
sl@0
    77
sl@0
    78
TUint32 gWriteBufSize1     = 0;  //-- write buffer 1 size, bytes
sl@0
    79
TInt32  gWriteGranularity1 = 0;  //-- write granularity 1 (write buffer position increment) 
sl@0
    80
sl@0
    81
TUint32 gWriteBufSize2     = 0;  //-- write buffer 2 size, bytes
sl@0
    82
TInt32  gWriteGranularity2 = 0;  //-- write granularity 2 (write buffer position increment) 
sl@0
    83
sl@0
    84
TInt64  gMediaStartPos = 0;      //-- media start position
sl@0
    85
TInt64  gMediaEndPos = 0;        //-- media end position
sl@0
    86
sl@0
    87
TUint   gNumWrites = 1;          //-- number of buffer writes to the media
sl@0
    88
sl@0
    89
sl@0
    90
//---------------------------------------------------------------------------------
sl@0
    91
sl@0
    92
void RndFillBuf(TDes8& aBuf);
sl@0
    93
sl@0
    94
//---------------------------------------------------------------------------------
sl@0
    95
sl@0
    96
/**
sl@0
    97
    The main part of the test, actually. Writes 1 or 2 buffers to the media (possibly several times) and 
sl@0
    98
    prints out the time taken.
sl@0
    99
*/
sl@0
   100
void DoWriteBMTest(void)
sl@0
   101
{
sl@0
   102
    test.Next(_L("Performing write benchmark test.\n"));
sl@0
   103
sl@0
   104
    TInt    nRes;
sl@0
   105
    TTime   timeStart;
sl@0
   106
    TTime   timeEnd;
sl@0
   107
    
sl@0
   108
    //-- if window pos increment is <0, it will move from end to the beginning position, backwards   
sl@0
   109
    TInt64 currMediaPos1 =  (gWriteGranularity1 >=0) ? gMediaStartPos : gMediaEndPos-gWriteBufSize1;
sl@0
   110
    TInt64 currMediaPos2 =  (gWriteGranularity2 >=0) ? gMediaStartPos : gMediaEndPos-gWriteBufSize2;
sl@0
   111
sl@0
   112
    if(gWindowsNum == 1) //-- we have only 1 window 
sl@0
   113
    {
sl@0
   114
        currMediaPos2 = 0;
sl@0
   115
        gWriteGranularity2 = 0;
sl@0
   116
    }
sl@0
   117
sl@0
   118
	RndFillBuf(gWriteBuffer1); 
sl@0
   119
	if(gWindowsNum == 2)
sl@0
   120
		RndFillBuf(gWriteBuffer2); 
sl@0
   121
sl@0
   122
    for(;;)
sl@0
   123
    {
sl@0
   124
        if(currMediaPos1 <0 || (currMediaPos1 + gWriteBufSize1) > gMediaEndPos)
sl@0
   125
            break;
sl@0
   126
sl@0
   127
        if(currMediaPos2 <0 || (currMediaPos2 + gWriteBufSize2) > gMediaEndPos)
sl@0
   128
            break;
sl@0
   129
sl@0
   130
        timeStart.UniversalTime(); //-- take start time
sl@0
   131
sl@0
   132
        for(TUint i=0; i<gNumWrites; ++i)
sl@0
   133
        {
sl@0
   134
            nRes = BusLocalDrv.Write(currMediaPos1, gWriteBuffer1); //-- write window 1
sl@0
   135
            test_KErrNone(nRes);
sl@0
   136
sl@0
   137
            if(gWindowsNum == 2)
sl@0
   138
            {
sl@0
   139
                nRes = BusLocalDrv.Write(currMediaPos2, gWriteBuffer2); //-- write window 2
sl@0
   140
                test_KErrNone(nRes);
sl@0
   141
            }
sl@0
   142
        }//for(TUint i=0; i<gNumWrites; ++i)
sl@0
   143
sl@0
   144
        timeEnd.UniversalTime(); //-- take end time
sl@0
   145
        
sl@0
   146
        TTimeIntervalMicroSeconds  usElapsed=timeEnd.MicroSecondsFrom(timeStart);
sl@0
   147
        TInt64 usTaken = usElapsed.Int64()/gNumWrites;
sl@0
   148
sl@0
   149
        //-- print out the result
sl@0
   150
sl@0
   151
        test.Printf(_L("~#pos:%lu:%lu, time:%d us\n"), currMediaPos1, currMediaPos2, (TInt32)usTaken);
sl@0
   152
sl@0
   153
        //-- move windows
sl@0
   154
        currMediaPos1 += gWriteGranularity1;
sl@0
   155
        currMediaPos2 += gWriteGranularity2;
sl@0
   156
    }
sl@0
   157
sl@0
   158
}
sl@0
   159
sl@0
   160
sl@0
   161
//---------------------------------------------------------------------------------
sl@0
   162
sl@0
   163
/** fill a given buffer with random bytes */
sl@0
   164
void RndFillBuf(TDes8& aBuf)
sl@0
   165
{
sl@0
   166
    static TInt64 rndSeed = Math::Random();
sl@0
   167
sl@0
   168
    //-- ?? optimise here ??
sl@0
   169
    for(TInt i=0; i<aBuf.Size(); ++i)
sl@0
   170
    {
sl@0
   171
        aBuf[i] = (TUint8)Math::Rand(rndSeed);
sl@0
   172
    }
sl@0
   173
}
sl@0
   174
sl@0
   175
sl@0
   176
//---------------------------------------------------------------------------------
sl@0
   177
sl@0
   178
/** Initialise environment */
sl@0
   179
TBool Initialise()
sl@0
   180
{
sl@0
   181
    //-- print out some parameters:
sl@0
   182
    test.Printf(_L("~#Local Drive:%d\n"), gLocalDrvNum);
sl@0
   183
    test.Printf(_L("~#MediaPos:%lu:%lu\n"), gMediaStartPos, gMediaEndPos);
sl@0
   184
    test.Printf(_L("~#WinNum:%d\n"), gWindowsNum);
sl@0
   185
    test.Printf(_L("~#NumWrites:%d\n"), gNumWrites);
sl@0
   186
    test.Printf(_L("~#Window1 sz:%d, posInc:%d \n"), gWriteBufSize1, gWriteGranularity1);
sl@0
   187
sl@0
   188
    if(gWindowsNum == 2)
sl@0
   189
    {
sl@0
   190
        test.Printf(_L("~#Window2 sz:%d, posInc:%d \n"), gWriteBufSize2, gWriteGranularity2);
sl@0
   191
    }
sl@0
   192
sl@0
   193
    
sl@0
   194
    test((gLocalDrvNum >= EDriveA) && (gLocalDrvNum <= EDriveZ));
sl@0
   195
    test(gMediaStartPos >=0 && gMediaEndPos >gMediaStartPos);
sl@0
   196
    test(gWindowsNum == 1 || gWindowsNum == 2);
sl@0
   197
    test(gWriteBufSize1 > 0);
sl@0
   198
    if(gWindowsNum == 2)
sl@0
   199
    {
sl@0
   200
        test(gWriteBufSize2 > 0);
sl@0
   201
    }
sl@0
   202
    test(gNumWrites > 0);
sl@0
   203
sl@0
   204
    
sl@0
   205
    TInt nRes;
sl@0
   206
    nRes = Fs.Connect();
sl@0
   207
    test_KErrNone(nRes);
sl@0
   208
sl@0
   209
    //-- connect to the TBusLocalDrive
sl@0
   210
    test.Printf(_L("Connecting to the PHYSICAL drive #%d\n"), gLocalDrvNum);
sl@0
   211
sl@0
   212
    nRes = BusLocalDrv.Connect(gLocalDrvNum, gChangeFlag);
sl@0
   213
    test_KErrNone(nRes);
sl@0
   214
sl@0
   215
    TLocalDriveCapsV2 info;
sl@0
   216
    TPckg<TLocalDriveCapsV2> infoPckg(info);
sl@0
   217
    nRes = BusLocalDrv.Caps(infoPckg);
sl@0
   218
    test_KErrNone(nRes);
sl@0
   219
sl@0
   220
    //-- create write buffer 1
sl@0
   221
    nRes=gWriteBuffer1.CreateMax(gWriteBufSize1);
sl@0
   222
    test_KErrNone(nRes);
sl@0
   223
sl@0
   224
sl@0
   225
    //-- create write buffer 2
sl@0
   226
    if(gWindowsNum == 2)
sl@0
   227
    {
sl@0
   228
        nRes=gWriteBuffer2.CreateMax(gWriteBufSize2);
sl@0
   229
        test_KErrNone(nRes);
sl@0
   230
    }
sl@0
   231
sl@0
   232
    return ETrue;
sl@0
   233
}
sl@0
   234
sl@0
   235
//---------------------------------------------------------------------------------
sl@0
   236
sl@0
   237
/** Finalise environment */
sl@0
   238
void Finalise(void)
sl@0
   239
{
sl@0
   240
    BusLocalDrv.Disconnect();
sl@0
   241
    BusLocalDrv.Close();
sl@0
   242
    
sl@0
   243
    gWriteBuffer1.Close();
sl@0
   244
    gWriteBuffer2.Close();
sl@0
   245
sl@0
   246
    Fs.Close();
sl@0
   247
}
sl@0
   248
sl@0
   249
sl@0
   250
/**
sl@0
   251
    Just a helper method. Looks for a given pattern in the given string and returns the rest of the found token.
sl@0
   252
    @return KErrNotFound if the aPattern wasn't found in aSrc
sl@0
   253
            KErrNone otherwise and the rest of the token in aToken
sl@0
   254
*/
sl@0
   255
TInt DoFindToken(const TDesC& aSrc, const TDesC& aPattern,TPtrC& aToken)
sl@0
   256
{
sl@0
   257
    TLex    lex(aSrc);
sl@0
   258
    TPtrC   token;
sl@0
   259
sl@0
   260
    for(;;)
sl@0
   261
    {
sl@0
   262
        lex.SkipSpace();
sl@0
   263
        token.Set(lex.NextToken());
sl@0
   264
    
sl@0
   265
        if(token.Length() == 0)
sl@0
   266
        {
sl@0
   267
            test.Printf(_L("Parameter %S not found!\n"), &aPattern);   
sl@0
   268
            return KErrNotFound;            
sl@0
   269
        }
sl@0
   270
sl@0
   271
        if(token.FindF(aPattern) == 0)
sl@0
   272
        {//-- found a requires patern, extract substring next to it
sl@0
   273
            aToken.Set(token.Right(token.Length() - aPattern.Length()));
sl@0
   274
            break;
sl@0
   275
        }
sl@0
   276
sl@0
   277
sl@0
   278
    }
sl@0
   279
sl@0
   280
    return KErrNone;
sl@0
   281
}
sl@0
   282
sl@0
   283
sl@0
   284
/**
sl@0
   285
    Parse the command line, which shall look like:
sl@0
   286
    drv=[0..25] pos=xxx:yyy [wrep=<number>] wn=[1,2] w1sz=<number> w1pi=<number> [w2sz=<number> w2pi=<number>]
sl@0
   287
*/
sl@0
   288
TBool ParseCommandLine(void)
sl@0
   289
{
sl@0
   290
    TBuf<0x100> cmdLine;
sl@0
   291
    User::CommandLine(cmdLine);
sl@0
   292
sl@0
   293
    cmdLine.LowerCase();
sl@0
   294
sl@0
   295
    test.Printf(_L("Command line:\n"));   
sl@0
   296
    test.Printf(cmdLine);   
sl@0
   297
    test.Printf(_L("\n"));   
sl@0
   298
sl@0
   299
    TLex lexParam;
sl@0
   300
sl@0
   301
    TInt    nVal;
sl@0
   302
    TUint   uVal;
sl@0
   303
    TInt    nRes;
sl@0
   304
    
sl@0
   305
    TPtrC   token;
sl@0
   306
    
sl@0
   307
    //-- process "drv" parameter. It shall look like: "drv=1"
sl@0
   308
    //-- this is a physical number of a local drive
sl@0
   309
    if(DoFindToken(cmdLine, _L("drv="), token) != KErrNone)
sl@0
   310
        return  EFalse;
sl@0
   311
sl@0
   312
    lexParam.Assign(token);
sl@0
   313
    lexParam.SkipSpace();
sl@0
   314
    nRes = lexParam.Val(nVal);
sl@0
   315
    if(nRes!= KErrNone || nVal < EDriveA || nVal > EDriveZ)
sl@0
   316
    {
sl@0
   317
            test.Printf(_L("Invalid 'drv' parameter value!\n"));   
sl@0
   318
            return EFalse;
sl@0
   319
    }
sl@0
   320
sl@0
   321
    gLocalDrvNum = nVal;
sl@0
   322
sl@0
   323
sl@0
   324
    //-- process "pos" parameter It shall look like: "pos=xxx:yyy" where "xxx" is a start media position, "yyy" end media position
sl@0
   325
    //-- It specifies start and end media position
sl@0
   326
    if(DoFindToken(cmdLine, _L("pos="), token) != KErrNone)
sl@0
   327
        return  EFalse;
sl@0
   328
sl@0
   329
    lexParam.Assign(token);
sl@0
   330
    lexParam.SkipSpace();
sl@0
   331
sl@0
   332
    TInt64 startPos;
sl@0
   333
    TInt64 endPos;
sl@0
   334
                
sl@0
   335
    //-- start media position
sl@0
   336
    nRes = lexParam.Val(startPos);
sl@0
   337
    if(nRes!= KErrNone || startPos< 0)
sl@0
   338
    {
sl@0
   339
        test.Printf(_L("invalid start 'pos' value!\n"));   
sl@0
   340
        return EFalse;
sl@0
   341
    }
sl@0
   342
sl@0
   343
    //-- delimiter
sl@0
   344
    lexParam.SkipSpace();
sl@0
   345
    if(lexParam.Get() != ':')
sl@0
   346
    {
sl@0
   347
        test.Printf(_L("invalid 'pos' parameter!\n"));   
sl@0
   348
        return EFalse;
sl@0
   349
    }
sl@0
   350
sl@0
   351
    //-- end media position
sl@0
   352
    lexParam.SkipSpace();
sl@0
   353
    nRes = lexParam.Val(endPos);
sl@0
   354
    if(nRes!= KErrNone || endPos < 0)
sl@0
   355
    {
sl@0
   356
        test.Printf(_L("invalid end 'pos' value!\n"));   
sl@0
   357
        return EFalse;
sl@0
   358
    }
sl@0
   359
sl@0
   360
    gMediaStartPos = startPos;
sl@0
   361
    gMediaEndPos = endPos;
sl@0
   362
sl@0
   363
sl@0
   364
    //-- process "wn" parameter It shall look like: "wn=1" or "wn=2"
sl@0
   365
    //-- It specifies number of sliding windows.
sl@0
   366
    lexParam.SkipSpace();
sl@0
   367
    if(DoFindToken(cmdLine, _L("wn="), token) != KErrNone)
sl@0
   368
        return  EFalse;
sl@0
   369
    
sl@0
   370
    lexParam.Assign(token);
sl@0
   371
    lexParam.SkipSpace();
sl@0
   372
sl@0
   373
    nRes = lexParam.Val(uVal);
sl@0
   374
    if(nRes!= KErrNone || uVal > 2)
sl@0
   375
    {
sl@0
   376
        test.Printf(_L("wrong 'wn' parameter value, it must be 1 or 2 !\n"));   
sl@0
   377
        return EFalse;
sl@0
   378
    }
sl@0
   379
sl@0
   380
    gWindowsNum = uVal;
sl@0
   381
sl@0
   382
sl@0
   383
    //-- process "w1sz" & "w1pi" parameters. They shall look like: "w1sz=16384" & "w1pi=512"
sl@0
   384
    //-- these parameters specify size and position increment for the window 1
sl@0
   385
    //-- if w1pi <0 the window will slide from the media end position to the beginning
sl@0
   386
    lexParam.SkipSpace();
sl@0
   387
    if(DoFindToken(cmdLine, _L("w1sz="), token) != KErrNone)
sl@0
   388
        return  EFalse;
sl@0
   389
sl@0
   390
    lexParam.Assign(token);
sl@0
   391
    lexParam.SkipSpace();
sl@0
   392
sl@0
   393
    nRes = lexParam.Val(uVal);
sl@0
   394
    if(nRes!= KErrNone || uVal ==0)
sl@0
   395
    {
sl@0
   396
        test.Printf(_L("wrong 'w1sz' parameter value, it must be > 0 !\n"));   
sl@0
   397
        return EFalse;
sl@0
   398
    }
sl@0
   399
sl@0
   400
    gWriteBufSize1 = uVal;
sl@0
   401
    
sl@0
   402
sl@0
   403
    lexParam.SkipSpace();
sl@0
   404
    if(DoFindToken(cmdLine, _L("w1pi="), token) != KErrNone)
sl@0
   405
        return  EFalse;
sl@0
   406
sl@0
   407
    lexParam.Assign(token);
sl@0
   408
    lexParam.SkipSpace();
sl@0
   409
sl@0
   410
    nRes = lexParam.Val(nVal);
sl@0
   411
    if(nRes!= KErrNone)
sl@0
   412
    {
sl@0
   413
        return EFalse;
sl@0
   414
    }
sl@0
   415
sl@0
   416
    gWriteGranularity1 = nVal;
sl@0
   417
sl@0
   418
    //-- process "w2sz" & "w2pi" parameters. They shall look like: "w2sz=16384" & "w2pi=512"
sl@0
   419
    //-- these parameters specify size and position increment for the window 1
sl@0
   420
    //-- if w1pi <0 the window will slide from the media end position to the beginning
sl@0
   421
    if(gWindowsNum == 2)
sl@0
   422
    {
sl@0
   423
        lexParam.SkipSpace();
sl@0
   424
        if(DoFindToken(cmdLine, _L("w2sz="), token) != KErrNone)
sl@0
   425
            return  EFalse;
sl@0
   426
sl@0
   427
        lexParam.Assign(token);
sl@0
   428
        lexParam.SkipSpace();
sl@0
   429
sl@0
   430
        nRes = lexParam.Val(uVal);
sl@0
   431
        if(nRes!= KErrNone || uVal ==0)
sl@0
   432
        {
sl@0
   433
            test.Printf(_L("wrong 'w2sz' parameter value, it must be > 0 !\n"));   
sl@0
   434
            return EFalse;
sl@0
   435
        }
sl@0
   436
sl@0
   437
        gWriteBufSize2 = uVal;
sl@0
   438
    
sl@0
   439
sl@0
   440
        lexParam.SkipSpace();
sl@0
   441
        if(DoFindToken(cmdLine, _L("w2pi="), token) != KErrNone)
sl@0
   442
            return  EFalse;
sl@0
   443
sl@0
   444
        lexParam.Assign(token);
sl@0
   445
        lexParam.SkipSpace();
sl@0
   446
sl@0
   447
        nRes = lexParam.Val(nVal);
sl@0
   448
        if(nRes!= KErrNone)
sl@0
   449
        {
sl@0
   450
            return EFalse;
sl@0
   451
        }
sl@0
   452
sl@0
   453
        gWriteGranularity2 = nVal;
sl@0
   454
     }
sl@0
   455
    
sl@0
   456
    //-- extract wrep=<number> parameter.
sl@0
   457
    //-- it specifies how many times buffers will be written to the media
sl@0
   458
    lexParam.SkipSpace();
sl@0
   459
    if(DoFindToken(cmdLine, _L("wrep="), token) == KErrNone)
sl@0
   460
    {
sl@0
   461
    
sl@0
   462
    
sl@0
   463
    lexParam.Assign(token);
sl@0
   464
    lexParam.SkipSpace();
sl@0
   465
sl@0
   466
    nRes = lexParam.Val(uVal);
sl@0
   467
    if(nRes!= KErrNone || uVal ==0 )
sl@0
   468
    {
sl@0
   469
        test.Printf(_L("wrong 'wrep' parameter value, it must be >0 !\n"));   
sl@0
   470
        return EFalse;
sl@0
   471
    }
sl@0
   472
     
sl@0
   473
        gNumWrites = uVal;
sl@0
   474
    }
sl@0
   475
    else
sl@0
   476
    {
sl@0
   477
        gNumWrites = 1;
sl@0
   478
    }
sl@0
   479
sl@0
   480
sl@0
   481
    return ETrue;
sl@0
   482
}
sl@0
   483
sl@0
   484
void PrintInfo()
sl@0
   485
{
sl@0
   486
    test.Printf(_L("Media write benchmark test. For use mostly with mmc/sd cards.\n"));
sl@0
   487
    test.Printf(_L("Usage: See source code for command line parameters.\n"));
sl@0
   488
}
sl@0
   489
sl@0
   490
sl@0
   491
//---------------------------------------------------------------------------------
sl@0
   492
sl@0
   493
void MainL(void)
sl@0
   494
{
sl@0
   495
    test.Title();
sl@0
   496
    test.Start(_L("Start testing...\n"));
sl@0
   497
sl@0
   498
    
sl@0
   499
    //-- it will initialise global test parameters
sl@0
   500
    if(!ParseCommandLine())
sl@0
   501
    {
sl@0
   502
        PrintInfo();
sl@0
   503
        return;
sl@0
   504
    }
sl@0
   505
sl@0
   506
    if(!Initialise())
sl@0
   507
    {
sl@0
   508
        return; //-- something went wrong
sl@0
   509
    }
sl@0
   510
sl@0
   511
sl@0
   512
    DoWriteBMTest();
sl@0
   513
    
sl@0
   514
    Finalise();
sl@0
   515
    
sl@0
   516
    test.End();
sl@0
   517
}
sl@0
   518
sl@0
   519
sl@0
   520
TInt E32Main()
sl@0
   521
{
sl@0
   522
sl@0
   523
    CTrapCleanup* cleanup=CTrapCleanup::New() ; // get clean-up stack
sl@0
   524
    
sl@0
   525
    TRAPD(r,MainL());
sl@0
   526
    
sl@0
   527
    delete cleanup ; // destroy clean-up stack
sl@0
   528
    
sl@0
   529
    return r;
sl@0
   530
}
sl@0
   531
sl@0
   532
sl@0
   533