sl@0: /** sl@0: * Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * File Name: f32test/bench/t_fat_perf.h sl@0: * Include file for t_fat_perf.cpp (PREQ 1885). sl@0: * sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: //Include Files sl@0: #include sl@0: #include sl@0: #include sl@0: #include "t_server.h" sl@0: #include "fat_utils.h" sl@0: #include "f32_test_utils.h" sl@0: sl@0: using namespace F32_Test_Utils; sl@0: using namespace Fat_Test_Utils; sl@0: sl@0: extern TInt gTestCaseNo; sl@0: sl@0: extern TFileName gPath; sl@0: extern TFileName gFileNameBase; sl@0: extern TInt gFileNo; sl@0: extern TInt gTestCase; sl@0: extern TInt gCacheClear; sl@0: extern TInt gZeroPadFileNumberForFixedLengthFileNames; sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: // Interfaces sl@0: sl@0: // File Operation Modes sl@0: enum TFileOperationMode sl@0: { sl@0: EFATPerfFileOpen, sl@0: EFATPerfFileCreate, sl@0: EFATPerfFileReplace, sl@0: EFATPerfFileDelete, sl@0: EFATPerfFileWrite, sl@0: EFATPerfFileRead, sl@0: }; sl@0: sl@0: // File Creation Options sl@0: enum TNamingConOrRan sl@0: { sl@0: EConsecutive, sl@0: ERandom, sl@0: }; sl@0: sl@0: // Standards sl@0: enum TNamingUniOrAsc sl@0: { sl@0: EAscii, sl@0: EUnicode, sl@0: }; sl@0: sl@0: // Test function names sl@0: enum TTestFunction sl@0: { sl@0: EFATPerfSetup, sl@0: EFATPerfCreate, sl@0: EFATPerfOpen, sl@0: EFATPerfDelete, sl@0: EFATPerfRead, sl@0: EFATPerfWrite, sl@0: EFATPerfDirCacheInfo, sl@0: }; sl@0: sl@0: // For DirCache info printing sl@0: // These enum values are based on enum TControlIO defined in \f32\sfat\common_constants.h sl@0: enum TDirCacheControlIOMap sl@0: { sl@0: ETestDumpFATDirCache = 15, ///<15 sl@0: ETestFATDirCacheInfo = 16, ///<16 sl@0: }; sl@0: sl@0: // File Naming schemes sl@0: class TNamingSchemeParam sl@0: { sl@0: public: sl@0: TNamingSchemeParam(); sl@0: sl@0: public: sl@0: TNamingConOrRan iConOrRan; sl@0: TNamingUniOrAsc iUniOrAsc; sl@0: TBool iZeroPadFileNumber; // Only applies to consecutive file name generation sl@0: TFileName iFileNameBase; sl@0: TUint iMaxFileNameLength; // Applies only to random name generation sl@0: TUint iMinStringLength; sl@0: }; sl@0: sl@0: class CMeasureAndLogUnit; sl@0: sl@0: // File Operation Parameters sl@0: struct TFileOpUnitParam sl@0: { sl@0: TFileName iDirName; sl@0: TNamingSchemeParam iNamingSchemeParam; sl@0: TFileOperationMode iFileOpMode; sl@0: CMeasureAndLogUnit* iMLUnitPtr; sl@0: }; sl@0: sl@0: // Directory Unit Parameters sl@0: struct TDirUnitParam sl@0: { sl@0: TUint iPriority; sl@0: TFileName iDirName; sl@0: TUint iRuns; sl@0: TUint iFilesPerRun; sl@0: TUint iSampleInterval; sl@0: TNamingSchemeParam iNamingScheme; sl@0: TFileOperationMode iFileOpMode; sl@0: }; sl@0: sl@0: struct TMLUnitParam sl@0: { sl@0: TInt iID; sl@0: }; sl@0: sl@0: struct TMLParam sl@0: { sl@0: TFileName iDirName; sl@0: TFileName iFileName; sl@0: TNamingSchemeParam iNamingScheme; sl@0: TUint iCurFileNo; sl@0: TFileOperationMode iFileOpMode; sl@0: }; sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////////// sl@0: // Module definition sl@0: sl@0: sl@0: // Measurement and Log Unit sl@0: class CMeasureAndLogUnit : CBase sl@0: { sl@0: public: sl@0: static CMeasureAndLogUnit* NewLC(const TMLUnitParam& aParam); sl@0: static CMeasureAndLogUnit* NewL(const TMLUnitParam& aParam); sl@0: ~CMeasureAndLogUnit(); sl@0: TInt MeasureStart(); sl@0: TInt MeasureEnd(); sl@0: TInt Log(const TFileName& aDirName, const TFileName& aFileName, TUint aCurrentFileNo, TUint aCurrentFilePos); sl@0: private: sl@0: CMeasureAndLogUnit(); sl@0: void ConstructL(const TMLUnitParam& aParam); sl@0: TInt DoMeasureStart(); sl@0: TInt DoMeasureEnd(); sl@0: TInt DoLog(const TFileName& aFileName, TUint aCurrentFileNo, TUint aCurrentFilePos); sl@0: sl@0: private: sl@0: TInt iID; sl@0: TUint32 iStartStatus; sl@0: TUint32 iEndStatus; sl@0: TInt iFreq; sl@0: TReal iScale; sl@0: TUint iLogItemNo; sl@0: }; sl@0: sl@0: // File Operation Unit sl@0: class CFileOperationUnit : CBase sl@0: { sl@0: public: sl@0: static CFileOperationUnit* NewLC(const TFileOpUnitParam& aParam); sl@0: static CFileOperationUnit* NewL(const TFileOpUnitParam& aParam); sl@0: ~CFileOperationUnit(); sl@0: sl@0: TInt Run(const TFileName& aDirName, const TFileName& aFileName, TBool aIsTakingMeasurement, TUint aCurFileNo, TUint aCurFilePos); sl@0: void SetMLUnit(CMeasureAndLogUnit* aMLUnit); sl@0: sl@0: private: sl@0: CFileOperationUnit(); sl@0: void ConstructL(const TFileOpUnitParam& aParam); sl@0: sl@0: private: sl@0: TFileName iDirName; sl@0: TNamingSchemeParam iNamingSchemeParam; sl@0: TFileOperationMode iFileOpMode; sl@0: CMeasureAndLogUnit* iMLUnitPtr; sl@0: RFs iRFs; sl@0: TBool iDirCreated; sl@0: }; sl@0: sl@0: sl@0: class CDirUnit : public CBase sl@0: { sl@0: public: sl@0: static CDirUnit* NewLC(const TDirUnitParam& aParam, const TChar aDriveChar); sl@0: static CDirUnit* NewL(const TDirUnitParam& aParam, const TChar aDriveChar); sl@0: ~CDirUnit(); sl@0: TInt Run(const TInt aCurPriority); sl@0: void SetMLUnit(CMeasureAndLogUnit* aMLUnit); sl@0: TInt Priority(); sl@0: const TFileName& Name(); sl@0: sl@0: private: sl@0: CDirUnit(); sl@0: void ConstructL(const TDirUnitParam& aParam, const TChar aDriveChar); sl@0: sl@0: TInt GenerateFileName(TFileName& aFileName); // uses iNameGen sl@0: TBool CheckMeasurementTaking(); // uses currentFileNo, sl@0: // totalFileNo, sl@0: // samplingInterval sl@0: TInt DoFileOperation(); sl@0: TFileName GenerateRandomString(const TUint aMinStringLength, const TUint aMaxStringLength, const TNamingUniOrAsc aUniOrAsc); sl@0: TBool FileNameIsUnique(const TFileName& aFileName); sl@0: private: sl@0: TInt iPriority; sl@0: TFileName iDirName; sl@0: TUint iRuns; sl@0: TUint iCurrentRunNo; sl@0: TUint iFilesPerRun; sl@0: TUint iCurrentFileNo; sl@0: TUint iTotalFileNo; sl@0: TUint iSampleInterval; sl@0: sl@0: TUint iNumDigitsInTotalFileNo; // The number of digits iTotalFileNo has. sl@0: // Used to zero pad the file number if iZeroPadFileNumberForFixedWidthFileNames is ETrue sl@0: sl@0: TNamingConOrRan iConOrRan; // Consecutive or random sl@0: TNamingUniOrAsc iUniOrAsc; // ASCII or Unicode sl@0: TBool iZeroPadFileNumberForFixedLengthFileNames; sl@0: TFileName iFileNameBase; sl@0: TUint iMaxFileNameLength; // Applies only to random name generation sl@0: TUint iMinStringLength; // Applies only to random name generation sl@0: sl@0: CFileOperationUnit* iFileOpUnit; sl@0: CMeasureAndLogUnit* iMLUnitPtr; sl@0: sl@0: }; sl@0: sl@0: //Execution Unit sl@0: class CExecutionUnit : public CBase sl@0: { sl@0: public: sl@0: static CExecutionUnit* NewLC(CMeasureAndLogUnit* aMLUnit, const TChar aDriveChar); sl@0: static CExecutionUnit* NewL(CMeasureAndLogUnit* aMLUnit, const TChar aDriveChar); sl@0: sl@0: ~CExecutionUnit(); sl@0: sl@0: TInt AddDirUnitL(const TDirUnitParam& aParam); sl@0: TInt RecalculateCurrentPrioirty(); sl@0: TInt Run(); sl@0: sl@0: ///For Debug sl@0: TUint ForDebug_AddrOfDirUnit(TUint aDirUnitIter); sl@0: TUint ForDebug_AddrOfDirUnitArray(); sl@0: sl@0: private: sl@0: CExecutionUnit(); sl@0: void ConstructL(CMeasureAndLogUnit* aMLUnit, const TChar aDriveChar); sl@0: sl@0: private: sl@0: // Array of CDirUnit sl@0: RPointerArray iDirUnitArray; sl@0: sl@0: // Logging Unit sl@0: CMeasureAndLogUnit* iMLUnitPtr; // no ownership sl@0: sl@0: // Current priority sl@0: TInt iCurPriority; sl@0: sl@0: TChar iDriveChar; sl@0: sl@0: }; sl@0: sl@0: /*-- EOF--*/ sl@0: sl@0: