persistentstorage/sql/SRC/Server/SqlSrvResourceProfiler.cpp
branchRCL_3
changeset 23 26645d81f48d
parent 21 28839de615b4
child 24 cc28652e0254
equal deleted inserted replaced
21:28839de615b4 23:26645d81f48d
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #include <e32std.h>
       
    17 #include <e32debug.h>
       
    18 #include <f32file.h>
    16 #include <f32file.h>
    19 #include "SqlPanic.h"
    17 #include "SqlAssert.h"
    20 #include "SqlSrvResourceProfiler.h"
    18 #include "SqlSrvResourceProfiler.h"
    21 #include "SqlResourceProfiler.h"
    19 #include "SqlResourceProfiler.h"
    22 #include "SqliteSymbian.h"
    20 #include "SqliteSymbian.h"
    23 #include <hal.h>
    21 #include <hal.h>
    24 
    22 
   138 			break;
   136 			break;
   139 		case TSqlResourceProfiler::ESqlCounterTrace:
   137 		case TSqlResourceProfiler::ESqlCounterTrace:
   140 		    {
   138 		    {
   141 			TheSqlSrvProfilerTraceEnabled = ETrue;
   139 			TheSqlSrvProfilerTraceEnabled = ETrue;
   142 		    TInt len = aMessage.Int1();
   140 		    TInt len = aMessage.Int1();
   143 		    __SQLPANIC_CLIENT((TUint)len < 64, aMessage, ESqlPanicBadArgument);
   141 		    __SQLPANIC_CLIENT2((TUint)len < 64, aMessage, ESqlPanicBadArgument);
   144 		    if(len > 0)
   142 		    if(len > 0)
   145 		        {
   143 		        {
   146                 TBuf8<64> prmBuf;
   144                 TBuf8<64> prmBuf;
   147                 aMessage.ReadL(2, prmBuf);
   145                 aMessage.ReadL(2, prmBuf);
   148                 prmBuf.UpperCase();
   146                 prmBuf.UpperCase();
   191 			break;
   189 			break;
   192 		default:
   190 		default:
   193 			err = KErrNotSupported;
   191 			err = KErrNotSupported;
   194 			break;
   192 			break;
   195 		}
   193 		}
   196 	__SQLLEAVE_IF_ERROR(err);
   194 	__SQLLEAVE_IF_ERROR2(err);
   197 	}
   195 	}
   198 	
   196 	
   199 /**
   197 /**
   200 Stops the specified profiling counter.
   198 Stops the specified profiling counter.
   201 
   199 
   235             break;
   233             break;
   236 		default:
   234 		default:
   237 			err = KErrNotSupported;
   235 			err = KErrNotSupported;
   238 			break;
   236 			break;
   239 		}
   237 		}
   240 	__SQLLEAVE_IF_ERROR(err);
   238 	__SQLLEAVE_IF_ERROR2(err);
   241 	}
   239 	}
   242 	
   240 	
   243 /**
   241 /**
   244 Resets the specified profiling counter.
   242 Resets the specified profiling counter.
   245 
   243 
   276             break;
   274             break;
   277 		default:
   275 		default:
   278 			err = KErrNotSupported;
   276 			err = KErrNotSupported;
   279 			break;
   277 			break;
   280 		}
   278 		}
   281 	__SQLLEAVE_IF_ERROR(err);
   279 	__SQLLEAVE_IF_ERROR2(err);
   282 	}
   280 	}
   283 	
   281 	
   284 /**
   282 /**
   285 Retrieves the counter values for the specified profiling counter.
   283 Retrieves the counter values for the specified profiling counter.
   286 
   284 
   349             break;
   347             break;
   350 		default:
   348 		default:
   351 			err = KErrNotSupported;
   349 			err = KErrNotSupported;
   352 			break;
   350 			break;
   353 		}
   351 		}
   354 	__SQLLEAVE_IF_ERROR(err);
   352 	__SQLLEAVE_IF_ERROR2(err);
   355 	aMessage.WriteL(2, ipcBuf);
   353 	aMessage.WriteL(2, ipcBuf);
   356 	}
   354 	}
   357 	
   355 	
   358 ////////////////////////// IPC tracing related ////////////////////////////////////////
   356 ////////////////////////// IPC tracing related ////////////////////////////////////////
   359 
   357 
   588             aIpcCallName.Set(KSqlSrvStreamClose);
   586             aIpcCallName.Set(KSqlSrvStreamClose);
   589             break;
   587             break;
   590         default:
   588         default:
   591             return KErrNotSupported;
   589             return KErrNotSupported;
   592         };
   590         };
   593     __SQLASSERT((TUint)rc < KIpcTraceTypeCount || rc == KErrNotFound, ESqlPanicInternalError);
   591     __ASSERT_DEBUG((TUint)rc < KIpcTraceTypeCount || rc == KErrNotFound, __SQLPANIC2(ESqlPanicInternalError));
   594     return rc;
   592     return rc;
   595     }
   593     }
   596 
   594 
   597 //Calculates and returns the time difference between aStartTicks and aEndTicks in microseconds.  
   595 //Calculates and returns the time difference between aStartTicks and aEndTicks in microseconds.  
   598 static TInt SqlConvertTicks2Us(TUint32 aStartTicks, TUint32 aEndTicks)
   596 static TInt SqlConvertTicks2Us(TUint32 aStartTicks, TUint32 aEndTicks)
   601     if(freq == 0)
   599     if(freq == 0)
   602         {
   600         {
   603         TInt err = HAL::Get(HAL::EFastCounterFrequency, freq);
   601         TInt err = HAL::Get(HAL::EFastCounterFrequency, freq);
   604         if(err != KErrNone)
   602         if(err != KErrNone)
   605             {
   603             {
   606             SqlPanic((TSqlPanic)err);
   604             __SQLPANIC2((TSqlPanic)err);
   607             }
   605             }
   608         }
   606         }
   609     TInt64 diffTicks = (TInt64)aEndTicks - (TInt64)aStartTicks;
   607     TInt64 diffTicks = (TInt64)aEndTicks - (TInt64)aStartTicks;
   610     if(diffTicks < 0)
   608     if(diffTicks < 0)
   611         {
   609         {
  1009 
  1007 
  1010 #else //_SQLPROFILER
  1008 #else //_SQLPROFILER
  1011 
  1009 
  1012 void TSqlSrvResourceProfiler::StartL(const RMessage2&)
  1010 void TSqlSrvResourceProfiler::StartL(const RMessage2&)
  1013 	{
  1011 	{
  1014 	__SQLLEAVE(KErrNotSupported);
  1012 	__SQLLEAVE2(KErrNotSupported);
  1015 	}
  1013 	}
  1016 	
  1014 	
  1017 void TSqlSrvResourceProfiler::StopL(const RMessage2&)
  1015 void TSqlSrvResourceProfiler::StopL(const RMessage2&)
  1018 	{
  1016 	{
  1019 	__SQLLEAVE(KErrNotSupported);
  1017 	__SQLLEAVE2(KErrNotSupported);
  1020 	}
  1018 	}
  1021 	
  1019 	
  1022 void TSqlSrvResourceProfiler::ResetL(const RMessage2&)
  1020 void TSqlSrvResourceProfiler::ResetL(const RMessage2&)
  1023 	{
  1021 	{
  1024 	__SQLLEAVE(KErrNotSupported);
  1022 	__SQLLEAVE2(KErrNotSupported);
  1025 	}
  1023 	}
  1026 	
  1024 	
  1027 void TSqlSrvResourceProfiler::QueryL(const RMessage2&)
  1025 void TSqlSrvResourceProfiler::QueryL(const RMessage2&)
  1028 	{
  1026 	{
  1029 	__SQLLEAVE(KErrNotSupported);
  1027 	__SQLLEAVE2(KErrNotSupported);
  1030 	}
  1028 	}
  1031 	
  1029 	
  1032 #endif//_SQLPROFILER
  1030 #endif//_SQLPROFILER