perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolfilelog.cpp
changeset 55 f2950aff7424
parent 48 516af714ebb4
equal deleted inserted replaced
48:516af714ebb4 55:f2950aff7424
    61 
    61 
    62 TInt RATFileLog::ATFileLogVersion()
    62 TInt RATFileLog::ATFileLogVersion()
    63 {
    63 {
    64     LOGSTR1( "ATFL CATFileLog::ATFileLogVersion()" );
    64     LOGSTR1( "ATFL CATFileLog::ATFileLogVersion()" );
    65     
    65     
       
    66     TInt err( KErrNone );
       
    67     
    66     iFile << KDataFileVersion;
    68     iFile << KDataFileVersion;
    67 
    69 
    68     iFile.CommitL();   
    70     TRAP( err, iFile.CommitL() );
    69     return KErrNone;
    71     return err;
    70 }
    72 }
    71 
    73 
    72 TInt RATFileLog::ATFileLogProcessStarted( const TDesC8& aProcessName,
    74 TInt RATFileLog::ATFileLogProcessStarted( const TDesC8& aProcessName,
    73                                           TUint aProcessId,
    75                                           TUint aProcessId,
    74                                           TUint32 aIsDebug,
    76                                           TUint32 aIsDebug,
    75                                           const TDesC8& aAtoolVersion,
    77                                           const TDesC8& aAtoolVersion,
    76                                           const TDesC8& aApiVersion )
    78                                           const TDesC8& aApiVersion )
    77 {
    79 {
    78     LOGSTR1( "ATFL CATFileLog::ATFileLogProcessStarted()" );
    80     LOGSTR1( "ATFL CATFileLog::ATFileLogProcessStarted()" );
    79  
    81  
       
    82     TInt err( KErrNone );
       
    83     
    80     // log the current time
    84     // log the current time
    81     iFile << this->CurrentTime();
    85     iFile << this->CurrentTime();
    82     
    86     
    83     // <Time stamp> PCS <Process name> <Process ID> <Udeb> <Version>
    87     // <Time stamp> PCS <Process name> <Process ID> <Udeb> <Version>
    84     iFile << (TUint8)EProcessStart;
    88     iFile << (TUint8)EProcessStart;
    87     iFile << aIsDebug;
    91     iFile << aIsDebug;
    88     iFile << aAtoolVersion;
    92     iFile << aAtoolVersion;
    89     iFile << aApiVersion;
    93     iFile << aApiVersion;
    90     
    94     
    91     // ensure that any buffered data is written to the stream
    95     // ensure that any buffered data is written to the stream
    92     iFile.CommitL();
    96     TRAP( err, iFile.CommitL() );
    93     
    97     
    94     return KErrNone;
    98     return err;
    95 }
    99 }
    96 
   100 
    97 // -----------------------------------------------------------------------------
   101 // -----------------------------------------------------------------------------
    98 // RATFileLog::ATFileLogProcessEnded
   102 // RATFileLog::ATFileLogProcessEnded
    99 // 
   103 // 
   100 // -----------------------------------------------------------------------------
   104 // -----------------------------------------------------------------------------
   101 // 
   105 // 
   102 TInt RATFileLog::ATFileLogProcessEnded( TUint aHandleLeakCount )
   106 TInt RATFileLog::ATFileLogProcessEnded( TUint aHandleLeakCount )
   103 {
   107 {
   104 	LOGSTR1( "ATFL CATFileLog::ATFileLogProcessEnded()" );
   108 	LOGSTR1( "ATFL CATFileLog::ATFileLogProcessEnded()" );
   105 	   
   109 	
       
   110 	TInt err( KErrNone );
       
   111 	
   106 	if ( aHandleLeakCount > 0 )
   112 	if ( aHandleLeakCount > 0 )
   107 	{
   113 	{
   108 		// HDL <Handle count>
   114 		// HDL <Handle count>
   109 		iFile << this->CurrentTime();
   115 		iFile << this->CurrentTime();
   110         iFile << (TUint8)EHandleLeak;
   116         iFile << (TUint8)EHandleLeak;
   116 	
   122 	
   117 	// PCE
   123 	// PCE
   118 	iFile << (TUint8)EProcessEnd;
   124 	iFile << (TUint8)EProcessEnd;
   119 	
   125 	
   120     // ensure that any buffered data is written to the stream
   126     // ensure that any buffered data is written to the stream
   121     iFile.CommitL();
   127 	TRAP( err, iFile.CommitL() );
   122 	
   128 	
   123 	return KErrNone;	
   129 	return err;	
   124 }
   130 }
   125 
   131 
   126 
   132 
   127 // -----------------------------------------------------------------------------
   133 // -----------------------------------------------------------------------------
   128 // RATFileLog::ATFileLogDllLoaded
   134 // RATFileLog::ATFileLogDllLoaded
   131 // 
   137 // 
   132 TInt RATFileLog::ATFileLogDllLoaded( const TDesC8& aDllName, TUint32 aStartAddress,
   138 TInt RATFileLog::ATFileLogDllLoaded( const TDesC8& aDllName, TUint32 aStartAddress,
   133                                 TUint32 aEndAddress )
   139                                 TUint32 aEndAddress )
   134 {
   140 {
   135 	LOGSTR1( "ATFL CATFileLog::ATFileLogDllLoaded()" );
   141 	LOGSTR1( "ATFL CATFileLog::ATFileLogDllLoaded()" );
   136 	    
   142 	   
       
   143 	TInt err( KErrNone );
       
   144 	
   137 	// log the current time
   145 	// log the current time
   138 	iFile << this->CurrentTime();
   146 	iFile << this->CurrentTime();
   139 	
   147 	
   140 	// DLL <DLL name> <Memory start address> <Memory end address>
   148 	// DLL <DLL name> <Memory start address> <Memory end address>
   141 
   149 
   147 	iFile << aStartAddress;
   155 	iFile << aStartAddress;
   148 	//end adress
   156 	//end adress
   149 	iFile << aEndAddress;
   157 	iFile << aEndAddress;
   150 	
   158 	
   151 	// ensure that any buffered data is written to the stream
   159 	// ensure that any buffered data is written to the stream
   152 	iFile.CommitL();
   160 	TRAP( err, iFile.CommitL() );
   153 	
   161 	
   154 	return KErrNone;
   162 	return err;
   155 }
   163 }
   156 
   164 
   157 
   165 
   158 
   166 
   159 // -----------------------------------------------------------------------------
   167 // -----------------------------------------------------------------------------
   164 TInt RATFileLog::ATFileLogDllUnloaded( const TDesC8& aDllName, TUint32 aStartAddress,
   172 TInt RATFileLog::ATFileLogDllUnloaded( const TDesC8& aDllName, TUint32 aStartAddress,
   165                                        TUint32 aEndAddress )
   173                                        TUint32 aEndAddress )
   166 {
   174 {
   167     LOGSTR1( "ATFL CATFileLog::ATFileLogDllUnloaded()" );
   175     LOGSTR1( "ATFL CATFileLog::ATFileLogDllUnloaded()" );
   168 
   176 
       
   177     TInt err( KErrNone );
       
   178     
   169     // log the current time
   179     // log the current time
   170     iFile << this->CurrentTime();
   180     iFile << this->CurrentTime();
   171     
   181     
   172     // DLU <DLL name> <Memory start address> <Memory end address>
   182     // DLU <DLL name> <Memory start address> <Memory end address>
   173     
   183     
   179     iFile << aStartAddress;
   189     iFile << aStartAddress;
   180     //end adress
   190     //end adress
   181     iFile << aEndAddress;
   191     iFile << aEndAddress;
   182     
   192     
   183     // ensure that any buffered data is written to the stream
   193     // ensure that any buffered data is written to the stream
   184     iFile.CommitL();
   194     TRAP( err, iFile.CommitL() );
   185 	
   195 	
   186 	return KErrNone;
   196 	return err;
   187 		
   197 		
   188 }
   198 }
   189 
   199 
   190 
   200 
   191 // -----------------------------------------------------------------------------
   201 // -----------------------------------------------------------------------------
   196 TInt RATFileLog::ATFileLogMemoryAllocated( TUint32 aMemAddress,
   206 TInt RATFileLog::ATFileLogMemoryAllocated( TUint32 aMemAddress,
   197                                   TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
   207                                   TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
   198                                   TInt aSize,  TUint aThreadId  )
   208                                   TInt aSize,  TUint aThreadId  )
   199 {
   209 {
   200 	LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryAllocated()" );
   210 	LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryAllocated()" );
       
   211 	
       
   212 	TInt err( KErrNone );
   201 	
   213 	
   202 	// ALH <Memory address> <Allocation size> <Thread ID> 
   214 	// ALH <Memory address> <Allocation size> <Thread ID> 
   203 	// <Call stack address count> <Call stack address> <Call stack address> ...
   215 	// <Call stack address count> <Call stack address> <Call stack address> ...
   204 	
   216 	
   205 	// log the current time
   217 	// log the current time
   232 		{
   244 		{
   233 	    iFile <<  aCallstack.At( addrPos );
   245 	    iFile <<  aCallstack.At( addrPos );
   234 		}
   246 		}
   235 
   247 
   236 	// ensure that any buffered data is written to the stream
   248 	// ensure that any buffered data is written to the stream
   237 	iFile.CommitL();
   249 	TRAP( err, iFile.CommitL() );
   238 
   250 
   239 	return KErrNone;	
   251 	return err;	
   240 }
   252 }
   241 
   253 
   242 
   254 
   243 // -----------------------------------------------------------------------------
   255 // -----------------------------------------------------------------------------
   244 // RATFileLog::ATFileLogMemoryFreed
   256 // RATFileLog::ATFileLogMemoryFreed
   249 		                                  TFixedArray<TUint32, KATMaxFreeCallstackLength>& aFreeCallstack, 
   261 		                                  TFixedArray<TUint32, KATMaxFreeCallstackLength>& aFreeCallstack, 
   250 		                                  TUint aThreadId )
   262 		                                  TUint aThreadId )
   251 {
   263 {
   252     LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryFreed()" );
   264     LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryFreed()" );
   253 	
   265 	
       
   266     TInt err( KErrNone );
       
   267     
   254 	// FRH <Memory address> <Thread ID> <Call stack address count> 
   268 	// FRH <Memory address> <Thread ID> <Call stack address count> 
   255 	// <Call stack address> <Call stack address> ...
   269 	// <Call stack address> <Call stack address> ...
   256 
   270 
   257 	// log the current time
   271 	// log the current time
   258 	iFile << this->CurrentTime();
   272 	iFile << this->CurrentTime();
   285 		{
   299 		{
   286 		iFile << aFreeCallstack.At( addrPos );
   300 		iFile << aFreeCallstack.At( addrPos );
   287 		}
   301 		}
   288 
   302 
   289 	// ensure that any buffered data is written to the stream
   303 	// ensure that any buffered data is written to the stream
   290 	iFile.CommitL();
   304 	TRAP( err, iFile.CommitL() );
   291 
   305 
   292 	return KErrNone;		
   306 	return err;		
   293 }
   307 }
   294 
   308 
   295 
   309 
   296 // -----------------------------------------------------------------------------
   310 // -----------------------------------------------------------------------------
   297 // RATFileLog::ATFileLogMemoryReallocated
   311 // RATFileLog::ATFileLogMemoryReallocated
   301 TInt RATFileLog::ATFileLogMemoryReallocated( TUint32 aMemAddressFree,  TUint32 aMemAddressAlloc,
   315 TInt RATFileLog::ATFileLogMemoryReallocated( TUint32 aMemAddressFree,  TUint32 aMemAddressAlloc,
   302                                   TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
   316                                   TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
   303                                   TInt aSize,  TUint aThreadId  )
   317                                   TInt aSize,  TUint aThreadId  )
   304 {
   318 {
   305 	LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryReallocated()" );    
   319 	LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryReallocated()" );    
   306 	    
   320 	   
       
   321 	TInt err( KErrNone );
       
   322 	
   307 	// RAH <Freed memory address> <Allocated memory address> <Allocation size> <Thread ID>
   323 	// RAH <Freed memory address> <Allocated memory address> <Allocation size> <Thread ID>
   308 	// <Call stack address count> <Call stack address> <Call stack address> ...
   324 	// <Call stack address count> <Call stack address> <Call stack address> ...
   309 	        
   325 	        
   310     // log the current time
   326     // log the current time
   311     iFile << this->CurrentTime();
   327     iFile << this->CurrentTime();
   340 		// Append call stack address.
   356 		// Append call stack address.
   341 		iFile << aCallstack.At( addrPos );
   357 		iFile << aCallstack.At( addrPos );
   342 		}
   358 		}
   343 
   359 
   344 	// ensure that any buffered data is written to the stream
   360 	// ensure that any buffered data is written to the stream
   345 	iFile.CommitL();
   361 	TRAP( err, iFile.CommitL() );
   346 
   362 
   347 	return KErrNone;	
   363 	return err;	
   348 }
   364 }
   349 
   365 
   350 
   366 
   351 // -----------------------------------------------------------------------------
   367 // -----------------------------------------------------------------------------
   352 // RATFileLog::ATFileLogThreadStarted
   368 // RATFileLog::ATFileLogThreadStarted
   355 // 
   371 // 
   356 TInt RATFileLog::ATFileLogThreadStarted( TUint aThreadId )
   372 TInt RATFileLog::ATFileLogThreadStarted( TUint aThreadId )
   357 {
   373 {
   358 	LOGSTR1( "ATFL CATFileLog::ATFileLogThreadStarted()" );
   374 	LOGSTR1( "ATFL CATFileLog::ATFileLogThreadStarted()" );
   359 
   375 
       
   376 	TInt err( KErrNone );
       
   377 	
   360 	// log the current time
   378 	// log the current time
   361 	iFile << this->CurrentTime();
   379 	iFile << this->CurrentTime();
   362 	
   380 	
   363 	// TDS <Thread ID>
   381 	// TDS <Thread ID>
   364 
   382 
   366 	iFile << (TUint8)EThreadStart;
   384 	iFile << (TUint8)EThreadStart;
   367 	// thread ID
   385 	// thread ID
   368 	iFile << (TUint32)aThreadId;
   386 	iFile << (TUint32)aThreadId;
   369     
   387     
   370     // ensure that any buffered data is written to the stream
   388     // ensure that any buffered data is written to the stream
   371     iFile.CommitL();
   389 	TRAP( err, iFile.CommitL() );
   372 
   390 
   373 	return KErrNone;
   391 	return err;
   374 }
   392 }
   375 
   393 
   376 
   394 
   377 // -----------------------------------------------------------------------------
   395 // -----------------------------------------------------------------------------
   378 // RATFileLog::ATFileLogThreadEnded
   396 // RATFileLog::ATFileLogThreadEnded
   379 // 
   397 // 
   380 // -----------------------------------------------------------------------------
   398 // -----------------------------------------------------------------------------
   381 // 
   399 // 
   382 TInt RATFileLog::ATFileLogThreadEnded( TUint64 aThreadId )
   400 TInt RATFileLog::ATFileLogThreadEnded( TUint64 aThreadId )
   383 {
   401 {
   384 	  LOGSTR1( "ATFL CATFileLog::ATFileLogThreadEnded()" );
   402     LOGSTR1( "ATFL CATFileLog::ATFileLogThreadEnded()" );
   385 
   403     
   386 		// log the current time
   404     TInt err( KErrNone );
   387 		iFile << this->CurrentTime();
   405     
   388 		
   406     // log the current time
   389 		// TDE <Thread ID>
   407     iFile << this->CurrentTime();
   390 
   408     
   391 		// TDE
   409     // TDE <Thread ID>
   392 		iFile << (TUint8)EThreadEnd;
   410     
   393 		// thread ID
   411     // TDE
   394 		iFile << (TUint32)aThreadId;
   412     iFile << (TUint8)EThreadEnd;
   395 	    
   413     // thread ID
   396 	    // ensure that any buffered data is written to the stream
   414     iFile << (TUint32)aThreadId;
   397 	    iFile.CommitL();
   415     
   398 
   416     // ensure that any buffered data is written to the stream
   399 		return KErrNone;
   417     TRAP( err, iFile.CommitL() );
       
   418     
       
   419     return err;
   400 }
   420 }
   401 
   421 
   402 
   422 
   403 // -----------------------------------------------------------------------------
   423 // -----------------------------------------------------------------------------
   404 // RATFileLog::ATFileLogDeviceInfo
   424 // RATFileLog::ATFileLogDeviceInfo
   408 TInt RATFileLog::ATFileLogDeviceInfo( const TDesC8& aS60Version, const TDesC8& aChecksum)
   428 TInt RATFileLog::ATFileLogDeviceInfo( const TDesC8& aS60Version, const TDesC8& aChecksum)
   409 
   429 
   410 {
   430 {
   411     LOGSTR1( "ATFL CATFileLog::ATFileLogVersionsInfo()" );
   431     LOGSTR1( "ATFL CATFileLog::ATFileLogVersionsInfo()" );
   412 
   432 
       
   433     TInt err( KErrNone );
       
   434     
   413     // log the current time
   435     // log the current time
   414     iFile << this->CurrentTime();
   436     iFile << this->CurrentTime();
   415 
   437 
   416     // VER
   438     // VER
   417     iFile << (TUint8)EDeviceInfo;
   439     iFile << (TUint8)EDeviceInfo;
   419     iFile << aS60Version;
   441     iFile << aS60Version;
   420     // rom checksum
   442     // rom checksum
   421     iFile << aChecksum;
   443     iFile << aChecksum;
   422 
   444 
   423     // ensure that any buffered data is written to the stream
   445     // ensure that any buffered data is written to the stream
   424     iFile.CommitL();
   446     TRAP( err, iFile.CommitL() );
   425 
   447 
   426 	return KErrNone;	
   448 	return err;	
   427 }
   449 }
   428 
   450 
   429 
   451 
   430 
   452 
   431 // -----------------------------------------------------------------------------
   453 // -----------------------------------------------------------------------------