persistentstorage/sql/OsLayer/FileBuf64.cpp
branchRCL_3
changeset 20 04ec7606545c
parent 11 667e88a979d7
child 21 fcc16690f446
--- a/persistentstorage/sql/OsLayer/FileBuf64.cpp	Tue Apr 27 18:25:57 2010 +0300
+++ b/persistentstorage/sql/OsLayer/FileBuf64.cpp	Tue May 11 17:49:39 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -22,53 +22,98 @@
 
 extern TBool TheOsCallTimeDetailedProfileEnabled;//If true, the OS porting layer call details are enabled and for each call an entry will be added to the log file (epocwind.out).
 
-#define PROFILE_READ(pos,amount) \
+#define PROFILE_READ(pos, amount, err) \
 	do \
 		{ \
 		if(TheOsCallTimeDetailedProfileEnabled) \
 			{ \
 			++iFileReadCount; iFileReadAmount += (amount); \
-			RDebug::Print(_L(" -- FRead    this=%X, Cnt=%d, Pos=%ld, Amt=%d, Ttl=%ld\r\n"), (TUint32)this, iFileReadCount,  pos, amount, iFileReadAmount); \
+			RDebug::Print(_L("[SQL-FBUF]¬RD¬%X¬%d¬%ld¬%d¬%ld¬%d\r\n"), (TUint32)this, iFileReadCount, pos, amount, iFileReadAmount, err); \
 			} \
 		} while(0)
 	
-#define PROFILE_WRITE(pos,amount) \
+#define PROFILE_WRITE(pos, amount, err) \
 	do \
 		{ \
 		if(TheOsCallTimeDetailedProfileEnabled) \
 			{ \
 			++iFileWriteCount; iFileWriteAmount += (amount); \
-			RDebug::Print(_L(" -- FWrite   this=%X, Cnt=%d, Pos=%ld, Amt=%d, Ttl=%ld\r\n"), (TUint32)this, iFileWriteCount, pos, amount, iFileWriteAmount); \
+			RDebug::Print(_L("[SQL-FBUF]¬WR¬%X¬%d¬%ld¬%d¬%ld¬%d\r\n"), (TUint32)this, iFileWriteCount, pos, amount, iFileWriteAmount, err); \
 			} \
 		} while(0)
 
-#define PROFILE_SIZE() \
+#define PROFILE_SIZE(size, err) \
 	do \
 		{ \
 		if(TheOsCallTimeDetailedProfileEnabled) \
 			{ \
 			++iFileSizeCount; \
-			RDebug::Print(_L(" -- FSize    this=%X, Cnt=%d\r\n"), (TUint32)this, iFileSizeCount); \
+			RDebug::Print(_L("[SQL-FBUF]¬SZ¬%X¬%d¬%ld¬%d¬%ld¬%d\r\n"), (TUint32)this, iFileSizeCount, size, 0, 0LL, err); \
 			} \
 		} while(0)
 
-#define PROFILE_SETSIZE() \
+#define PROFILE_SETSIZE(size, err) \
 	do \
 		{ \
 		if(TheOsCallTimeDetailedProfileEnabled) \
 			{ \
 			++iFileSetSizeCount; \
-			RDebug::Print(_L(" -- FSetSize this=%X, Cnt=%d\r\n"), (TUint32)this, iFileSetSizeCount); \
+			RDebug::Print(_L("[SQL-FBUF]¬SS¬%X¬%d¬%ld¬%d¬%ld¬%d\r\n"), (TUint32)this, iFileSetSizeCount, size, 0, 0LL, err); \
 			} \
 		} while(0)
 
-#define PROFILE_FLUSH()	\
+#define PROFILE_FLUSH(err)	\
 	do \
 		{ \
 		if(TheOsCallTimeDetailedProfileEnabled) \
 			{ \
 			++iFileFlushCount; \
-			RDebug::Print(_L(" -- FFlush   this=%X, Cnt=%d\r\n"), (TUint32)this, iFileFlushCount); \
+			RDebug::Print(_L("[SQL-FBUF]¬SY¬%X¬%d¬%ld¬%d¬%ld¬%d\r\n"), (TUint32)this, iFileFlushCount, 0LL, 0, 0LL, err); \
+			} \
+		} while(0)
+
+#define PROFILE_CREATE(fname, err) \
+	do \
+		{ \
+		if(TheOsCallTimeDetailedProfileEnabled) \
+			{ \
+			RDebug::Print(_L("[SQL-FBUF]¬CR¬%X¬%S¬%d\r\n"), (TUint32)this, &fname, err); \
+			} \
+		} while(0)
+
+#define PROFILE_OPEN(fname, err) \
+	do \
+		{ \
+		if(TheOsCallTimeDetailedProfileEnabled) \
+			{ \
+			RDebug::Print(_L("[SQL-FBUF]¬OP¬%X¬%S¬%d\r\n"), (TUint32)this, &fname, err); \
+			} \
+		} while(0)
+
+#define PROFILE_TEMP(fname, err) \
+	do \
+		{ \
+		if(TheOsCallTimeDetailedProfileEnabled) \
+			{ \
+			RDebug::Print(_L("[SQL-FBUF]¬TP¬%X¬%S¬%d\r\n"), (TUint32)this, &fname, err); \
+			} \
+		} while(0)
+
+#define PROFILE_ADOPT(fname, err) \
+	do \
+		{ \
+		if(TheOsCallTimeDetailedProfileEnabled) \
+			{ \
+			RDebug::Print(_L("[SQL-FBUF]¬AT¬%X¬%S¬%d\r\n"), (TUint32)this, &fname, err); \
+			} \
+		} while(0)
+
+#define PROFILE_CLOSE() \
+	do \
+		{ \
+		if(TheOsCallTimeDetailedProfileEnabled) \
+			{ \
+			RDebug::Print(_L("[SQL-FBUF]¬CL¬%X\r\n"), (TUint32)this); \
 			} \
 		} while(0)
 
