358 //the function was used on the main database file |
358 //the function was used on the main database file |
359 TOsCallProfile TheOsCallMProfile[EOsOpLast] = |
359 TOsCallProfile TheOsCallMProfile[EOsOpLast] = |
360 { |
360 { |
361 TOsCallProfile('M', "CL"), TOsCallProfile('M', "RD"), TOsCallProfile('M', "WR"), TOsCallProfile('M', "TR"), |
361 TOsCallProfile('M', "CL"), TOsCallProfile('M', "RD"), TOsCallProfile('M', "WR"), TOsCallProfile('M', "TR"), |
362 TOsCallProfile('M', "SY"), TOsCallProfile('M', "FS"), TOsCallProfile('M', "LK"), TOsCallProfile('M', "UL"), |
362 TOsCallProfile('M', "SY"), TOsCallProfile('M', "FS"), TOsCallProfile('M', "LK"), TOsCallProfile('M', "UL"), |
363 TOsCallProfile('M', "CL"), TOsCallProfile('M', "FC"), TOsCallProfile('M', "SS"), TOsCallProfile('M', "DC"), |
363 TOsCallProfile('M', "RL"), TOsCallProfile('M', "FC"), TOsCallProfile('M', "SS"), TOsCallProfile('M', "DC"), |
364 TOsCallProfile('M', "OP"), TOsCallProfile('M', "DE"), TOsCallProfile('M', "AC"), TOsCallProfile('M', "FN"), |
364 TOsCallProfile('M', "OP"), TOsCallProfile('M', "DE"), TOsCallProfile('M', "AC"), TOsCallProfile('M', "FN"), |
365 TOsCallProfile('M', "RN"), TOsCallProfile('M', "SL"), TOsCallProfile('M', "CT"), TOsCallProfile('M', "LE") |
365 TOsCallProfile('M', "RN"), TOsCallProfile('M', "SL"), TOsCallProfile('M', "CT"), TOsCallProfile('M', "LE") |
366 }; |
366 }; |
367 |
367 |
368 //An array of TOsCallProfile entries, each entry keeps the profile of a specifc OS porting layer function, when |
368 //An array of TOsCallProfile entries, each entry keeps the profile of a specifc OS porting layer function, when |
369 //the function was used on the journal file |
369 //the function was used on the journal file |
370 TOsCallProfile TheOsCallJProfile[EOsOpLast] = |
370 TOsCallProfile TheOsCallJProfile[EOsOpLast] = |
371 { |
371 { |
372 TOsCallProfile('J', "CL"), TOsCallProfile('J', "RD"), TOsCallProfile('J', "WR"), TOsCallProfile('J', "TR"), |
372 TOsCallProfile('J', "CL"), TOsCallProfile('J', "RD"), TOsCallProfile('J', "WR"), TOsCallProfile('J', "TR"), |
373 TOsCallProfile('J', "SY"), TOsCallProfile('J', "FS"), TOsCallProfile('J', "LK"), TOsCallProfile('J', "UL"), |
373 TOsCallProfile('J', "SY"), TOsCallProfile('J', "FS"), TOsCallProfile('J', "LK"), TOsCallProfile('J', "UL"), |
374 TOsCallProfile('J', "CL"), TOsCallProfile('J', "FC"), TOsCallProfile('J', "SS"), TOsCallProfile('J', "DC"), |
374 TOsCallProfile('J', "RL"), TOsCallProfile('J', "FC"), TOsCallProfile('J', "SS"), TOsCallProfile('J', "DC"), |
375 TOsCallProfile('J', "OP"), TOsCallProfile('J', "DE"), TOsCallProfile('J', "AC"), TOsCallProfile('J', "FN"), |
375 TOsCallProfile('J', "OP"), TOsCallProfile('J', "DE"), TOsCallProfile('J', "AC"), TOsCallProfile('J', "FN"), |
376 TOsCallProfile('J', "RN"), TOsCallProfile('J', "SL"), TOsCallProfile('J', "CT"), TOsCallProfile('J', "LE") |
376 TOsCallProfile('J', "RN"), TOsCallProfile('J', "SL"), TOsCallProfile('J', "CT"), TOsCallProfile('J', "LE") |
377 }; |
377 }; |
378 |
378 |
379 //The main class for the OS porting layer call profiles. |
379 //The main class for the OS porting layer call profiles. |
382 public: |
382 public: |
383 //aOsCallTicksEntryRef - a reference to the related TheOsCallTicks[] entry; |
383 //aOsCallTicksEntryRef - a reference to the related TheOsCallTicks[] entry; |
384 //aProfileRef - a reference to the related TOsCallProfile object - TheOsCallMProfile[] or TheOsCallJProfile[] entry; |
384 //aProfileRef - a reference to the related TOsCallProfile object - TheOsCallMProfile[] or TheOsCallJProfile[] entry; |
385 //aOffset - file offset in bytes; |
385 //aOffset - file offset in bytes; |
386 //aBytes - amount of bytes to be read/written; |
386 //aBytes - amount of bytes to be read/written; |
387 TOsCallCounter(TInt64& aOsCallTicksEntryRef, TOsCallProfile& aOsCallProfileRef, TInt64 aOffset, TInt aBytes) : |
387 //aOptional - might be NULL. Used to print out the name of the file being processed. |
|
388 TOsCallCounter(TInt64& aOsCallTicksEntryRef, TOsCallProfile& aOsCallProfileRef, TInt64 aOffset, TInt aBytes, |
|
389 const sqlite3_file* aHandle, const char* aOptional) : |
388 iOsCallTicksEntryRef(aOsCallTicksEntryRef), |
390 iOsCallTicksEntryRef(aOsCallTicksEntryRef), |
389 iOsCallProfileRef(aOsCallProfileRef), |
391 iOsCallProfileRef(aOsCallProfileRef), |
390 iOffset(aOffset), |
392 iOffset(aOffset), |
391 iBytes(aBytes) |
393 iBytes(aBytes), |
|
394 iHandle((TUint)aHandle), |
|
395 iOptional((const TUint8*)aOptional) |
392 { |
396 { |
393 if(TheOsCallTimeProfileEnabled) |
397 if(TheOsCallTimeProfileEnabled) |
394 { |
398 { |
395 iStartTicks = User::FastCounter(); |
399 iStartTicks = User::FastCounter(); |
396 } |
400 } |
409 { |
413 { |
410 ++TheOpCounter; |
414 ++TheOpCounter; |
411 ++iOsCallProfileRef.iCallCounter; |
415 ++iOsCallProfileRef.iCallCounter; |
412 iOsCallProfileRef.iTicksTotal += diffTicks; |
416 iOsCallProfileRef.iTicksTotal += diffTicks; |
413 iOsCallProfileRef.iBytesTotal += iBytes; |
417 iOsCallProfileRef.iBytesTotal += iBytes; |
414 // 1 2 3 4 5 6 7 8 9 10 |
418 TFileName fname; |
415 RDebug::Print(_L("'%c','%c%c',%d,%d,%ld,%d,%ld,%ld,%ld\n"), |
419 if(iOptional) |
|
420 { |
|
421 TPtrC8 fn8(iOptional); |
|
422 fname.Copy(fn8); |
|
423 } |
|
424 // 0 1 2 3 4 5 6 7 8 9 10 11 |
|
425 RDebug::Print(_L("[SQL-OS]¬%X¬%c¬%c%c¬%d¬%d¬%ld¬%d¬%ld¬%ld¬%ld¬%S\n"), |
|
426 iHandle, //0 |
416 iOsCallProfileRef.iType, //1 |
427 iOsCallProfileRef.iType, //1 |
417 iOsCallProfileRef.iIdentifier[0], //2 |
428 iOsCallProfileRef.iIdentifier[0], //2 |
418 iOsCallProfileRef.iIdentifier[1], //3 |
429 iOsCallProfileRef.iIdentifier[1], //3 |
419 TheOpCounter, //4 |
430 TheOpCounter, //4 |
420 iOsCallProfileRef.iCallCounter, //5 |
431 iOsCallProfileRef.iCallCounter, //5 |
421 iOffset, //6 |
432 iOffset, //6 |
422 iBytes, //7 |
433 iBytes, //7 |
423 diffTicks, //8 |
434 diffTicks, //8 |
424 iOsCallProfileRef.iBytesTotal, //9 |
435 iOsCallProfileRef.iBytesTotal, //9 |
425 iOsCallProfileRef.iTicksTotal); //10 |
436 iOsCallProfileRef.iTicksTotal, //10 |
|
437 &fname); //11 |
426 } |
438 } |
427 } |
439 } |
428 } |
440 } |
429 private: |
441 private: |
430 TInt64& iOsCallTicksEntryRef; |
442 TInt64& iOsCallTicksEntryRef; |
431 TOsCallProfile& iOsCallProfileRef; |
443 TOsCallProfile& iOsCallProfileRef; |
432 TInt64 iOffset; |
444 TInt64 iOffset; |
433 TInt iBytes; |
445 TInt iBytes; |
434 TUint32 iStartTicks; |
446 TUint32 iStartTicks; |
|
447 TUint iHandle; |
|
448 const TUint8* iOptional; |
435 }; |
449 }; |
436 |
450 |
437 inline TOsCallProfile& OsCallProfile(TBool aType, TInt aIndex) |
451 inline TOsCallProfile& OsCallProfile(TBool aType, TInt aIndex) |
438 { |
452 { |
439 return aType ? TheOsCallJProfile[aIndex] : TheOsCallMProfile[aIndex]; |
453 return aType ? TheOsCallJProfile[aIndex] : TheOsCallMProfile[aIndex]; |
440 } |
454 } |
441 |
455 |
442 # define __OSTIME_COUNTER(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes) TOsCallCounter osCallCounter(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes) |
456 # define __OSTIME_COUNTER(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes, aHandle, aOpt) TOsCallCounter osCallCounter(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes, aHandle, aOpt) |
443 |
457 |
444 #else //_SQLPROFILER |
458 #else //_SQLPROFILER |
445 |
459 |
446 # define __COUNTER_INCR(counter) void(0) |
460 # define __COUNTER_INCR(counter) void(0) |
447 |
461 |
1481 /* static */ int TFileIo::Close(sqlite3_file* aDbFile) |
1495 /* static */ int TFileIo::Close(sqlite3_file* aDbFile) |
1482 { |
1496 { |
1483 SQLUTRACE_PROFILER(aDbFile); |
1497 SQLUTRACE_PROFILER(aDbFile); |
1484 TDbFile& dbFile = ::DbFile(aDbFile); |
1498 TDbFile& dbFile = ::DbFile(aDbFile); |
1485 __OS_CALL(EOsFileClose, 0, 0); |
1499 __OS_CALL(EOsFileClose, 0, 0); |
1486 __OSTIME_COUNTER(TheOsCallTicks[EOsFileClose], ::OsCallProfile(dbFile.iIsJournal, EOsFileClose), 0, 0); |
1500 __OSTIME_COUNTER(TheOsCallTicks[EOsFileClose], ::OsCallProfile(dbFile.iIsJournal, EOsFileClose), 0, 0, aDbFile, 0); |
1487 __FS_CALL(EFsOpFileClose, 0); |
1501 __FS_CALL(EFsOpFileClose, 0); |
1488 dbFile.iFileBuf.Close(); |
1502 dbFile.iFileBuf.Close(); |
1489 if(dbFile.iFullName) |
1503 if(dbFile.iFullName) |
1490 {//"iFullName" will not be NULL only when TVfs::Open() is called with SQLITE_OPEN_DELETEONCLOSE flag. |
1504 {//"iFullName" will not be NULL only when TVfs::Open() is called with SQLITE_OPEN_DELETEONCLOSE flag. |
1491 //That means - SQlite expects the file to be deleted after the file close operation. |
1505 //That means - SQlite expects the file to be deleted after the file close operation. |
1523 SQLUTRACE_PROFILER(aDbFile); |
1537 SQLUTRACE_PROFILER(aDbFile); |
1524 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KFileRead, aAmt, aOffset)); |
1538 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KFileRead, aAmt, aOffset)); |
1525 TDbFile& dbFile = ::DbFile(aDbFile); |
1539 TDbFile& dbFile = ::DbFile(aDbFile); |
1526 __OS_CALL(EOsFileRead, 0, 0); |
1540 __OS_CALL(EOsFileRead, 0, 0); |
1527 __COUNTER_INCR(TheSqlSrvProfilerFileRead); |
1541 __COUNTER_INCR(TheSqlSrvProfilerFileRead); |
1528 __OSTIME_COUNTER(TheOsCallTicks[EOsFileRead], ::OsCallProfile(dbFile.iIsJournal, EOsFileRead), aOffset, aAmt); |
1542 __OSTIME_COUNTER(TheOsCallTicks[EOsFileRead], ::OsCallProfile(dbFile.iIsJournal, EOsFileRead), aOffset, aAmt, aDbFile, 0); |
1529 TPtr8 ptr((TUint8*)aBuf, 0, aAmt); |
1543 TPtr8 ptr((TUint8*)aBuf, 0, aAmt); |
1530 TInt err = dbFile.iFileBuf.Read(aOffset, ptr); |
1544 TInt err = dbFile.iFileBuf.Read(aOffset, ptr); |
1531 TInt cnt = ptr.Length(); |
1545 TInt cnt = ptr.Length(); |
1532 TInt sqliteErr = SQLITE_IOERR_READ; |
1546 TInt sqliteErr = SQLITE_IOERR_READ; |
1533 switch(err) |
1547 switch(err) |
1586 SQLUTRACE_PROFILER(aDbFile); |
1600 SQLUTRACE_PROFILER(aDbFile); |
1587 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KFileWrite, aAmt, aOffset)); |
1601 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KFileWrite, aAmt, aOffset)); |
1588 TDbFile& dbFile = ::DbFile(aDbFile); |
1602 TDbFile& dbFile = ::DbFile(aDbFile); |
1589 __OS_CALL(EOsFileWrite, 0, 0); |
1603 __OS_CALL(EOsFileWrite, 0, 0); |
1590 __COUNTER_INCR(TheSqlSrvProfilerFileWrite); |
1604 __COUNTER_INCR(TheSqlSrvProfilerFileWrite); |
1591 __OSTIME_COUNTER(TheOsCallTicks[EOsFileWrite], ::OsCallProfile(dbFile.iIsJournal, EOsFileWrite), aOffset, aAmt); |
1605 __OSTIME_COUNTER(TheOsCallTicks[EOsFileWrite], ::OsCallProfile(dbFile.iIsJournal, EOsFileWrite), aOffset, aAmt, aDbFile, 0); |
1592 TInt err = KErrAccessDenied; |
1606 TInt err = KErrAccessDenied; |
1593 if(!dbFile.iReadOnly) |
1607 if(!dbFile.iReadOnly) |
1594 { |
1608 { |
1595 TPtrC8 ptr((const TUint8*)aData, aAmt); |
1609 TPtrC8 ptr((const TUint8*)aData, aAmt); |
1596 err = dbFile.iFileBuf.Write(aOffset, ptr); |
1610 err = dbFile.iFileBuf.Write(aOffset, ptr); |
1640 SQLUTRACE_PROFILER(aDbFile); |
1654 SQLUTRACE_PROFILER(aDbFile); |
1641 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KFileTruncate, aLength)); |
1655 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KFileTruncate, aLength)); |
1642 TDbFile& dbFile = ::DbFile(aDbFile); |
1656 TDbFile& dbFile = ::DbFile(aDbFile); |
1643 __OS_CALL(EOsFileTruncate, 0, 0); |
1657 __OS_CALL(EOsFileTruncate, 0, 0); |
1644 __COUNTER_INCR(TheSqlSrvProfilerFileSetSize); |
1658 __COUNTER_INCR(TheSqlSrvProfilerFileSetSize); |
1645 __OSTIME_COUNTER(TheOsCallTicks[EOsFileTruncate], ::OsCallProfile(dbFile.iIsJournal, EOsFileTruncate), aLength, 0); |
1659 __OSTIME_COUNTER(TheOsCallTicks[EOsFileTruncate], ::OsCallProfile(dbFile.iIsJournal, EOsFileTruncate), aLength, 0, aDbFile, 0); |
1646 if(dbFile.iReadOnly) |
1660 if(dbFile.iReadOnly) |
1647 { |
1661 { |
1648 COsLayerData::Instance().SetOsErrorCode(KErrAccessDenied); |
1662 COsLayerData::Instance().SetOsErrorCode(KErrAccessDenied); |
1649 return SQLITE_IOERR; |
1663 return SQLITE_IOERR; |
1650 } |
1664 } |
1711 /* static */ int TFileIo::FileSize(sqlite3_file* aDbFile, sqlite3_int64* aSize) |
1725 /* static */ int TFileIo::FileSize(sqlite3_file* aDbFile, sqlite3_int64* aSize) |
1712 { |
1726 { |
1713 SQLUTRACE_PROFILER(aDbFile); |
1727 SQLUTRACE_PROFILER(aDbFile); |
1714 TDbFile& dbFile = ::DbFile(aDbFile); |
1728 TDbFile& dbFile = ::DbFile(aDbFile); |
1715 __OS_CALL(EOsFileFileSize, 0, 0); |
1729 __OS_CALL(EOsFileFileSize, 0, 0); |
1716 __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileSize), 0, 0); |
1730 __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileSize), 0, 0, aDbFile, 0); |
1717 __FS_CALL(EFsOpFileSize, 0); |
1731 __FS_CALL(EFsOpFileSize, 0); |
1718 TInt err = dbFile.iFileBuf.Size(*aSize); |
1732 TInt err = dbFile.iFileBuf.Size(*aSize); |
1719 COsLayerData::Instance().SetOsErrorCode(err); |
1733 COsLayerData::Instance().SetOsErrorCode(err); |
1720 if(err == KErrNone) |
1734 if(err == KErrNone) |
1721 { |
1735 { |
1745 /* static */ int TFileIo::Lock(sqlite3_file* aDbFile, int aLockType) |
1759 /* static */ int TFileIo::Lock(sqlite3_file* aDbFile, int aLockType) |
1746 { |
1760 { |
1747 SQLUTRACE_PROFILER(aDbFile); |
1761 SQLUTRACE_PROFILER(aDbFile); |
1748 TDbFile& dbFile = ::DbFile(aDbFile); |
1762 TDbFile& dbFile = ::DbFile(aDbFile); |
1749 __OS_CALL(EOsFileLock, 0, 0); |
1763 __OS_CALL(EOsFileLock, 0, 0); |
1750 __OSTIME_COUNTER(TheOsCallTicks[EOsFileLock], ::OsCallProfile(dbFile.iIsJournal, EOsFileLock), aLockType, 0); |
1764 __OSTIME_COUNTER(TheOsCallTicks[EOsFileLock], ::OsCallProfile(dbFile.iIsJournal, EOsFileLock), aLockType, 0, aDbFile, 0); |
1751 //If there is already a lock of this type or more restrictive on the database file, do nothing. |
1765 //If there is already a lock of this type or more restrictive on the database file, do nothing. |
1752 if(dbFile.iLockType >= aLockType) |
1766 if(dbFile.iLockType >= aLockType) |
1753 { |
1767 { |
1754 return SQLITE_OK; |
1768 return SQLITE_OK; |
1755 } |
1769 } |
1843 { |
1857 { |
1844 SQLUTRACE_PROFILER(aDbFile); |
1858 SQLUTRACE_PROFILER(aDbFile); |
1845 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KFileFileCtr, aOp)); |
1859 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KFileFileCtr, aOp)); |
1846 TDbFile& dbFile = ::DbFile(aDbFile); |
1860 TDbFile& dbFile = ::DbFile(aDbFile); |
1847 __OS_CALL(EOsFileFileControl, 0, 0); |
1861 __OS_CALL(EOsFileFileControl, 0, 0); |
1848 __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileControl], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileControl), aOp, 0); |
1862 __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileControl], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileControl), aOp, 0, aDbFile, 0); |
1849 TInt err = KErrNone; |
1863 TInt err = KErrNone; |
1850 switch(aOp) |
1864 switch(aOp) |
1851 { |
1865 { |
1852 case SQLITE_FCNTL_LOCKSTATE: |
1866 case SQLITE_FCNTL_LOCKSTATE: |
1853 *(int*)aArg = dbFile.iLockType; |
1867 *(int*)aArg = dbFile.iLockType; |
1894 /* static */ int TFileIo::SectorSize(sqlite3_file* aDbFile) |
1908 /* static */ int TFileIo::SectorSize(sqlite3_file* aDbFile) |
1895 { |
1909 { |
1896 SQLUTRACE_PROFILER(aDbFile); |
1910 SQLUTRACE_PROFILER(aDbFile); |
1897 TDbFile& dbFile = ::DbFile(aDbFile); |
1911 TDbFile& dbFile = ::DbFile(aDbFile); |
1898 __OS_CALL(EOsFileSectorSize, 0, 0); |
1912 __OS_CALL(EOsFileSectorSize, 0, 0); |
1899 __OSTIME_COUNTER(TheOsCallTicks[EOsFileSectorSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileSectorSize), 0, 0); |
1913 __OSTIME_COUNTER(TheOsCallTicks[EOsFileSectorSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileSectorSize), 0, 0, aDbFile, 0); |
1900 __ASSERT_DEBUG(dbFile.iSectorSize > 0, User::Panic(KPanicCategory, EPanicInternalError)); |
1914 __ASSERT_DEBUG(dbFile.iSectorSize > 0, User::Panic(KPanicCategory, EPanicInternalError)); |
1901 if(dbFile.iSectorSize > 0) |
1915 if(dbFile.iSectorSize > 0) |
1902 { |
1916 { |
1903 return dbFile.iSectorSize; |
1917 return dbFile.iSectorSize; |
1904 } |
1918 } |
1925 /* static */ int TFileIo::DeviceCharacteristics(sqlite3_file* aDbFile) |
1939 /* static */ int TFileIo::DeviceCharacteristics(sqlite3_file* aDbFile) |
1926 { |
1940 { |
1927 SQLUTRACE_PROFILER(aDbFile); |
1941 SQLUTRACE_PROFILER(aDbFile); |
1928 TDbFile& dbFile = ::DbFile(aDbFile); |
1942 TDbFile& dbFile = ::DbFile(aDbFile); |
1929 __OS_CALL(EOsFileDeviceCharacteristics, 0, 0); |
1943 __OS_CALL(EOsFileDeviceCharacteristics, 0, 0); |
1930 __OSTIME_COUNTER(TheOsCallTicks[EOsFileDeviceCharacteristics], ::OsCallProfile(dbFile.iIsJournal, EOsFileDeviceCharacteristics), 0, 0); |
1944 __OSTIME_COUNTER(TheOsCallTicks[EOsFileDeviceCharacteristics], ::OsCallProfile(dbFile.iIsJournal, EOsFileDeviceCharacteristics), 0, 0, aDbFile, 0); |
1931 __ASSERT_DEBUG(dbFile.iDeviceCharacteristics >= 0, User::Panic(KPanicCategory, EPanicInternalError)); |
1945 __ASSERT_DEBUG(dbFile.iDeviceCharacteristics >= 0, User::Panic(KPanicCategory, EPanicInternalError)); |
1932 if(dbFile.iDeviceCharacteristics >= 0) |
1946 if(dbFile.iDeviceCharacteristics >= 0) |
1933 { |
1947 { |
1934 return dbFile.iDeviceCharacteristics; |
1948 return dbFile.iDeviceCharacteristics; |
1935 } |
1949 } |
2216 */ |
2230 */ |
2217 /* static */ int TVfs::Open(sqlite3_vfs* aVfs, const char* aFileName, sqlite3_file* aDbFile, int aFlags, int* aOutFlags) |
2231 /* static */ int TVfs::Open(sqlite3_vfs* aVfs, const char* aFileName, sqlite3_file* aDbFile, int aFlags, int* aOutFlags) |
2218 { |
2232 { |
2219 SQLUTRACE_PROFILER(aVfs); |
2233 SQLUTRACE_PROFILER(aVfs); |
2220 __OS_CALL(EOsVfsOpen, 0, 0); |
2234 __OS_CALL(EOsVfsOpen, 0, 0); |
2221 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsOpen], ::OsCallProfile(EFalse, EOsVfsOpen), 0, 0); |
2235 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsOpen], ::OsCallProfile(EFalse, EOsVfsOpen), 0, 0, aDbFile, aFileName); |
2222 COsLayerData& osLayerData = COsLayerData::Instance(); |
2236 COsLayerData& osLayerData = COsLayerData::Instance(); |
2223 TFileName fname; |
2237 TFileName fname; |
2224 if(aFileName && !::ConvertToUnicode(aFileName, fname)) |
2238 if(aFileName && !::ConvertToUnicode(aFileName, fname)) |
2225 { |
2239 { |
2226 osLayerData.SetOsErrorCode(KErrBadName); |
2240 osLayerData.SetOsErrorCode(KErrBadName); |
2365 */ |
2379 */ |
2366 /* static */ int TVfs::Delete(sqlite3_vfs* aVfs, const char* aFileName, int /*aSyncDir*/) |
2380 /* static */ int TVfs::Delete(sqlite3_vfs* aVfs, const char* aFileName, int /*aSyncDir*/) |
2367 { |
2381 { |
2368 SQLUTRACE_PROFILER(aVfs); |
2382 SQLUTRACE_PROFILER(aVfs); |
2369 __OS_CALL(EOsVfsDelete, 0, 0); |
2383 __OS_CALL(EOsVfsDelete, 0, 0); |
2370 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsDelete], ::OsCallProfile(EFalse, EOsVfsDelete), 0, 0); |
2384 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsDelete], ::OsCallProfile(EFalse, EOsVfsDelete), 0, 0, 0, aFileName); |
2371 COsLayerData& osLayerData = COsLayerData::Instance(); |
2385 COsLayerData& osLayerData = COsLayerData::Instance(); |
2372 TBuf<KMaxFileName + 1> fname; |
2386 TBuf<KMaxFileName + 1> fname; |
2373 if(!::ConvertToUnicode(aFileName, fname)) |
2387 if(!::ConvertToUnicode(aFileName, fname)) |
2374 { |
2388 { |
2375 osLayerData.SetOsErrorCode(KErrBadName); |
2389 osLayerData.SetOsErrorCode(KErrBadName); |
2413 */ |
2427 */ |
2414 /* static */ int TVfs::Access(sqlite3_vfs* aVfs, const char* aFileName, int aFlags, int* aResOut) |
2428 /* static */ int TVfs::Access(sqlite3_vfs* aVfs, const char* aFileName, int aFlags, int* aResOut) |
2415 { |
2429 { |
2416 SQLUTRACE_PROFILER(aVfs); |
2430 SQLUTRACE_PROFILER(aVfs); |
2417 __OS_CALL(EOsVfsAccess, 0, 0); |
2431 __OS_CALL(EOsVfsAccess, 0, 0); |
2418 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsAccess], ::OsCallProfile(EFalse, EOsVfsAccess), aFlags, 0); |
2432 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsAccess], ::OsCallProfile(EFalse, EOsVfsAccess), aFlags, 0, 0, aFileName); |
2419 COsLayerData& osLayerData = COsLayerData::Instance(); |
2433 COsLayerData& osLayerData = COsLayerData::Instance(); |
2420 TBuf<KMaxFileName + 1> fname; |
2434 TBuf<KMaxFileName + 1> fname; |
2421 if(!::ConvertToUnicode(aFileName, fname)) |
2435 if(!::ConvertToUnicode(aFileName, fname)) |
2422 { |
2436 { |
2423 osLayerData.SetOsErrorCode(KErrGeneral); |
2437 osLayerData.SetOsErrorCode(KErrGeneral); |
2490 */ |
2504 */ |
2491 /* static */ int TVfs::FullPathName(sqlite3_vfs* aVfs, const char* aRelative, int aBufLen, char* aBuf) |
2505 /* static */ int TVfs::FullPathName(sqlite3_vfs* aVfs, const char* aRelative, int aBufLen, char* aBuf) |
2492 { |
2506 { |
2493 SQLUTRACE_PROFILER(aVfs); |
2507 SQLUTRACE_PROFILER(aVfs); |
2494 __OS_CALL(EOsVfsFullPathName, 0, 0); |
2508 __OS_CALL(EOsVfsFullPathName, 0, 0); |
2495 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsFullPathName], ::OsCallProfile(EFalse, EOsVfsFullPathName), aBufLen, 0); |
2509 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsFullPathName], ::OsCallProfile(EFalse, EOsVfsFullPathName), aBufLen, 0, 0, aRelative); |
2496 COsLayerData& osLayerData = COsLayerData::Instance(); |
2510 COsLayerData& osLayerData = COsLayerData::Instance(); |
2497 osLayerData.StoreFhData(NULL, EFalse); |
2511 osLayerData.StoreFhData(NULL, EFalse); |
2498 //Convert the received file name to UTF16 |
2512 //Convert the received file name to UTF16 |
2499 TBuf<KMaxFileName + 1> fname; |
2513 TBuf<KMaxFileName + 1> fname; |
2500 if(!::ConvertToUnicode(aRelative, fname)) |
2514 if(!::ConvertToUnicode(aRelative, fname)) |
2537 */ |
2551 */ |
2538 /* static */ int TVfs::Randomness(sqlite3_vfs* aVfs, int aBufLen, char* aBuf) |
2552 /* static */ int TVfs::Randomness(sqlite3_vfs* aVfs, int aBufLen, char* aBuf) |
2539 { |
2553 { |
2540 SQLUTRACE_PROFILER(aVfs); |
2554 SQLUTRACE_PROFILER(aVfs); |
2541 __OS_CALL(EOsVfsRandomness, 0, 0); |
2555 __OS_CALL(EOsVfsRandomness, 0, 0); |
2542 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsRandomness], ::OsCallProfile(EFalse, EOsVfsRandomness), aBufLen, 0); |
2556 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsRandomness], ::OsCallProfile(EFalse, EOsVfsRandomness), aBufLen, 0, 0, 0); |
2543 COsLayerData& osLayerData = COsLayerData::Instance(); |
2557 COsLayerData& osLayerData = COsLayerData::Instance(); |
2544 const TInt KRandIterations = aBufLen / sizeof(int); |
2558 const TInt KRandIterations = aBufLen / sizeof(int); |
2545 for(TInt i=0;i<KRandIterations;++i) |
2559 for(TInt i=0;i<KRandIterations;++i) |
2546 { |
2560 { |
2547 TInt val = Math::Rand(osLayerData.iSeed); |
2561 TInt val = Math::Rand(osLayerData.iSeed); |
2581 */ |
2595 */ |
2582 /* static */ int TVfs::CurrentTime(sqlite3_vfs* aVfs, double* aNow) |
2596 /* static */ int TVfs::CurrentTime(sqlite3_vfs* aVfs, double* aNow) |
2583 { |
2597 { |
2584 SQLUTRACE_PROFILER(aVfs); |
2598 SQLUTRACE_PROFILER(aVfs); |
2585 __OS_CALL(EOsVfsCurrentTime, 0, 0); |
2599 __OS_CALL(EOsVfsCurrentTime, 0, 0); |
2586 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsCurrentTime], ::OsCallProfile(EFalse, EOsVfsCurrentTime), 0, 0); |
2600 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsCurrentTime], ::OsCallProfile(EFalse, EOsVfsCurrentTime), 0, 0, 0, 0); |
2587 TTime now; |
2601 TTime now; |
2588 now.UniversalTime(); |
2602 now.UniversalTime(); |
2589 TDateTime date = now.DateTime(); |
2603 TDateTime date = now.DateTime(); |
2590 TInt year = date.Year(); |
2604 TInt year = date.Year(); |
2591 TInt month = date.Month() + 1; |
2605 TInt month = date.Month() + 1; |
2617 */ |
2631 */ |
2618 /* static */int TVfs::GetLastError(sqlite3_vfs* aVfs, int /*aBufLen*/, char* /*aBuf*/) |
2632 /* static */int TVfs::GetLastError(sqlite3_vfs* aVfs, int /*aBufLen*/, char* /*aBuf*/) |
2619 { |
2633 { |
2620 SQLUTRACE_PROFILER(aVfs); |
2634 SQLUTRACE_PROFILER(aVfs); |
2621 __OS_CALL(EOsVfsGetLastError, 0, 0); |
2635 __OS_CALL(EOsVfsGetLastError, 0, 0); |
2622 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsGetLastError], ::OsCallProfile(EFalse, EOsVfsGetLastError), 0, 0); |
2636 __OSTIME_COUNTER(TheOsCallTicks[EOsVfsGetLastError], ::OsCallProfile(EFalse, EOsVfsGetLastError), 0, 0, 0, 0); |
2623 return 0; |
2637 return 0; |
2624 } |
2638 } |
2625 |
2639 |
2626 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
2640 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
2627 /////////////////////////////////// Memory allocation functions ///////////////////////////////////////////////////// |
2641 /////////////////////////////////// Memory allocation functions ///////////////////////////////////////////////////// |