piprofiler/plugins/DebugOutputWriterPlugin/src/DebOutWriterPlugin.cpp
branchRCL_3
changeset 19 da2cedce4920
equal deleted inserted replaced
18:d27dfa8884ad 19:da2cedce4920
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  Include Files  
       
    20 
       
    21 #include "DebOutWriterPlugin.h"	
       
    22 #include <e32base.h>
       
    23 //#include <piprofiler/EngineUIDs.h>
       
    24 #include <piprofiler/ProfilerTraces.h>
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include <OpenSystemTrace.h>
       
    27 #include "DebOutWriterPluginTraces.h"
       
    28 #endif
       
    29 
       
    30 // engine properties
       
    31 const TUid KEngineStatusPropertyCat={0x2001E5AD};
       
    32 enum TEnginePropertyKeys
       
    33     {
       
    34     EProfilerEngineStatus = 8,
       
    35     EProfilerErrorStatus
       
    36     };
       
    37 
       
    38 // CONSTANTS
       
    39 // own UID
       
    40 const TUid KDebOutWriterPluginUid = { 0x2001E5BA };
       
    41 
       
    42 //  Member Functions
       
    43 /*
       
    44  *
       
    45  *	Class CDebOutWriterPlugin implementation
       
    46  *
       
    47  */
       
    48 
       
    49 CDebOutWriterPlugin* CDebOutWriterPlugin::NewL(const TUid /*aImplementationUid*/, TAny* /*aInitParams*/)
       
    50 {
       
    51 	LOGTEXT(_L("CDebOutWriterPlugin::NewL() - entry"));
       
    52 	CDebOutWriterPlugin* self = new (ELeave) CDebOutWriterPlugin(KDebOutWriterPluginUid);
       
    53     CleanupStack::PushL( self );
       
    54     self->ConstructL();
       
    55     CleanupStack::Pop();
       
    56 	LOGTEXT(_L("CDebOutWriterPlugin::NewL() - exit"));
       
    57     return self;
       
    58 }
       
    59 
       
    60 CDebOutWriterPlugin::CDebOutWriterPlugin(const TUid aImplementationUid) :
       
    61 	iWriterType(aImplementationUid.iUid)
       
    62     {
       
    63     LOGTEXT(_L("CDebOutWriterPlugin::CDebOutWriterPlugin - entry"));
       
    64     isEnabled = EFalse;
       
    65     iWriterId = Id().iUid;
       
    66     LOGTEXT(_L("CDebOutWriterPlugin::CDebOutWriterPlugin - exit"));
       
    67     }
       
    68 
       
    69 CDebOutWriterPlugin::~CDebOutWriterPlugin()
       
    70     {
       
    71     LOGTEXT(_L("CDebOutWriterPlugin::~CDebOutWriterPlugin - entry"));
       
    72 
       
    73     iErrorStatus.Close();
       
    74     
       
    75     if(iWriterHandler)
       
    76         {
       
    77         iWriterHandler->Cancel();
       
    78         delete iWriterHandler;
       
    79         }
       
    80     LOGTEXT(_L("CDebOutWriterPlugin::~CDebOutWriterPlugin - exit"));
       
    81     }    
       
    82     
       
    83 void CDebOutWriterPlugin::ConstructL()
       
    84 	{
       
    85 	// second phase constructor, anything that may leave must be constructed here
       
    86 
       
    87 	LOGTEXT(_L("CDebOutWriterPlugin::ConstructL() - entry"));
       
    88 	iWriterHandler = CDebOutWriterHandler::NewL(this);
       
    89     User::LeaveIfError(iErrorStatus.Attach(KEngineStatusPropertyCat, EProfilerErrorStatus));
       
    90     
       
    91 	LOGTEXT(_L("CDebOutWriterPlugin::ConstructL() - exit"));
       
    92 	}
       
    93 
       
    94 TInt CDebOutWriterPlugin::Start()
       
    95 	{
       
    96 	LOGTEXT(_L("CDebOutWriterPlugin::Start() - entry"));
       
    97 	
       
    98 #ifdef OST_TRACE_COMPILER_IN_USE
       
    99     TInt err(KErrNone);
       
   100 	// activate traces on TraceCore
       
   101     RTcDriverParameters tcdp_ThreadIdentification;
       
   102     tcdp_ThreadIdentification.iComponentId = KOstTraceComponentID;
       
   103     tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64START;
       
   104     err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
       
   105 
       
   106     tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64LINE;
       
   107     err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
       
   108 
       
   109     tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64FIN;
       
   110     err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
       
   111 
       
   112     tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64END;
       
   113     err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
       
   114 
       
   115     RDebug::Print(_L("Debug output activated"));
       
   116     if(err != KErrNone)
       
   117         RDebug::Print(_L("TraceCore LDD API responded: %d"), err);
       
   118 #endif
       
   119 
       
   120 	LOGTEXT(_L("CDebOutWriterPlugin::Start() - exit"));
       
   121 	return KErrNone;
       
   122 	}
       
   123 
       
   124 void CDebOutWriterPlugin::Stop()
       
   125 	{
       
   126 	LOGTEXT(_L("CDebOutWriterPlugin::Stop() - entry"));
       
   127 	iWriterHandler->Stop();
       
   128 #ifdef OST_TRACE_COMPILER_IN_USE
       
   129 	TInt err(KErrNone);
       
   130     // activate traces on TraceCore
       
   131     RTcDriverParameters tcdp_ThreadIdentification;
       
   132     tcdp_ThreadIdentification.iComponentId = KOstTraceComponentID;
       
   133     tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64START;
       
   134     err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
       
   135 
       
   136     tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64LINE;
       
   137     err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
       
   138 
       
   139     tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64FIN;
       
   140     err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
       
   141 
       
   142     tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64END;
       
   143     err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
       
   144 
       
   145     RDebug::Print(_L("Debug output deactivated"));
       
   146     if(err != KErrNone)
       
   147         RDebug::Print(_L("TraceCore LDD API responded: %d"), err);
       
   148 #endif
       
   149 	LOGTEXT(_L("CDebOutWriterPlugin::Stop() - exit"));
       
   150 	}
       
   151 
       
   152 TUid CDebOutWriterPlugin::Id() const
       
   153 	{
       
   154     LOGSTRING2("CDebOutWriterPlugin::Id(): 0x%X", KDebOutWriterPluginUid.iUid );
       
   155     return KDebOutWriterPluginUid;
       
   156 	//return iDtor_ID_Key;
       
   157 	}
       
   158 
       
   159 TBool CDebOutWriterPlugin::GetEnabled()
       
   160 	{
       
   161 	return isEnabled;
       
   162 	}
       
   163 
       
   164 void CDebOutWriterPlugin::SetValue( const TWriterPluginValueKeys aKey,
       
   165                                     TDes& aValue )
       
   166     {
       
   167     TRAP_IGNORE( SetValueL( aKey, aValue ) );
       
   168     }
       
   169 
       
   170 
       
   171 void CDebOutWriterPlugin::GetValue( const TWriterPluginValueKeys aKey,
       
   172                                     TDes& aValue )
       
   173     {
       
   174     TRAP_IGNORE( GetValueL( aKey, aValue ) );
       
   175     }
       
   176 
       
   177 
       
   178 
       
   179 void CDebOutWriterPlugin::SetValueL( const TWriterPluginValueKeys aKey, TDes& /*aValue*/ )
       
   180 {
       
   181 	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - entry"));	
       
   182 	
       
   183     switch( aKey )
       
   184         {
       
   185         case EWriterPluginEnabled:
       
   186             isEnabled = ETrue;
       
   187         	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin enabled"));
       
   188         	break;
       
   189         case EWriterPluginDisabled:
       
   190             isEnabled = EFalse;
       
   191         	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin disabled"));	
       
   192             break;
       
   193         case EWriterPluginSettings:
       
   194         	//result = StringLoader::LoadL(PROFILER_KERNEL_MODE_SAMPLER);
       
   195         	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - setting plugin settings"));	
       
   196         	break;
       
   197         default:
       
   198         	break;
       
   199         }
       
   200 	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - exit"));	
       
   201 
       
   202 }
       
   203 
       
   204 TUint32 CDebOutWriterPlugin::GetWriterType()
       
   205 	{
       
   206 	return iWriterType;
       
   207 	}
       
   208 
       
   209 
       
   210 void CDebOutWriterPlugin::GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue )
       
   211     {
       
   212     switch( aKey )
       
   213         {
       
   214         case EWriterPluginVersion:
       
   215 
       
   216         	GetWriterVersion(&aValue);
       
   217         	break;
       
   218         case EWriterPluginType:
       
   219         	break;
       
   220            default:
       
   221                 break;
       
   222         }
       
   223     }
       
   224 
       
   225 void CDebOutWriterPlugin::GetWriterVersion(TDes* aDes)
       
   226 	{
       
   227 	_LIT(KDebugOutputWriterVersion, "1.0.0");
       
   228 	aDes->Append(KDebugOutputWriterVersion);
       
   229 	}
       
   230 
       
   231 void CDebOutWriterPlugin::DoCancel()
       
   232 {
       
   233 	LOGTEXT(_L("CDebOutWriterPlugin::DoCancel - entry"));
       
   234 }
       
   235 
       
   236 void CDebOutWriterPlugin::WriteData()
       
   237     {
       
   238     // Activate handler to write data from buffer to output
       
   239     LOGTEXT(_L("CDiskWriterPlugin::WriteData() - entry"));
       
   240     TRAP_IGNORE(iWriterHandler->StartL());
       
   241     LOGTEXT(_L("CDiskWriterPlugin::WriteData() - exit"));
       
   242     }
       
   243 
       
   244 void CDebOutWriterPlugin::HandleError(TInt aError)
       
   245     {
       
   246     TInt err(KErrNone);
       
   247     err = iErrorStatus.Set(aError);
       
   248     if(err != KErrNone)
       
   249         {
       
   250         RDebug::Print(_L("CDiskWriterPlugin::HandleError() - error: %d"), err);
       
   251         }
       
   252     }
       
   253 
       
   254 void CDebOutWriterPlugin::PrintDescriptorAsBase64(	TDesC8& aDes,
       
   255                                                     TRequestStatus* aStatus,
       
   256 													TUint32 sampleTime,
       
   257 													TBool aEmptying)
       
   258 {
       
   259 	LOGTEXT(_L("CDebOutWriterPlugin::PrintDescriptorAsBase64() - entry"));
       
   260 	TUint len = aDes.Length();
       
   261 
       
   262 	// we must wait for the sample tick to be printed, in case
       
   263 	// prints are performed at user side, otherwise the kernel
       
   264 	// prints will corrupt the data
       
   265 	if(sampleTime != 0xffffffff)
       
   266 	{
       
   267 		TUint32 remains = sampleTime%1000;
       
   268 	
       
   269 		if(remains > 800) 
       
   270 		{
       
   271 			TTimeIntervalMicroSeconds32 timeToWait = ((1050-remains)*1000);
       
   272 			User::After(timeToWait);
       
   273 		}
       
   274 	}
       
   275 	
       
   276 	TBuf16<75> buf;
       
   277 
       
   278 	// Header
       
   279 #ifdef OST_TRACE_COMPILER_IN_USE
       
   280     OstTrace0( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64START, 
       
   281             "<PIPROF>=================================================================" );
       
   282 #else
       
   283 	RDebug::Print(_L("<PIPROF>================================================================="));
       
   284 #endif
       
   285 	buf.Zero();
       
   286 
       
   287 	// base64 encoding table
       
   288 	const char uu_base64[64] =
       
   289 	{
       
   290 		'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
       
   291 		'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
       
   292 		'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
       
   293 		'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
       
   294 		'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
       
   295 		'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
       
   296 		'w', 'x', 'y', 'z', '0', '1', '2', '3',
       
   297 		'4', '5', '6', '7', '8', '9', '+', '/'
       
   298 	};
       
   299 
       
   300 	TChar byte1, byte2, byte3, byte4;
       
   301 	TUint8 count = 0x30;
       
   302 	// base64 encoding 
       
   303 	for(TUint i = 0, j = 0; i < len; i += 3, j = (j + 1) % 18) 
       
   304 	{
       
   305     // byte 1
       
   306 		byte1 = uu_base64[(aDes[i] >> 2) & 0x3F];
       
   307 		
       
   308 		// byte 2
       
   309 		if(i+1 < len)
       
   310 			byte2 = uu_base64[(aDes[i] << 4) & 0x3f | (aDes[i+1] >> 4)];
       
   311 		else
       
   312 			byte2 = uu_base64[(aDes[i] << 4) & 0x3f];
       
   313 
       
   314 		// byte 3
       
   315 		if(i+1 < len && i+2 < len)
       
   316 			byte3 = uu_base64[(aDes[i+1] << 2) & 0x3f | (aDes[i+2] >> 6)];
       
   317 		else if(i+1 < len)
       
   318 			byte3 = uu_base64[(aDes[i+1] << 2) & 0x3f];
       
   319 		else
       
   320 			byte3 = '=';
       
   321 
       
   322 		// byte 4
       
   323 		if(i+2 < len) 
       
   324 			byte4 = uu_base64[aDes[i+2] & 0x3f];
       
   325 		else
       
   326 			byte4 = '=';
       
   327 	
       
   328 		// append to buffer
       
   329 		buf.Append(byte1);
       
   330 		buf.Append(byte2);
       
   331 		buf.Append(byte3);
       
   332 		buf.Append(byte4);
       
   333 
       
   334 		// output 72 chars / line
       
   335 		if(j == 17) 
       
   336 		{		
       
   337 			// add check number at the end of line
       
   338 			buf.Append(count);
       
   339 #ifdef OST_TRACE_COMPILER_IN_USE
       
   340 			OstTraceExt1( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64LINE, "<PIPROF>%S", &buf );
       
   341 #else
       
   342 			RDebug::Print(_L("<PIPROF>%S"),&buf);
       
   343 #endif
       
   344 			count++;
       
   345 			if(count > 0x39)
       
   346 				count = 0x30;
       
   347 			buf.Zero();
       
   348 		}
       
   349 	}
       
   350 	
       
   351 #ifdef OST_TRACE_COMPILER_IN_USE
       
   352 	OstTraceExt1( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64FIN, "<PIPROF>%S", &buf );
       
   353 #else
       
   354 	RDebug::Print(_L("<PIPROF>%S"),&buf);
       
   355 #endif
       
   356 	buf.Zero();
       
   357 
       
   358 	// footer
       
   359 #ifdef OST_TRACE_COMPILER_IN_USE
       
   360 	OstTrace0( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64END, 
       
   361 	        "<PIPROF>=================================================================" );
       
   362 #else
       
   363 	RDebug::Print(_L("<PIPROF>================================================================="));
       
   364 #endif
       
   365 
       
   366 	if(!aEmptying)
       
   367 	    {
       
   368         if(aStatus != 0) 
       
   369             User::RequestComplete(aStatus,0);
       
   370 	    }
       
   371 	
       
   372 	LOGTEXT(_L("CDebOutWriterPlugin::PrintDescriptorAsBase64() - exit"));
       
   373 }
       
   374 
       
   375 
       
   376 
       
   377 /*
       
   378  * 
       
   379  * Implementation of class CDebOutWriterHandler
       
   380  * 
       
   381  */
       
   382 CDebOutWriterHandler::CDebOutWriterHandler(CDebOutWriterPlugin* aWriter) :
       
   383     CActive(EPriorityStandard)
       
   384     {
       
   385     LOGTEXT(_L("CDebOutWriterHandler::CDebOutWriterHandler - entry"));
       
   386     iWriter = aWriter;
       
   387     
       
   388     // set initial mode to non-stopping
       
   389     iStopping = EFalse;
       
   390     
       
   391     // add the handler to the active scheduler
       
   392     CActiveScheduler::Add(this);
       
   393     LOGTEXT(_L("CDebOutWriterHandler::CDebOutWriterHandler - exit"));
       
   394     }
       
   395 
       
   396 CDebOutWriterHandler* CDebOutWriterHandler::NewL(CDebOutWriterPlugin* aWriter)
       
   397 {
       
   398 	LOGTEXT(_L("CDebOutWriterHandler::NewL() - entry"));
       
   399 	CDebOutWriterHandler* self = new (ELeave) CDebOutWriterHandler(aWriter);
       
   400     CleanupStack::PushL( self );
       
   401     self->ConstructL();
       
   402     CleanupStack::Pop();
       
   403 	LOGTEXT(_L("CDebOutWriterHandler::NewL() - exit"));
       
   404     return self;
       
   405 }
       
   406 
       
   407 CDebOutWriterHandler::~CDebOutWriterHandler()
       
   408     {
       
   409 	LOGTEXT(_L("CDebOutWriterHandler::~CDebOutWriterHandler - entry"));
       
   410     
       
   411     LOGTEXT(_L("CDebOutWriterHandler::~CDebOutWriterHandler - exit"));
       
   412     }    
       
   413     
       
   414 void CDebOutWriterHandler::ConstructL()
       
   415 	{
       
   416 
       
   417 	}
       
   418 
       
   419 void CDebOutWriterHandler::StartL()
       
   420 	{
       
   421 	LOGTEXT(_L("CDebOutWriterHandler::StartL - entry"));
       
   422     if(!IsActive())
       
   423         {
       
   424         LOGTEXT(_L("CDiskWriterHandler::StartL - is not active"));
       
   425     
       
   426         TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
       
   427         LOGSTRING2("CDiskWriterHandler::StartL - got next filled 0x%x",nextBuf);
       
   428     
       
   429         if(nextBuf != 0)
       
   430             {
       
   431             LOGTEXT(_L("CDiskWriterHandler::StartL - writing to file"));
       
   432             WriteBufferToOutput(nextBuf);
       
   433             }
       
   434         }
       
   435 	LOGTEXT(_L("CDebOutWriterHandler::StartL - entry"));
       
   436 	}
       
   437 
       
   438 void CDebOutWriterHandler::Stop()
       
   439 	{
       
   440 	LOGTEXT(_L("CDebOutWriterHandler::Stop - entry"));
       
   441    
       
   442 	// do write once more to write the logged data to output
       
   443     // set to stopping mode, needed for emptying the remaining full buffers
       
   444     iStopping = ETrue;
       
   445 
       
   446     // stop the timer
       
   447     Reset();
       
   448 
       
   449     // set mode back to non-stopping
       
   450     iStopping = EFalse;
       
   451 	LOGTEXT(_L("CDebOutWriterHandler::Stop - exit"));
       
   452 	}
       
   453 
       
   454 void CDebOutWriterHandler::Reset()
       
   455     {
       
   456   
       
   457     // start writing new buffer if there is one available
       
   458     TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
       
   459     
       
   460     // empty the rest of the buffers synchronously
       
   461     while(nextBuf != 0)
       
   462         {
       
   463         if(nextBuf->iDataSize != 0)
       
   464             {
       
   465             LOGTEXT(_L("CDiskWriterHandler::Reset - writing to file"));
       
   466             iWriter->PrintDescriptorAsBase64(*(nextBuf->iBufDes),&iStatus,0xffffffff, iStopping);
       
   467             }
       
   468         
       
   469         // empty buffers when profiling stopped
       
   470         iWriter->iStream->AddToFreeBuffers(nextBuf);
       
   471 
       
   472         LOGTEXT(_L("CDiskWriterHandler::Reset - get next full buffer"));
       
   473         // start writing new buffer if there is one available
       
   474         nextBuf = iWriter->iStream->GetNextFilledBuffer();
       
   475         LOGSTRING2("CDiskWriterHandler::Reset - got next filled 0x%x",nextBuf);
       
   476         }
       
   477     }
       
   478 
       
   479 void CDebOutWriterHandler::HandleFullBuffers()
       
   480     {
       
   481     LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - entry"));
       
   482     // previous write operation has finished
       
   483     // release the previous buffer 
       
   484     iWriter->iStream->AddToFreeBuffers(iBufferBeingWritten);
       
   485 
       
   486     LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - get next full buffer"));
       
   487     // start writing new buffer if there is one available
       
   488     TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
       
   489 
       
   490     if(nextBuf != 0)
       
   491         {
       
   492         LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - writing to file"));
       
   493         if(nextBuf->iDataSize != 0)
       
   494             {
       
   495             WriteBufferToOutput(nextBuf);
       
   496             }
       
   497         } 
       
   498     LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - exit"));
       
   499     }
       
   500 
       
   501 void CDebOutWriterHandler::RunL()
       
   502     {
       
   503     // call function to complete full buffer handling
       
   504     HandleFullBuffers();
       
   505     }
       
   506 
       
   507 void CDebOutWriterHandler::DoCancel()
       
   508     {
       
   509     
       
   510     }
       
   511 
       
   512 void CDebOutWriterHandler::WriteBufferToOutput(TBapBuf* aBuf)
       
   513     {
       
   514     LOGTEXT(_L("CDebOutWriterHandler::WriteBufferToOutput - entry"));
       
   515     iBufferBeingWritten = aBuf;
       
   516 
       
   517     // set the data length just to be sure
       
   518     iBufferBeingWritten->iBufDes->SetLength(aBuf->iDataSize);
       
   519 
       
   520     LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - writing to file"));
       
   521 //    PrintBufferToOutput(iBufferBeingWritten, iStatus);
       
   522     iWriter->PrintDescriptorAsBase64(*(iBufferBeingWritten->iBufDes),&iStatus,0xffffffff, iStopping);
       
   523     // set AO back to active, until filled buffers are emptied 
       
   524     SetActive();
       
   525     
       
   526     LOGTEXT(_L("CDebOutWriterHandler::WriteBufferToOutput - exit"));
       
   527     }
       
   528 
       
   529 // private
       
   530 void CDebOutWriterHandler::PrintBufferToOutput(TBapBuf* aBuffer, TRequestStatus& aStatus)
       
   531     {
       
   532     LOGTEXT(_L("CDebOutWriterHandler::WriteBufferToOutput() - debug out writer tick activated"));
       
   533 
       
   534     TPtrC8& aDes = (TPtrC8&)*(aBuffer->iBufDes);
       
   535 #ifdef BAPPEA_SAMPLE_MARKS
       
   536     TUint32 time = iSampler->GetSampleTime();
       
   537 #else
       
   538     TUint32 time = 0xffffffff;
       
   539 #endif
       
   540     iWriter->PrintDescriptorAsBase64(aDes,&aStatus,time, iStopping);
       
   541     }
       
   542