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