--- a/kerneltest/f32test/server/t_fsched.cpp Tue Aug 31 16:34:26 2010 +0300
+++ b/kerneltest/f32test/server/t_fsched.cpp Wed Sep 01 12:34:56 2010 +0100
@@ -29,11 +29,6 @@
#include "t_server.h"
#include <e32twin.h>
#include <e32cmn.h>
-#include <hal.h>
-#include "tf32testtimer.h"
-#include "f32_test_utils.h"
-using namespace F32_Test_Utils;
-
//----------------------------------------------------------------------------------------------
//! @SYMTestCaseID PBASE-T_FSCHED-0191
@@ -119,6 +114,7 @@
HBufC8* gBufSec = NULL;
TPtr8 gBufWritePtr(NULL, 0);
+const TInt KuStomS = 1000;
const TInt KOneK = 1024;
const TInt KOneMeg = KOneK * 1024;
const TInt KBigBlockSize = KOneMeg ;
@@ -135,8 +131,8 @@
TTimeIntervalMicroSeconds32 gTimeTakenBigBlock(0);
TBuf16<45> gSmallFile, gBigFile;
TInt gNextFile=0;
-
-TF32TestTimer gTestTimer;
+TTime gTime1;
+TTime gTime2;
RSemaphore gSync;
@@ -155,9 +151,6 @@
ENoThreads
};
-
-
-
/** Generates a file name of the form FFFFF*<aPos>.TXT (aLong.3)
@param aBuffer The filename will be returned here
@@ -617,30 +610,32 @@
}
+
/** Measure the time taken for a big block to be written synchronously
*/
void TimeTakenToWriteBigBlock()
{
+ TTime startTime;
+ TTime endTime;
RFile fileWrite;
TInt r = fileWrite.Replace(TheFs,gBigFile,EFileShareAny|EFileWrite|EFileWriteDirectIO);
TESTERROR(r);
// Calculate how long it takes to write a big block to be able to issue at the right time the concurrent writes
- TF32TestTimer timer;
- timer.Start();
+ startTime.HomeTime();
r = fileWrite.Write(gBufWritePtr, KBigBlockSize);
-
- timer.Stop();
-
+
+ endTime.HomeTime();
+
fileWrite.Close();
TESTERROR(r);
- gTimeTakenBigBlock = timer.TimeInMicroSeconds()/3;
-
- test.Printf(_L("\nTime spent to write the big block in isolation: %d ms\n"), TF32TestTimer::TimeInMilliSeconds(gTimeTakenBigBlock));
+ gTimeTakenBigBlock = I64LOW(endTime.MicroSecondsFrom(startTime).Int64()/3);
+
+ test.Printf(_L("\nTime spent to write the big block in isolation: %d ms\n"), gTimeTakenBigBlock.Int() / KuStomS);
}
@@ -648,44 +643,51 @@
*/
void TimeTakenToWriteBigFile(TInt aPos)
{
+ TTime startTime;
+ TTime endTime;
+
test((aPos >= 0) && (aPos <= 1));
- TF32TestTimer timer;
- timer.Start();
-
+ startTime.HomeTime();
+
WriteFile(TheFs,gBigFile, gBigFileSize, KBigBlockSize, ENoThreads);
- timer.Stop();
+ endTime.HomeTime();
- gTimeTakenBigFile = timer.Time32();
-
- test.Printf(_L("\nTime spent to write the big file in isolation: %d ms\n"), TF32TestTimer::TimeInMilliSeconds(gTimeTakenBigFile));
+ gTimeTakenBigFile = I64LOW(endTime.MicroSecondsFrom(startTime).Int64());
+
- gTotalTimeSync[aPos] = Max(TF32TestTimer::TimeInMilliSeconds(gTimeTakenBigFile), gTotalTimeSync[aPos]) ;
+ test.Printf(_L("\nTime spent to write the big file in isolation: %d ms\n"), gTimeTakenBigFile.Int() / KuStomS);
+
+ gTotalTimeSync[aPos] = Max((gTimeTakenBigFile.Int()/KuStomS), gTotalTimeSync[aPos]) ;
}
/** Measure the time taken for this file to be written asynchronously
*/
void TimeTakenToWriteBigFileAsync(TInt aPos)
{
+ TTime startTime;
+ TTime endTime;
+ TTime endTime2;
TRequestStatus status[KWaitRequestsTableSize];
RFile bigFile;
test((aPos >= 0) && (aPos <= 1));
+
+ startTime.HomeTime();
+ WriteFileAsync(TheFs, bigFile, gBigFile, gBigFileSize,KBigBlockSize,status);
+ endTime.HomeTime();
- TF32TestTimer2 timer;
- timer.Start();
- WriteFileAsync(TheFs, bigFile, gBigFile, gBigFileSize,KBigBlockSize,status);
- timer.Stop();
WaitForAll(status, gBigFileSize, KBigBlockSize);
- timer.Stop2();
- gTimeTakenBigFile = timer.Time32();
+ endTime2.HomeTime();
+
+ gTimeTakenBigFile=I64LOW(endTime.MicroSecondsFrom(startTime).Int64());
bigFile.Close();
- test.Printf(_L("\nTime to queue the blocks in isolation asynchronously: %d ms, "), timer.TimeInMilliSeconds());
- gTimeTakenBigFile = timer.Time2();
- test.Printf(_L("to actually write it: %d ms\n"), TF32TestTimer::TimeInMilliSeconds(gTimeTakenBigFile));
- gTotalTimeAsync[aPos] = Max(TF32TestTimer::TimeInMilliSeconds(gTimeTakenBigFile), gTotalTimeAsync[aPos]) ;
+ test.Printf(_L("\nTime to queue the blocks in isolation asynchronously: %d ms, "), gTimeTakenBigFile.Int() / KuStomS);
+ gTimeTakenBigFile=I64LOW(endTime2.MicroSecondsFrom(startTime).Int64());
+ test.Printf(_L("to actually write it: %d ms\n"),gTimeTakenBigFile.Int() / KuStomS);
+ gTotalTimeAsync[aPos] = Max((gTimeTakenBigFile.Int() / KuStomS), gTotalTimeAsync[aPos]) ;
}
/** Delete content of directory
@@ -723,7 +725,7 @@
TESTERROR(r);
ReadFile(fs,gSmallFile,KBlockSize, EThreadWait);
- gTestTimer.Start();
+ gTime2.HomeTime();
client.Signal();
@@ -748,7 +750,7 @@
TESTERROR(r);
ReadFile(fs,gBigFile,KBlockSize, EThreadWait);
- gTestTimer.Stop();
+ gTime2.HomeTime();
client.Signal();
@@ -773,7 +775,7 @@
TESTERROR(r);
WriteFile(fs,gSmallFile,gSmallFileSize, KBlockSize, EThreadWait);
- gTestTimer.Start();
+ gTime2.HomeTime();
client.Signal();
@@ -798,7 +800,7 @@
TESTERROR(r);
WriteFile(fs, gBigFile, gBigFileSize, KBigBlockSize, EThreadSignal);
- gTestTimer.Stop();
+ gTime1.HomeTime();
client.Signal();
@@ -823,7 +825,7 @@
TESTERROR(r);
WriteFile(fs, gSmallFile, gBigFileSize, KBigBlockSize, EThreadWait);
- gTestTimer.Stop();
+ gTime2.HomeTime();
client.Signal();
@@ -895,13 +897,19 @@
*/
void TestReadingWhileWriting()
-{
+{
+ TInt r = 0;
+ TTime time1;
+ TTime time2;
+
+ time1.HomeTime();
+
// Write the small file and take the appropriate measures
WriteFile(TheFs,gSmallFile,KBlockSize, KBlockSize, ENoThreads);
// Sync test
TBuf<20> buf=_L("Big Write");
- TInt r = gBig.Create(buf, WriteBigFile, KDefaultStackSize, KHeapSize, KMaxHeapSize, NULL);
+ r = gBig.Create(buf, WriteBigFile, KDefaultStackSize, KHeapSize, KMaxHeapSize, NULL);
TEST(r == KErrNone);
buf = _L("Small Read");
@@ -917,13 +925,15 @@
gBig.Close();
gSmall.Close();
- TTimeIntervalMicroSeconds timeTaken = gTestTimer.Time();
- test.Printf(_L("\nSync read done %d ms before the write ended\n"), TF32TestTimer::TimeInMilliSeconds(timeTaken));
+
+ TTimeIntervalMicroSeconds timeTaken = gTime1.MicroSecondsFrom(gTime2);
+ test.Printf(_L("\nSync read done %d ms before the write ended\n"),I64LOW(timeTaken.Int64() / KuStomS));
+ TReal time=I64LOW(timeTaken.Int64() / KuStomS);
#if !defined(__WINS__)
- // If this condition fails, it means that writing the sync file while
- // fairscheduling a small sync read takes too long. Reading small file
- // should complete first.
- test(timeTaken > 0);
+ // If this condition fails, means that writing the sync file while fairscheduling a small sync read takes too long
+ test.Printf(_L("time: %f\n"), time);
+// test((time > 0) && (((gTotalTimeSync[0]-time)>0) || ((gTotalTimeSync[1]-time)>0)) );
+ test(time > 0);
#endif
// Async test
@@ -935,27 +945,25 @@
ReadFileAsync(TheFs, smallFile, gSmallFile, KBlockSize, status2 );
WaitForAll(status2,KBlockSize , KBlockSize );
-
- TF32TestTimer timer;
- timer.Start();
+ time1.HomeTime();
WaitForAll(status,gBigFileSize, KBigBlockSize);
- timer.Stop();
+ time2.HomeTime();
bigFile.Close();
smallFile.Close();
- timeTaken = timer.Time();
+ timeTaken = time2.MicroSecondsFrom(time1);
- test.Printf(_L("\nAsync read done %d ms before the write ended\n"), timer.TimeInMilliSeconds());
+ test.Printf(_L("\nAsync read done %d ms before the write ended\n"),I64LOW(timeTaken.Int64() / KuStomS));
+ time = I64LOW(timeTaken.Int64() / KuStomS);
#if !defined(__WINS__)
- if (!Is_HVFS(TheFs, gDrive))
- {
- // If this condition fails, it means that writing the async file while fairscheduling a small async read takes too long
+ // If this condition fails, means that writing the async file while fairscheduling a small async read takes too long
+ test.Printf(_L("time: %f\n"), time);
test.Printf(_L("gTotalTimeAsync[0] = %d , gTotalTimeAsync[1] = %d\n"),gTotalTimeAsync[0],gTotalTimeAsync[1] );
- test(timeTaken > 0);
- }
+// test((time > 0) && (((gTotalTimeAsync[0]-time)>0) || ((gTotalTimeAsync[1]-time)>0)) );
+ test(time > 0);
#endif
}
@@ -965,6 +973,8 @@
void TestWritingWhileWriting()
{
TInt r = 0;
+ TTime time1;
+ TTime time2;
// Sync test
TBuf<20> buf = _L("Big Write II");
@@ -984,12 +994,14 @@
gBig.Close();
gSmall.Close();
- TTimeIntervalMicroSeconds timeTaken = gTestTimer.Time();
- test.Printf(_L("\nSync write done %d ms before the big write ended\n"), gTestTimer.TimeInMilliSeconds());
+ TTimeIntervalMicroSeconds timeTaken = gTime1.MicroSecondsFrom(gTime2);
+ test.Printf(_L("\nSync write done %d ms before the big write ended\n"),I64LOW(timeTaken.Int64() / KuStomS));
+ TReal time=I64LOW(timeTaken.Int64() / KuStomS);
#if !defined(__WINS__)
- // If this condition fails, it means that writing the sync file while
- // fairscheduling a small sync write takes too long
- test(timeTaken > 0);
+ // If this condition fails, means that writing the sync file while fairscheduling a small sync write takes too long
+ test.Printf(_L("time: %f\n"), time);
+// test((time > 0) && (((gTotalTimeSync[0]-time)>0) || ((gTotalTimeSync[1]-time)>0)) );
+ test(time > 0);
#endif
// Async test
@@ -1000,20 +1012,19 @@
WriteFileAsync(TheFs, bigFile, gBigFile, gBigFileSize, KBigBlockSize, status);
WriteFileAsync(TheFs,smallFile, gSmallFile,gSmallFileSize,KBlockSize,status2);
WaitForAll(status2,gSmallFileSize, KBlockSize);
- TF32TestTimer timer;
- timer.Start();
+ time1.HomeTime();
WaitForAll(status, gBigFileSize, KBigBlockSize);
- timer.Stop();
+ time2.HomeTime();
- timeTaken = timer.Time();
- test.Printf(_L("\nAsync write done %d ms before the big write ended\n"),timer.TimeInMilliSeconds());
+ timeTaken = time2.MicroSecondsFrom(time1);
+ test.Printf(_L("\nAsync write done %d ms before the big write ended\n"),I64LOW(timeTaken.Int64() / KuStomS));
+ time=I64LOW(timeTaken.Int64() / KuStomS);
#if !defined(__WINS__)
- if (!Is_HVFS(TheFs, gDrive))
- {
- // If this condition fails, it means that writing the async file while fairscheduling a small async write takes too long
+ // If this condition fails, means that writing the async file while fairscheduling a small async write takes too long
+ test.Printf(_L("time: %f\n"), time);
test.Printf(_L("gTotalTimeAsync[0] = %d , gTotalTimeAsync[1] = %d\n"),gTotalTimeAsync[0],gTotalTimeAsync[1] );
- test(timeTaken > 0);
- }
+// test((time > 0) && (((gTotalTimeAsync[0]-time)>0) || ((gTotalTimeAsync[1]-time)>0)) );
+ test(time > 0);
#endif
bigFile.Close();
smallFile.Close();
@@ -1025,6 +1036,8 @@
void TestTwoBigOnes()
{
TInt r = 0;
+ TTime time1;
+ TTime time2;
// Sync test
TBuf<20> buf = _L("Big Write IIII");
@@ -1044,8 +1057,8 @@
gBig.Close();
gSmall.Close();
- TTimeIntervalMicroSeconds timeTaken = gTestTimer.Time();
- test.Printf(_L("\nSync first write ended %d ms before the second write ended (same file size)\n"),TF32TestTimer::TimeInMilliSeconds(timeTaken));
+ TTimeIntervalMicroSeconds timeTaken = gTime2.MicroSecondsFrom(gTime1);
+ test.Printf(_L("\nSync first write ended %d ms before the second write ended (same file size)\n"),I64LOW(timeTaken.Int64() / KuStomS));
// Async test
TRequestStatus status[KWaitRequestsTableSize];
@@ -1055,13 +1068,12 @@
WriteFileAsync(TheFs, bigFile, gBigFile, gBigFileSize, KBigBlockSize, status);
WriteFileAsync(TheFs, bigFile2, gSmallFile, gBigFileSize, KBigBlockSize, status2);
WaitForAll(status, gBigFileSize, KBigBlockSize);
- TF32TestTimer timer;
- timer.Start();
+ time1.HomeTime();
WaitForAll(status2, gBigFileSize, KBigBlockSize);
- timer.Stop();
+ time2.HomeTime();
- timeTaken = timer.Time();
- test.Printf(_L("\nAsync first write ended %d ms before the second write ended (same file size)\n"),TF32TestTimer::TimeInMilliSeconds(timeTaken));
+ timeTaken = time2.MicroSecondsFrom(time1);
+ test.Printf(_L("\nAsync first write ended %d ms before the second write ended (same file size)\n"),I64LOW(timeTaken.Int64() / KuStomS));
bigFile.Close();
bigFile2.Close();
}
@@ -1072,9 +1084,9 @@
void TestReadingWhileWritingSameFile()
{
TInt r = 0;
- TF32TestTimer timer;
+ TTime time1;
- timer.Start();
+ time1.HomeTime();
// Sync test
TBuf<20> buf = _L("Big Write IV");
@@ -1094,8 +1106,8 @@
CLOSE_AND_WAIT(gBig);
CLOSE_AND_WAIT(gSmall);
- TTimeIntervalMicroSeconds timeTaken = gTestTimer.Time();
- test.Printf(_L("\nSync write finished %d ms before the read ended\n"),TF32TestTimer::TimeInMilliSeconds(timeTaken));
+ TTimeIntervalMicroSeconds timeTaken = gTime2.MicroSecondsFrom(gTime1);
+ test.Printf(_L("\nSync write finished %d ms before the read ended\n"),I64LOW(timeTaken.Int64() / KuStomS));
}
@@ -1265,7 +1277,7 @@
TBool simulatelockFailureMode = EFalse;
r = controlIo(TheFs, gDrive, KControlIoSimulateLockFailureMode, simulatelockFailureMode);
- test_Value(r, r == KErrNone || r == KErrNotSupported);
+ test (r == KErrNone || r == KErrNotSupported);
#endif
// FileNames/File generation
@@ -1324,9 +1336,9 @@
TestWriteOrder();
// Format the drive to make sure no blocks are left to be erased in LFFS
- if (!Is_Win32(TheFs, gDrive))
+ #if !defined(__WINS__)
Format(gDrive);
-
+ #endif
r = TheFs.MkDirAll(gSessionPath);
TimeTakenToWriteBigFile(1);
@@ -1354,7 +1366,7 @@
// turn lock failure mode back ON (if cache is enabled)
simulatelockFailureMode = ETrue;
r = controlIo(TheFs, gDrive, KControlIoSimulateLockFailureMode, simulatelockFailureMode);
- test_Value(r, r == KErrNone || r == KErrNotSupported);
+ test (r == KErrNone || r == KErrNotSupported);
#endif
test.End();
@@ -1399,7 +1411,7 @@
TInt r = TheFs.Volume(volInfo, gDrive);
TESTERROR(r);
- gMediaSize = volInfo.iFree;
+ gMediaSize = volInfo.iSize;
gSmallFileSize = KBlockSize;
gBigFileSize = KBlockSize*20;
@@ -1493,9 +1505,10 @@
test.Printf(_L("%c: Media corruption; previous test may have aborted; else, check hardware\n"), (TUint)gDrive + 'A');
}
TESTERROR(r);
-
- if (!Is_Win32(TheFs, gDrive) && (volInfo.iDrive.iMediaAtt & KMediaAttFormattable))
+#if !defined(__WINS__)
+ if ((volInfo.iDrive.iMediaAtt & KMediaAttFormattable))
Format(gDrive);
+#endif
if(CheckForDiskSize())
{