traceservices/tracefw/integ_test/ulogger/TEF/te_ulogger/src/te_uloggermclperfstep.cpp
changeset 0 08ec8eefde2f
child 23 26645d81f48d
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Example CTestStep derived implementation
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file te_uloggermclperfstep.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "te_uloggermclperfstep.h"
       
    23 #include "te_uloggermclsuitedefs.h"
       
    24 #include <e32math.h>
       
    25 
       
    26 using namespace Ulogger;
       
    27 
       
    28 ////////////////////////////////////////////////////////////////////////
       
    29 ////////////////////////////////////////////////////////////////////////
       
    30 //////////////////////////////////USER SIDE/////////////////////////////
       
    31 ////////////////////////////////////////////////////////////////////////
       
    32 ////////////////////////////////////////////////////////////////////////
       
    33 
       
    34 CULoggerMCLUserPerfStep::~CULoggerMCLUserPerfStep()
       
    35 /**
       
    36  * Destructor
       
    37  */
       
    38 	{
       
    39 	}
       
    40 
       
    41 CULoggerMCLUserPerfStep::CULoggerMCLUserPerfStep()
       
    42 /**
       
    43  * Constructor
       
    44  */
       
    45 	{
       
    46 		SetTestStepName(KULoggerMCLUserPerfStep);
       
    47 	}
       
    48 
       
    49 TVerdict CULoggerMCLUserPerfStep::doTestStepPreambleL()
       
    50 /**
       
    51  * @return - TVerdict code
       
    52  * Override of base class virtual
       
    53  */
       
    54 	{
       
    55 		INFO_PRINTF1(_L("Carrying out performance testing on user side tracing for file and serial plugins"));
       
    56 		SetTestStepResult(EPass);
       
    57 		return TestStepResult();
       
    58 	}
       
    59 
       
    60 
       
    61 TVerdict CULoggerMCLUserPerfStep::doTestStepL()
       
    62 /**
       
    63  * @return - TVerdict code
       
    64  * Override of base class pure virtual
       
    65  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
    66  * not leave. That being the case, the current test result value will be EPass.
       
    67  */
       
    68 	{
       
    69 	  	if (TestStepResult()==EPass)
       
    70 		{
       
    71 		//  ************** Delete the Block, the block start ****************
       
    72 			INFO_PRINTF1(_L("Benchmark trace logging for the file plug-in"));
       
    73 			 __CREATE_LOG(true);
       
    74 			 __HIRES_RESOLUTION;
       
    75 			TInt fastTimerFreq;
       
    76 			HAL::Get(HALData::EFastCounterFrequency, fastTimerFreq);
       
    77 			TReal ticksPerMicroSec = 1.0E-6 * fastTimerFreq;	
       
    78 			TUint32 prevTime;
       
    79 			TUint32 timeDiff;
       
    80 			TReal timeSpentToTrace;
       
    81 			bool ret=1;
       
    82 			CUTraces Testtracer;
       
    83 			TUTrace TestTraceObject(UTracePrimary, UTraceSecondary, schema, context, pc);
       
    84 			TInt Result=0;
       
    85 			/***Now set file plugins and filter settings****/
       
    86 			RULogger logger;
       
    87 			logger.Connect();
       
    88 			CClearConfig configIni;
       
    89 			configIni.Clear(logger);
       
    90 			CArrayFixFlat<TUint8> *setprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
    91 			setprimfilter->AppendL(UTracePrimary);
       
    92 			RArray<TUint32> setsecondfilter;
       
    93 			setsecondfilter.Append((TUint32) UTraceSecondary);
       
    94 			logger.SetPrimaryFiltersEnabled(*setprimfilter,ETrue);
       
    95 			logger.SetSecondaryFiltersEnabled(setsecondfilter,ETrue);
       
    96 		
       
    97 			///////////////////////////////////////////////////////////
       
    98 			///////////////////////////////////////////////////////////
       
    99 			/////////////////////////FILE//////////////////////////////
       
   100 			///////////////////////////////////////////////////////////
       
   101 			///////////////////////////////////////////////////////////
       
   102 	
       
   103 			INFO_PRINTF1(_L("about to set file as output plugin"));
       
   104 			//NB: this of course assumes that the plugin functionality works which is tested more rigorously in the plugin test step
       
   105 			if(Result==0)	
       
   106 			{
       
   107 				INFO_PRINTF1(_L("file set as output plugin ok"));
       
   108 				_LIT8(KTextmedia,"uloggerfileplugin");
       
   109 				TPtrC8 mediaptr(KTextmedia);
       
   110 				Result=logger.ActivateOutputPlugin(mediaptr);
       
   111 				if(Result==0||Result==-11)
       
   112 				{	
       
   113 					INFO_PRINTF1(_L("file set as active output plugin ok"));
       
   114 					_LIT(KTextsetting, "output_path");
       
   115 					_LIT(KTextvalue, "c:\\logs\\ULoggerPerfUserSideFileLogging.log");
       
   116 					TPluginConfiguration setPluginConfigs;
       
   117 					setPluginConfigs.SetKey(KTextsetting);
       
   118 					setPluginConfigs.SetValue(KTextvalue);
       
   119 					Result=logger.SetPluginConfigurations(mediaptr, setPluginConfigs);
       
   120 					if(Result==0)
       
   121 						INFO_PRINTF1(_L("output plugin settings set ok"));
       
   122 					else
       
   123 						INFO_PRINTF1(_L("setting output plugin settings failed"));
       
   124 				}
       
   125 				else
       
   126 					INFO_PRINTF1(_L("file not set as active output plugin - failed"));
       
   127 			}
       
   128 			else
       
   129 				INFO_PRINTF1(_L("add file as output plugin failed"));
       
   130 			/***Now carry out performance benchmarking and tracing for NonStatic SET method to file****/
       
   131 			__LOG("Trace times for 10,000 user side nonstatic set traces logging to file plugin");
       
   132 #ifdef FILE_PERF	
       
   133 			for(int tracetag=0;tracetag!=NumberOfUTraceMacros;tracetag++)
       
   134 			{
       
   135 				logger.Start();
       
   136  			 	__LOG("NONStatic Trace ID: ")
       
   137  			 	__LOGNUM(tracetag)	 
       
   138 				ret = 0;
       
   139 				timeDiff=0;
       
   140 				for(int i=0;i!=StatAverage;i++)
       
   141 				{
       
   142 					User::After(Math::Random()%100000);
       
   143 					prevTime = User::FastCounter();
       
   144 					for(int i=0;i!=UTrace_Cache_Count;i++)
       
   145 						ret = Testtracer.DoTheSetTrace(tracetag, TestTraceObject);
       
   146 					timeDiff += User::FastCounter() - prevTime;
       
   147 				}
       
   148 				timeSpentToTrace = timeDiff/ticksPerMicroSec/StatAverage;
       
   149 				INFO_PRINTF5(_L("Utrace macro %d trace, size %d (%d trace(s))= %10.6lf microseconds"), tracetag, Testtracer.SizeOfTrace(tracetag), UTrace_Cache_Count, timeSpentToTrace);
       
   150 				INFO_PRINTF2(_L("Time per trace = %10.6e microseconds"),timeSpentToTrace/UTrace_Count );
       
   151 				logger.Stop();
       
   152 			}
       
   153 			if(ret==0)
       
   154 				INFO_PRINTF1(_L("tracing failed from UTrace"));
       
   155 			/***Now carry out performance benchmarking and tracing for Static method to file****/
       
   156 			__LOG("Trace times for 10,000 user side static traces logging to file plugin");
       
   157 			for(int tracetag=0;tracetag!=NumberOfUTraceMacros;tracetag++)
       
   158 			{
       
   159 				logger.Start();
       
   160  			 	__LOG("Static Trace ID: ")
       
   161  			 	__LOGNUM(tracetag)	 
       
   162 				ret = 0;
       
   163 				timeDiff=0;
       
   164 				for(int i=0;i!=StatAverage;i++)
       
   165 				{
       
   166 					User::After(Math::Random()%100000);
       
   167 					prevTime = User::FastCounter();
       
   168 					for(int i=0;i!=UTrace_Cache_Count;i++)
       
   169 						ret = Testtracer.DoTheStaticTrace(tracetag);
       
   170 					timeDiff += User::FastCounter() - prevTime;
       
   171 				}
       
   172 				timeSpentToTrace = timeDiff/ticksPerMicroSec/StatAverage;
       
   173 				INFO_PRINTF5(_L("Utrace macro %d trace, size %d (%d trace(s))= %10.6lf microseconds"), tracetag, Testtracer.SizeOfTrace(tracetag), UTrace_Cache_Count, timeSpentToTrace);
       
   174 				INFO_PRINTF2(_L("Time per trace = %10.6e microseconds"),timeSpentToTrace/UTrace_Count );
       
   175 				logger.Stop();
       
   176 			}
       
   177 			if(ret==0)
       
   178 				INFO_PRINTF1(_L("tracing failed from UTrace"));
       
   179 #endif	//file
       
   180 	
       
   181 			///////////////////////////////////////////////////////////
       
   182 			///////////////////////////////////////////////////////////
       
   183 			////////////////////////SERIAL/////////////////////////////
       
   184 			///////////////////////////////////////////////////////////
       
   185 			///////////////////////////////////////////////////////////
       
   186 		
       
   187 			INFO_PRINTF1(_L("Now benchmark trace logging for the serial plug-in"));
       
   188 			// adding a plugin
       
   189 			_LIT8(KSerialTextmedia,"uloggerserialplugin");
       
   190 			TPtrC8 serialmediaptr(KSerialTextmedia);
       
   191 			Result=logger.ActivateOutputPlugin(serialmediaptr);
       
   192 			if(Result==0)			
       
   193 			{	
       
   194 			// test the added plugin can be activated
       
   195 				if(Result==0||Result==-11)	
       
   196 				{	
       
   197 					INFO_PRINTF1(_L("Serial Plugin active"));
       
   198 					_LIT(KSerialTextsetting, "output_port");	
       
   199 					_LIT(KSerialTextvalue, "3");
       
   200 					// test setting the plugin settings
       
   201 					TPluginConfiguration setSerialPluginConfigs;
       
   202 					setSerialPluginConfigs.SetKey(KSerialTextsetting);
       
   203 					setSerialPluginConfigs.SetValue(KSerialTextvalue);				
       
   204 					Result=logger.SetPluginConfigurations(serialmediaptr, setSerialPluginConfigs);
       
   205 					if(Result==0)	
       
   206 					{
       
   207 						INFO_PRINTF1(_L("Serial Plugin Settings set correctly"));
       
   208 					}
       
   209 				}
       
   210 				else
       
   211 					INFO_PRINTF1(_L("Serial plugin not set as active plugin"));
       
   212 			}
       
   213 			__LOG("Trace times for 10,000 user side nonstatic traces logging to serial plugin");
       
   214 			/***Now carry out performance benchmarking and tracing for nonstatic set method to serial****/
       
   215 #ifdef SERIAL_PERF
       
   216 #ifndef __WINSCW__			
       
   217 			for(int tracetag=0;tracetag!=NumberOfUTraceMacros;tracetag++)
       
   218 			{
       
   219 				logger.Start();
       
   220  			 	__LOG("NONStatic Trace ID: ")
       
   221  			 	__LOGNUM(tracetag)	 
       
   222 				ret = 0;
       
   223 				timeDiff=0;
       
   224 				for(int i=0;i!=StatAverage;i++)
       
   225 				{
       
   226 					User::After(Math::Random()%100000);
       
   227 					prevTime = User::FastCounter();
       
   228 					for(int i=0;i!=UTrace_Cache_Count;i++)
       
   229 						ret = Testtracer.DoTheSetTrace(tracetag, TestTraceObject);
       
   230 					timeDiff += User::FastCounter() - prevTime;
       
   231 				}
       
   232 				timeSpentToTrace = timeDiff/ticksPerMicroSec/StatAverage;
       
   233 				INFO_PRINTF5(_L("Utrace macro %d trace, size %d (%d trace(s))= %10.6lf microseconds"), tracetag, Testtracer.SizeOfTrace(tracetag), UTrace_Cache_Count, timeSpentToTrace);
       
   234 				INFO_PRINTF2(_L("Time per trace = %10.6e microseconds"),timeSpentToTrace/UTrace_Count );
       
   235 				logger.Stop();
       
   236 			}
       
   237 			if(ret==0)
       
   238 			INFO_PRINTF1(_L("tracing failed from UTrace"));
       
   239 			__LOG("Trace times for 10,000 user side static traces logging to serial plugin");
       
   240 				for(int tracetag=0;tracetag!=NumberOfUTraceMacros;tracetag++)
       
   241 			{
       
   242 				logger.Start();
       
   243  			 	__LOG("Static Trace ID: ")
       
   244  			 	__LOGNUM(tracetag)	 
       
   245 				ret = 0;
       
   246 				timeDiff=0;
       
   247 				for(int i=0;i!=StatAverage;i++)
       
   248 				{
       
   249 					User::After(Math::Random()%100000);
       
   250 					prevTime = User::FastCounter();
       
   251 					for(int i=0;i!=UTrace_Cache_Count;i++)
       
   252 						ret = Testtracer.DoTheStaticTrace(tracetag);
       
   253 					timeDiff += User::FastCounter() - prevTime;
       
   254 				}
       
   255 				timeSpentToTrace = timeDiff/ticksPerMicroSec/StatAverage;
       
   256 				INFO_PRINTF5(_L("Utrace macro %d trace, size %d (%d trace(s))= %10.6lf microseconds"), tracetag, Testtracer.SizeOfTrace(tracetag), UTrace_Cache_Count, timeSpentToTrace);
       
   257 				INFO_PRINTF2(_L("Time per trace = %10.6e microseconds"),timeSpentToTrace/UTrace_Count );
       
   258 				logger.Stop();
       
   259 			}
       
   260 			if(ret==0)
       
   261 			INFO_PRINTF1(_L("tracing failed from UTrace"));
       
   262 #endif //winscw
       
   263 #endif //serial
       
   264 			//  **************   Block end ****************
       
   265 			if(ret==0||Result==1)
       
   266 				SetTestStepResult(EFail);
       
   267 			else
       
   268 				SetTestStepResult(EPass);
       
   269 		}
       
   270 	 	return TestStepResult();
       
   271 	}
       
   272 
       
   273 
       
   274 
       
   275 TVerdict CULoggerMCLUserPerfStep::doTestStepPostambleL()
       
   276 /**
       
   277  * @return - TVerdict code
       
   278  * Override of base class virtual
       
   279  */
       
   280 	{
       
   281 		INFO_PRINTF1(_L("Completed performance testing on user side tracing for file and serial plugins"));
       
   282 		return TestStepResult();
       
   283 	}
       
   284 
       
   285 
       
   286 ////////////////////////////////////////////////////////////////////////
       
   287 ////////////////////////////////////////////////////////////////////////
       
   288 //////////////////////////////////KERNEL SIDE///////////////////////////
       
   289 ////////////////////////////////////////////////////////////////////////
       
   290 ////////////////////////////////////////////////////////////////////////
       
   291 
       
   292 
       
   293 CULoggerMCLKernelPerfStep::~CULoggerMCLKernelPerfStep()
       
   294 /**
       
   295  * Destructor
       
   296  */
       
   297 	{
       
   298 	}
       
   299 
       
   300 CULoggerMCLKernelPerfStep::CULoggerMCLKernelPerfStep()
       
   301 /**
       
   302  * Constructor
       
   303  */
       
   304 	{
       
   305 		SetTestStepName(KULoggerMCLKernelPerfStep);
       
   306 	}
       
   307 
       
   308 TVerdict CULoggerMCLKernelPerfStep::doTestStepPreambleL()
       
   309 /**
       
   310  * @return - TVerdict code
       
   311  * Override of base class virtual
       
   312  */
       
   313 	{
       
   314 		INFO_PRINTF1(_L("Carrying out performance testing on kernel side tracing for file and serial plugins"));
       
   315 		SetTestStepResult(EPass);
       
   316 		return TestStepResult();
       
   317 	}
       
   318 
       
   319 
       
   320 TVerdict CULoggerMCLKernelPerfStep::doTestStepL()
       
   321 /**
       
   322  * @return - TVerdict code
       
   323  * Override of base class pure virtual
       
   324  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
   325  * not leave. That being the case, the current test result value will be EPass.
       
   326  */
       
   327 	{
       
   328 		if (TestStepResult()==EPass)
       
   329 		{
       
   330 			//  ************** Delete the Block, the block start ****************
       
   331 #ifndef __WINSCW__			
       
   332 			INFO_PRINTF1(_L("Benchmark trace logging for the file plug-in"));
       
   333 			 __CREATE_LOG(true);
       
   334 			 __HIRES_RESOLUTION;
       
   335 			TInt fastTimerFreq;
       
   336 			HAL::Get(HALData::EFastCounterFrequency, fastTimerFreq);
       
   337 			TReal ticksPerMicroSec = 1.0E-6 * fastTimerFreq;	
       
   338 			TUint32 prevTime;
       
   339 			TUint32 timeDiff;
       
   340 			TReal timeSpentToTrace;	
       
   341 			CUKernelTraces TestKerneltracer;
       
   342 			TInt Result=0;
       
   343 			/***Now set file plugins and filter settings****/
       
   344 			RULogger logger;
       
   345 			logger.Connect();
       
   346 			CClearConfig configIni;	
       
   347 			configIni.Clear(logger);		
       
   348 			CArrayFixFlat<TUint8> *setprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
   349 			setprimfilter->AppendL(UTracePrimary);
       
   350 			RArray<TUint32> setsecondfilter;
       
   351 			setsecondfilter.Append((TUint32) UTraceSecondary);		
       
   352 			logger.SetPrimaryFiltersEnabled(*setprimfilter,ETrue);
       
   353 			logger.SetSecondaryFiltersEnabled(setsecondfilter,ETrue);
       
   354 			/**Load usb device**/
       
   355 			TInt ret = KErrNone;
       
   356 			ret =User::LoadLogicalDevice(_L("eusbc.ldd"));
       
   357 			if(ret == KErrAlreadyExists)
       
   358 			ret = KErrNone;	
       
   359 			RDevUsbcClient usbDevice;
       
   360 			usbDevice.Open(0);	
       
   361 	
       
   362 			///////////////////////////////////////////////////////////
       
   363 			///////////////////////////////////////////////////////////
       
   364 			/////////////////////////FILE//////////////////////////////
       
   365 			///////////////////////////////////////////////////////////
       
   366 			///////////////////////////////////////////////////////////
       
   367 		
       
   368 			INFO_PRINTF1(_L("about to set file as output plugin"));
       
   369 			//NB: this of course assumes that the plugin functionality works which is tested more rigorously in the plugin test step
       
   370 			if(Result==0)	
       
   371 			{
       
   372 				INFO_PRINTF1(_L("file set as output plugin ok"));
       
   373 				_LIT8(KTextmedia,"uloggerfileplugin");
       
   374 				TPtrC8 mediaptr(KTextmedia);
       
   375 				Result=logger.ActivateOutputPlugin(mediaptr);				
       
   376 				if(Result==0||Result==-11)
       
   377 				{	
       
   378 					INFO_PRINTF1(_L("file set as active output plugin ok"));
       
   379 					_LIT(KTextsetting, "output_path");
       
   380 					_LIT(KTextvalue, "c:\\logs\\ULoggerPerfKernelSideFileLogging.log");
       
   381 					TPluginConfiguration setPluginConfigs;
       
   382 					setPluginConfigs.SetKey(KTextsetting);
       
   383 					setPluginConfigs.SetValue(KTextvalue);				
       
   384 					Result=logger.SetPluginConfigurations(mediaptr, setPluginConfigs);
       
   385 					if(Result==0)
       
   386 						INFO_PRINTF1(_L("output plugin settings set ok"));
       
   387 					else
       
   388 						INFO_PRINTF1(_L("setting output plugin settings failed"));
       
   389 				}
       
   390 				else
       
   391 					INFO_PRINTF1(_L("file not set as active output plugin - failed"));
       
   392 			}
       
   393 			else
       
   394 				INFO_PRINTF1(_L("add file as output plugin failed"));
       
   395 			/***Now carry out performance benchmarking and tracing for NonStatic SET method to file****/
       
   396 			__LOG("Trace times for 10,000 kernel side nonstatic set traces logging to file plugin");
       
   397 #ifdef FILE_PERF	
       
   398 			for(int tracetag=0;tracetag!=NumberOfUTraceMacros;tracetag++)
       
   399 			{
       
   400 				logger.Start();
       
   401 			 	__LOG("NONStatic Trace ID: ")
       
   402 			 	__LOGNUM(tracetag)	 
       
   403 				ret = 0;
       
   404 				timeDiff=0;
       
   405 				for(int i=0;i!=StatAverage;i++)
       
   406 				{
       
   407 					User::After(Math::Random()%100000);
       
   408 					prevTime = User::FastCounter();
       
   409 					for(int i=0;i!=UTrace_Cache_Count;i++)
       
   410 						ret = TestKerneltracer.DoTheKernelSetTrace(tracetag, usbDevice);
       
   411 					timeDiff += User::FastCounter() - prevTime;
       
   412 				}
       
   413 				timeSpentToTrace = timeDiff/ticksPerMicroSec/StatAverage;
       
   414 				INFO_PRINTF5(_L("Utrace macro %d trace, size %d (%d trace(s))= %10.6lf microseconds"), tracetag, TestKerneltracer.SizeOfKernelTrace(tracetag), UTrace_Cache_Count, timeSpentToTrace);
       
   415 				INFO_PRINTF2(_L("Time per trace = %10.6e microseconds"),timeSpentToTrace/UTrace_Count );
       
   416 				logger.Stop();
       
   417 			}
       
   418 			if(ret==0)
       
   419 				INFO_PRINTF1(_L("device driver returned error, but tracing should still be carried out"));
       
   420 			/***Now carry out performance benchmarking and tracing for Static method to file****/
       
   421 			__LOG("Trace times for 10,000 kernel side static traces logging to file plugin");
       
   422 			for(int tracetag=0;tracetag!=NumberOfUTraceMacros;tracetag++)
       
   423 			{
       
   424 				logger.Start();
       
   425 			 	__LOG("Static Trace ID: ")
       
   426 			 	__LOGNUM(tracetag)	 
       
   427 				ret = 0;
       
   428 				timeDiff=0;
       
   429 				for(int i=0;i!=StatAverage;i++)
       
   430 				{
       
   431 					User::After(Math::Random()%100000);
       
   432 					prevTime = User::FastCounter();
       
   433 					for(int i=0;i!=UTrace_Cache_Count;i++)
       
   434 						ret = TestKerneltracer.DoTheKernelStaticTrace(tracetag, usbDevice);
       
   435 					timeDiff += User::FastCounter() - prevTime;
       
   436 				}
       
   437 				timeSpentToTrace = timeDiff/ticksPerMicroSec/StatAverage;
       
   438 				INFO_PRINTF5(_L("Utrace macro %d trace, size %d (%d trace(s))= %10.6lf microseconds"), tracetag, TestKerneltracer.SizeOfKernelTrace(tracetag), UTrace_Cache_Count, timeSpentToTrace);
       
   439 				INFO_PRINTF2(_L("Time per trace = %10.6e microseconds"),timeSpentToTrace/UTrace_Count );
       
   440 				logger.Stop();
       
   441 			}
       
   442 			if(ret==0)
       
   443 				INFO_PRINTF1(_L("device driver returned error, but tracing should still be carried out"));
       
   444 #endif	//file
       
   445 				
       
   446 
       
   447 		///////////////////////////////////////////////////////////
       
   448 		///////////////////////////////////////////////////////////
       
   449 		////////////////////////SERIAL/////////////////////////////
       
   450 		///////////////////////////////////////////////////////////
       
   451 		///////////////////////////////////////////////////////////
       
   452 		
       
   453 			INFO_PRINTF1(_L("Now benchmark trace logging for the serial plug-in"));
       
   454 			_LIT8(KSerialTextmedia,"uloggerserialplugin");
       
   455 			TPtrC8 serialmediaptr(KSerialTextmedia);
       
   456 			Result=logger.ActivateOutputPlugin(serialmediaptr);				
       
   457 			if(Result==0||Result==-11)			
       
   458 			{	
       
   459 				// test the added plugin can be activated			
       
   460 				if(Result==0)	
       
   461 				{	
       
   462 					INFO_PRINTF1(_L("Serial Plugin active"));
       
   463 					_LIT(KSerialTextsetting, "output_port");
       
   464 					_LIT(KSerialTextvalue, "3");
       
   465 					// test setting the plugin settings
       
   466 					TPluginConfiguration setSerialPluginConfigs;
       
   467 					setSerialPluginConfigs.SetKey(KSerialTextsetting);
       
   468 					setSerialPluginConfigs.SetValue(KSerialTextvalue);
       
   469 					Result=logger.SetPluginConfigurations(serialmediaptr, setSerialPluginConfigs);
       
   470 					if(Result==0)	
       
   471 					{
       
   472 						INFO_PRINTF1(_L("Serial Plugin Settings set correctly"));
       
   473 					}	
       
   474 				}
       
   475 				else
       
   476 					INFO_PRINTF1(_L("Serial plugin not set as active plugin"));
       
   477 			}
       
   478 			else
       
   479 				INFO_PRINTF1(_L("Serial plugin not added as output plugin"));
       
   480 			/***Now carry out performance benchmarking and tracing for NonStatic SET method to serial****/
       
   481 			__LOG("Trace times for 10,000 kernel side nonstatic set traces logging to serial plugin");
       
   482 #ifdef SERIAL_PERF
       
   483 			for(int tracetag=0;tracetag!=NumberOfUTraceMacros;tracetag++)
       
   484 			{
       
   485 				logger.Start();
       
   486 			 	__LOG("NONStatic Trace ID: ")
       
   487 			 	__LOGNUM(tracetag)	 
       
   488 				ret = 0;
       
   489 				timeDiff=0;
       
   490 				for(int i=0;i!=StatAverage;i++)
       
   491 				{
       
   492 					User::After(Math::Random()%100000);
       
   493 					prevTime = User::FastCounter();
       
   494 					for(int i=0;i!=UTrace_Cache_Count;i++)
       
   495 						ret = TestKerneltracer.DoTheKernelSetTrace(tracetag, usbDevice);
       
   496 					timeDiff += User::FastCounter() - prevTime;
       
   497 				}
       
   498 				timeSpentToTrace = timeDiff/ticksPerMicroSec/StatAverage;
       
   499 				INFO_PRINTF5(_L("Utrace macro %d trace, size %d (%d trace(s))= %10.6lf microseconds"), tracetag, TestKerneltracer.SizeOfKernelTrace(tracetag), UTrace_Cache_Count, timeSpentToTrace);
       
   500 				INFO_PRINTF2(_L("Time per trace = %10.6e microseconds"),timeSpentToTrace/UTrace_Count );
       
   501 				logger.Stop();
       
   502 			}
       
   503 			if(ret==0)
       
   504 				INFO_PRINTF1(_L("device driver returned error, but tracing should still be carried out"));
       
   505 			/***Now carry out performance benchmarking and tracing for Static method to file****/
       
   506 			__LOG("Trace times for 10,000 kernel side static traces logging to serial plugin");
       
   507 			for(int tracetag=0;tracetag!=NumberOfUTraceMacros;tracetag++)
       
   508 			{
       
   509 				logger.Start();
       
   510 			 	__LOG("Static Trace ID: ")
       
   511 			 	__LOGNUM(tracetag)	 
       
   512 				ret = 0;
       
   513 				timeDiff=0;
       
   514 				for(int i=0;i!=StatAverage;i++)
       
   515 				{
       
   516 					User::After(Math::Random()%100000);
       
   517 					prevTime = User::FastCounter();
       
   518 					for(int i=0;i!=UTrace_Cache_Count;i++)
       
   519 						ret = TestKerneltracer.DoTheKernelStaticTrace(tracetag, usbDevice);
       
   520 					timeDiff += User::FastCounter() - prevTime;
       
   521 				}
       
   522 				timeSpentToTrace = timeDiff/ticksPerMicroSec/StatAverage;
       
   523 				INFO_PRINTF5(_L("Utrace macro %d trace, size %d (%d trace(s))= %10.6lf microseconds"), tracetag, TestKerneltracer.SizeOfKernelTrace(tracetag), UTrace_Cache_Count, timeSpentToTrace);
       
   524 				INFO_PRINTF2(_L("Time per trace = %10.6e microseconds"),timeSpentToTrace/UTrace_Count );
       
   525 				logger.Stop();
       
   526 			}
       
   527 			if(ret==0)
       
   528 				INFO_PRINTF1(_L("device driver returned error, but tracing should still be carried out"));
       
   529 #endif	//serial
       
   530 			//  **************   Block end ****************
       
   531 			if(Result==0)
       
   532 				SetTestStepResult(EPass);
       
   533 			else
       
   534 				SetTestStepResult(EFail);
       
   535 #endif //winscw
       
   536 #ifdef __WINSCW__
       
   537 		INFO_PRINTF1(_L("Kernel tests not run on emulator"));			
       
   538 #endif
       
   539 		}
       
   540 	  	return TestStepResult();
       
   541 	}
       
   542 
       
   543 
       
   544 
       
   545 TVerdict CULoggerMCLKernelPerfStep::doTestStepPostambleL()
       
   546 /**
       
   547  * @return - TVerdict code
       
   548  * Override of base class virtual
       
   549  */
       
   550 	{
       
   551 		INFO_PRINTF1(_L("Completed performance testing on kernel side tracing for file and serial plugins"));
       
   552 		return TestStepResult();
       
   553 	}