diff -r 6b6fd149daa2 -r 04ec7606545c persistentstorage/sql/OsLayer/os_symbian.cpp --- a/persistentstorage/sql/OsLayer/os_symbian.cpp Tue Apr 27 18:25:57 2010 +0300 +++ b/persistentstorage/sql/OsLayer/os_symbian.cpp Tue May 11 17:49:39 2010 +0300 @@ -360,7 +360,7 @@ { TOsCallProfile('M', "CL"), TOsCallProfile('M', "RD"), TOsCallProfile('M', "WR"), TOsCallProfile('M', "TR"), TOsCallProfile('M', "SY"), TOsCallProfile('M', "FS"), TOsCallProfile('M', "LK"), TOsCallProfile('M', "UL"), - TOsCallProfile('M', "CL"), TOsCallProfile('M', "FC"), TOsCallProfile('M', "SS"), TOsCallProfile('M', "DC"), + TOsCallProfile('M', "RL"), TOsCallProfile('M', "FC"), TOsCallProfile('M', "SS"), TOsCallProfile('M', "DC"), TOsCallProfile('M', "OP"), TOsCallProfile('M', "DE"), TOsCallProfile('M', "AC"), TOsCallProfile('M', "FN"), TOsCallProfile('M', "RN"), TOsCallProfile('M', "SL"), TOsCallProfile('M', "CT"), TOsCallProfile('M', "LE") }; @@ -371,7 +371,7 @@ { TOsCallProfile('J', "CL"), TOsCallProfile('J', "RD"), TOsCallProfile('J', "WR"), TOsCallProfile('J', "TR"), TOsCallProfile('J', "SY"), TOsCallProfile('J', "FS"), TOsCallProfile('J', "LK"), TOsCallProfile('J', "UL"), - TOsCallProfile('J', "CL"), TOsCallProfile('J', "FC"), TOsCallProfile('J', "SS"), TOsCallProfile('J', "DC"), + TOsCallProfile('J', "RL"), TOsCallProfile('J', "FC"), TOsCallProfile('J', "SS"), TOsCallProfile('J', "DC"), TOsCallProfile('J', "OP"), TOsCallProfile('J', "DE"), TOsCallProfile('J', "AC"), TOsCallProfile('J', "FN"), TOsCallProfile('J', "RN"), TOsCallProfile('J', "SL"), TOsCallProfile('J', "CT"), TOsCallProfile('J', "LE") }; @@ -384,11 +384,15 @@ //aProfileRef - a reference to the related TOsCallProfile object - TheOsCallMProfile[] or TheOsCallJProfile[] entry; //aOffset - file offset in bytes; //aBytes - amount of bytes to be read/written; - TOsCallCounter(TInt64& aOsCallTicksEntryRef, TOsCallProfile& aOsCallProfileRef, TInt64 aOffset, TInt aBytes) : + //aOptional - might be NULL. Used to print out the name of the file being processed. + TOsCallCounter(TInt64& aOsCallTicksEntryRef, TOsCallProfile& aOsCallProfileRef, TInt64 aOffset, TInt aBytes, + const sqlite3_file* aHandle, const char* aOptional) : iOsCallTicksEntryRef(aOsCallTicksEntryRef), iOsCallProfileRef(aOsCallProfileRef), iOffset(aOffset), - iBytes(aBytes) + iBytes(aBytes), + iHandle((TUint)aHandle), + iOptional((const TUint8*)aOptional) { if(TheOsCallTimeProfileEnabled) { @@ -411,8 +415,15 @@ ++iOsCallProfileRef.iCallCounter; iOsCallProfileRef.iTicksTotal += diffTicks; iOsCallProfileRef.iBytesTotal += iBytes; - // 1 2 3 4 5 6 7 8 9 10 - RDebug::Print(_L("'%c','%c%c',%d,%d,%ld,%d,%ld,%ld,%ld\n"), + TFileName fname; + if(iOptional) + { + TPtrC8 fn8(iOptional); + fname.Copy(fn8); + } + // 0 1 2 3 4 5 6 7 8 9 10 11 + RDebug::Print(_L("[SQL-OS]¬%X¬%c¬%c%c¬%d¬%d¬%ld¬%d¬%ld¬%ld¬%ld¬%S\n"), + iHandle, //0 iOsCallProfileRef.iType, //1 iOsCallProfileRef.iIdentifier[0], //2 iOsCallProfileRef.iIdentifier[1], //3 @@ -422,7 +433,8 @@ iBytes, //7 diffTicks, //8 iOsCallProfileRef.iBytesTotal, //9 - iOsCallProfileRef.iTicksTotal); //10 + iOsCallProfileRef.iTicksTotal, //10 + &fname); //11 } } } @@ -432,6 +444,8 @@ TInt64 iOffset; TInt iBytes; TUint32 iStartTicks; + TUint iHandle; + const TUint8* iOptional; }; inline TOsCallProfile& OsCallProfile(TBool aType, TInt aIndex) @@ -439,7 +453,7 @@ return aType ? TheOsCallJProfile[aIndex] : TheOsCallMProfile[aIndex]; } -# define __OSTIME_COUNTER(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes) TOsCallCounter osCallCounter(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes) +# define __OSTIME_COUNTER(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes, aHandle, aOpt) TOsCallCounter osCallCounter(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes, aHandle, aOpt) #else //_SQLPROFILER @@ -451,7 +465,7 @@ # define __OS_CALL(aOpType, a1, a2) void(0) -# define __OSTIME_COUNTER(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes) void(0) +# define __OSTIME_COUNTER(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes, aHandle, aOpt) void(0) #endif//_SQLPROFILER @@ -1483,7 +1497,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileClose, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileClose], ::OsCallProfile(dbFile.iIsJournal, EOsFileClose), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileClose], ::OsCallProfile(dbFile.iIsJournal, EOsFileClose), 0, 0, aDbFile, 0); __FS_CALL(EFsOpFileClose, 0); dbFile.iFileBuf.Close(); if(dbFile.iFullName) @@ -1525,7 +1539,7 @@ TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileRead, 0, 0); __COUNTER_INCR(TheSqlSrvProfilerFileRead); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileRead], ::OsCallProfile(dbFile.iIsJournal, EOsFileRead), aOffset, aAmt); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileRead], ::OsCallProfile(dbFile.iIsJournal, EOsFileRead), aOffset, aAmt, aDbFile, 0); TPtr8 ptr((TUint8*)aBuf, 0, aAmt); TInt err = dbFile.iFileBuf.Read(aOffset, ptr); TInt cnt = ptr.Length(); @@ -1588,7 +1602,7 @@ TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileWrite, 0, 0); __COUNTER_INCR(TheSqlSrvProfilerFileWrite); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileWrite], ::OsCallProfile(dbFile.iIsJournal, EOsFileWrite), aOffset, aAmt); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileWrite], ::OsCallProfile(dbFile.iIsJournal, EOsFileWrite), aOffset, aAmt, aDbFile, 0); TInt err = KErrAccessDenied; if(!dbFile.iReadOnly) { @@ -1642,7 +1656,7 @@ TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileTruncate, 0, 0); __COUNTER_INCR(TheSqlSrvProfilerFileSetSize); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileTruncate], ::OsCallProfile(dbFile.iIsJournal, EOsFileTruncate), aLength, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileTruncate], ::OsCallProfile(dbFile.iIsJournal, EOsFileTruncate), aLength, 0, aDbFile, 0); if(dbFile.iReadOnly) { COsLayerData::Instance().SetOsErrorCode(KErrAccessDenied); @@ -1678,7 +1692,7 @@ TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileSync, 0, 0); __COUNTER_INCR(TheSqlSrvProfilerFileSync); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileSync], ::OsCallProfile(dbFile.iIsJournal, EOsFileSync), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileSync], ::OsCallProfile(dbFile.iIsJournal, EOsFileSync), 0, 0, aDbFile, 0); if(dbFile.iReadOnly) { COsLayerData::Instance().SetOsErrorCode(KErrAccessDenied); @@ -1713,7 +1727,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileFileSize, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileSize), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileSize), 0, 0, aDbFile, 0); __FS_CALL(EFsOpFileSize, 0); TInt err = dbFile.iFileBuf.Size(*aSize); COsLayerData::Instance().SetOsErrorCode(err); @@ -1747,7 +1761,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileLock, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileLock], ::OsCallProfile(dbFile.iIsJournal, EOsFileLock), aLockType, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileLock], ::OsCallProfile(dbFile.iIsJournal, EOsFileLock), aLockType, 0, aDbFile, 0); //If there is already a lock of this type or more restrictive on the database file, do nothing. if(dbFile.iLockType >= aLockType) { @@ -1780,7 +1794,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileUnlock, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileUnlock], ::OsCallProfile(dbFile.iIsJournal, EOsFileUnlock), aLockType, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileUnlock], ::OsCallProfile(dbFile.iIsJournal, EOsFileUnlock), aLockType, 0, aDbFile, 0); dbFile.iLockType = aLockType; return SQLITE_OK; } @@ -1809,7 +1823,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileCheckReservedLock, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileCheckReservedLock], ::OsCallProfile(dbFile.iIsJournal, EOsFileCheckReservedLock), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileCheckReservedLock], ::OsCallProfile(dbFile.iIsJournal, EOsFileCheckReservedLock), 0, 0, aDbFile, 0); *aResOut = dbFile.iLockType >= SQLITE_LOCK_RESERVED ? 1 : 0; return SQLITE_OK; } @@ -1845,7 +1859,7 @@ SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KFileFileCtr, aOp)); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileFileControl, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileControl], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileControl), aOp, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileControl], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileControl), aOp, 0, aDbFile, 0); TInt err = KErrNone; switch(aOp) { @@ -1896,7 +1910,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileSectorSize, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileSectorSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileSectorSize), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileSectorSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileSectorSize), 0, 0, aDbFile, 0); __ASSERT_DEBUG(dbFile.iSectorSize > 0, User::Panic(KPanicCategory, EPanicInternalError)); if(dbFile.iSectorSize > 0) { @@ -1927,7 +1941,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileDeviceCharacteristics, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileDeviceCharacteristics], ::OsCallProfile(dbFile.iIsJournal, EOsFileDeviceCharacteristics), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileDeviceCharacteristics], ::OsCallProfile(dbFile.iIsJournal, EOsFileDeviceCharacteristics), 0, 0, aDbFile, 0); __ASSERT_DEBUG(dbFile.iDeviceCharacteristics >= 0, User::Panic(KPanicCategory, EPanicInternalError)); if(dbFile.iDeviceCharacteristics >= 0) { @@ -2218,7 +2232,7 @@ { SQLUTRACE_PROFILER(aVfs); __OS_CALL(EOsVfsOpen, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsVfsOpen], ::OsCallProfile(EFalse, EOsVfsOpen), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsVfsOpen], ::OsCallProfile(EFalse, EOsVfsOpen), 0, 0, aDbFile, aFileName); COsLayerData& osLayerData = COsLayerData::Instance(); TFileName fname; if(aFileName && !::ConvertToUnicode(aFileName, fname)) @@ -2367,7 +2381,7 @@ { SQLUTRACE_PROFILER(aVfs); __OS_CALL(EOsVfsDelete, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsVfsDelete], ::OsCallProfile(EFalse, EOsVfsDelete), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsVfsDelete], ::OsCallProfile(EFalse, EOsVfsDelete), 0, 0, 0, aFileName); COsLayerData& osLayerData = COsLayerData::Instance(); TBuf fname; if(!::ConvertToUnicode(aFileName, fname)) @@ -2415,7 +2429,7 @@ { SQLUTRACE_PROFILER(aVfs); __OS_CALL(EOsVfsAccess, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsVfsAccess], ::OsCallProfile(EFalse, EOsVfsAccess), aFlags, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsVfsAccess], ::OsCallProfile(EFalse, EOsVfsAccess), aFlags, 0, 0, aFileName); COsLayerData& osLayerData = COsLayerData::Instance(); TBuf fname; if(!::ConvertToUnicode(aFileName, fname)) @@ -2492,7 +2506,7 @@ { SQLUTRACE_PROFILER(aVfs); __OS_CALL(EOsVfsFullPathName, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsVfsFullPathName], ::OsCallProfile(EFalse, EOsVfsFullPathName), aBufLen, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsVfsFullPathName], ::OsCallProfile(EFalse, EOsVfsFullPathName), aBufLen, 0, 0, aRelative); COsLayerData& osLayerData = COsLayerData::Instance(); osLayerData.StoreFhData(NULL, EFalse); //Convert the received file name to UTF16 @@ -2539,7 +2553,7 @@ { SQLUTRACE_PROFILER(aVfs); __OS_CALL(EOsVfsRandomness, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsVfsRandomness], ::OsCallProfile(EFalse, EOsVfsRandomness), aBufLen, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsVfsRandomness], ::OsCallProfile(EFalse, EOsVfsRandomness), aBufLen, 0, 0, 0); COsLayerData& osLayerData = COsLayerData::Instance(); const TInt KRandIterations = aBufLen / sizeof(int); for(TInt i=0;i