@@ -80,12 +125,18 @@
 
 #else
 
-#define PROFILE_READ(pos,amount)	void(0)
-#define PROFILE_WRITE(pos,amount)	void(0)
+#define PROFILE_READ(pos,amount, err)	void(0)
+#define PROFILE_WRITE(pos,amount, err)	void(0)
 
-#define PROFILE_SIZE()			void(0)
-#define PROFILE_SETSIZE()		void(0)
-#define PROFILE_FLUSH()			void(0)
+#define PROFILE_SIZE(size, err)			void(0)
+#define PROFILE_SETSIZE(size, err)		void(0)
+#define PROFILE_FLUSH(err)				void(0)
+
+#define PROFILE_CREATE(fname, err)		void(0)
+#define PROFILE_OPEN(fname, err)		void(0)
+#define PROFILE_TEMP(fname, err)		void(0)
+#define PROFILE_ADOPT(fname, err)		void(0)
+#define PROFILE_CLOSE()					void(0)
 
 #endif//_SQLPROFILER
 
@@ -238,6 +289,7 @@
 	    {
 	    err = iFile.Create(aFs, aFileName, aFileMode);
 	    }
+	PROFILE_CREATE(aFileName, err);
 	return DoPostInit(err);
 	}
 
@@ -269,6 +321,7 @@
         {
         err = iFile.Open(aFs, aFileName, aFileMode);
         }
+	PROFILE_OPEN(aFileName, err);
     return DoPostInit(err);
 	}
 
@@ -300,6 +353,7 @@
         {
         err = iFile.Temp(aFs, aPath, aFileName, aFileMode);
         }
+	PROFILE_TEMP(aFileName, err);
     return DoPostInit(err);
 	}
 
@@ -336,6 +390,7 @@
         {
         err = iFile.AdoptFromClient(aMsg, aFsIndex, aFileIndex);
         }
+	PROFILE_ADOPT(KNullDesC, err);
     return DoPostInit(err);
 	}
 
@@ -356,6 +411,7 @@
 	iFile.Close();
 	User::Free(iBase);
 	iBase = 0;
+	PROFILE_CLOSE();
 	}
 
 /**
@@ -441,7 +497,7 @@
 		if(err == KErrNone)
 			{
 			err = iFile.Read(aFilePos, aDes);
-			PROFILE_READ(aFilePos, aDes.Size());
+			PROFILE_READ(aFilePos, aDes.Size(), err);
 			}
 		__FILEBUF64_INVARIANT();
 		return err;
@@ -472,7 +528,7 @@
 				iNextReadFilePosHits = 0;
 				TPtr8 ptr2(outptr, len);
 				err = iFile.Read(aFilePos, ptr2);
-				PROFILE_READ(aFilePos, ptr2.Size());
+				PROFILE_READ(aFilePos, ptr2.Size(), err);
 				if(err == KErrNone)
 					{
 					iNextReadFilePos = aFilePos + len;
@@ -496,7 +552,7 @@
 				}
 			TPtr8 ptr(iBase, Min(iCapacity, (len + readahead)));
 			err = iFile.Read(aFilePos, ptr);
-			PROFILE_READ(aFilePos, ptr.Size());
+			PROFILE_READ(aFilePos, ptr.Size(), err);
 			if(err == KErrNone)
 				{
 				iFilePos = aFilePos;
@@ -787,8 +843,8 @@
 		__FILEBUF64_INVARIANT();
 		return KErrNone;
 		}
-	PROFILE_SIZE();
 	TInt err = iFile.Size(iFileSize);
+	PROFILE_SIZE(iFileSize, err);
 	if(err != KErrNone)
 		{
 		DoDiscard();
@@ -825,8 +881,8 @@
 		{
 		iLength = aFileSize - iFilePos;
 		}
-	PROFILE_SETSIZE();
 	TInt err = iFile.SetSize(aFileSize);
+	PROFILE_SETSIZE(aFileSize, err);
 	if(err != KErrNone)
 		{
 		DoDiscard();
@@ -857,8 +913,8 @@
 		__FILEBUF64_INVARIANT();
 		return err;	
 		}
-	PROFILE_FLUSH();
 	err = iFile.Flush();
+	PROFILE_FLUSH(err);
 	if(err != KErrNone)
 		{
 		DoDiscard();
@@ -889,9 +945,9 @@
 		__FILEBUF64_INVARIANT();
 		return KErrNone;	
 		}
-	PROFILE_WRITE(iFilePos, iLength);
 	TPtrC8 data(iBase, iLength);		
 	TInt err = iFile.Write(iFilePos, data);
+	PROFILE_WRITE(iFilePos, iLength, err);
 	if(err == KErrNone)
 		{
 		iFileSize = Max(iFileSize, (iFilePos + iLength));