traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_performance/src/te_perfplugin.cpp
changeset 0 08ec8eefde2f
child 23 26645d81f48d
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2007-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 // Ost Performance Tests Output Plugin Test Object
       
    15 //
       
    16 
       
    17 
       
    18 
       
    19 /**
       
    20  @file te_perfplugin.cpp
       
    21  @internalTechnology
       
    22  @prototype
       
    23 */
       
    24 
       
    25 
       
    26 #include "te_perfplugin.h"
       
    27 #include "te_tracecontrolcmds.h"
       
    28 #include "te_instrumentationpoints.h"
       
    29 #include "te_perf.h"
       
    30 #include "te_dataparameters.h"
       
    31 #include "lightlogger.h"
       
    32 
       
    33 
       
    34 CPluginTestResult::CPluginTestResult()
       
    35 	{
       
    36 	/*Constructor*/
       
    37 	//iPluginName;
       
    38 	//iPluginConfiguration;
       
    39 	//iPluginKey;
       
    40 	//iPluginValue;
       
    41 	//iTestType;
       
    42 	/*
       
    43 	TInt32 throughput=-1; //in bytes/sec, calculated from the amount of data sent divided by the// difference between the initial and final timestamps
       
    44 	TInt32 dataSize=0; //may not need
       
    45 	TInt iteration=0;
       
    46 	TInt64 latency=-1; //in nanoseconds-> to be implemented once ULogger instrumented with testcode
       
    47 	*/
       
    48 	}
       
    49 
       
    50 CPluginTestResult::~CPluginTestResult()
       
    51 	{
       
    52 	/*Destructor*/
       
    53 	}
       
    54 
       
    55 TInt CPluginTestResult::Copy(const CPluginTestResult& aPluginTestResult)
       
    56 	{
       
    57 	TInt err=0;
       
    58 
       
    59 	//iPluginTestResult->iPluginName.Set(aPluginRunConfig.iPluginName);
       
    60 	//iPluginTestResult->iPluginConfiguration=aPluginRunConfig.iPluginConfiguration;
       
    61 	//iPluginTestResult->iPluginKey.Set(aPluginRunConfig.iPluginKey);
       
    62 	//iPluginTestResult->iPluginValue.Set(aPluginRunConfig.iPluginValue);
       
    63 	//iPluginTestResult->iTestType.Set(aPluginRunConfig.iTestType);
       
    64 	iThroughput=aPluginTestResult.iThroughput; //in bytes/sec, calculated from the amount of data sent divided by the// difference between the initial and final timestamps
       
    65 	iDataSize=aPluginTestResult.iDataSize; //may not need
       
    66 	iIteration=aPluginTestResult.iIteration;
       
    67 	iLatency=aPluginTestResult.iLatency;
       
    68 
       
    69 	return err;
       
    70 	}
       
    71 
       
    72 
       
    73 CPluginTests::CPluginTests()
       
    74 	{
       
    75 	/*Constructor*/
       
    76 	iPluginTestResult = new(ELeave) CPluginTestResult;
       
    77 	__CREATE_LOG(false);
       
    78 	}
       
    79 
       
    80 CPluginTests::~CPluginTests()
       
    81 	{
       
    82 	/*Destructor*/
       
    83 	delete iPluginTestResult;
       
    84 	}
       
    85 
       
    86 
       
    87 /** This user-side method takes the parameters passed by the user to carry out a single plugin performance test, independent of UTrace
       
    88 and to store the test results
       
    89 @param aPluginName is the identity of the plugin to be tested defined as a TPtrc8 for consistency with ULogger's parameter definitions
       
    90 @param aPluginSetting is the settings of the plugin to be tested defined as a TPluginConfiguration for consistency with ULogger's parameter definitions
       
    91 @param aTestDataSize is the size of the data in bytes, specified as TInt, that the user wants to pass through the plugin.
       
    92 		If aTestDataSize=zero then,
       
    93 			 {if aTestDuration=zero; default settings are picked up,
       
    94 			 if aTestDuration!=zero; the test assumes the user wants a continuous stream of data}
       
    95 @param aTestDuration is the time duration in seconds, specified as a TInt, that the user wants data to pass through the plugin.
       
    96 		If aTestDuration=zero then,
       
    97 			 {if aTestDataSize=zero; default settings are picked up,
       
    98 			 if aTestDataSize!=zero; the test assumes the user wants the full set of data to be passed regardless of the time taken}
       
    99 @return CPluginTestResult is the  Plugin test result struct object returned to the calling program, which contains all the test results from the relevent test run
       
   100  */
       
   101 CPluginTestResult* CPluginTests::DoTestL(const CPluginRunConfig& aPluginRunConfig)
       
   102 //const COutputPluginTestResult* COutputPluginTests::DoTestL(const TPtrC8& aPluginName, const TPluginConfiguration& aPluginSetting, const TInt& aTestDataSize, const TInt& aTestIteration)
       
   103 	{
       
   104 	//TTraceTester tracecall;
       
   105 
       
   106 
       
   107 	TInt numberOfTraces=aPluginRunConfig.iDataSize/16; //update magic number to a size of (trace)/bytes
       
   108 	//do a baseline to remove loop effects for throughput tests?????
       
   109 
       
   110 	//removed logging of timestamp because of a warning...
       
   111 //	if(aPluginRunConfig.iTestType.Compare(KThroughputTest))
       
   112 //		__LOGTIMESTAMP("Timestamp before call to trace - t1");
       
   113 
       
   114 	TTraceContext attrs(KComponentId, KGroupId, KContextId, KPc);
       
   115 	for(TInt iterate=0; iterate<numberOfTraces; iterate++)
       
   116 		{
       
   117 		//use this commented routine if want a more generic version for maintainability
       
   118 		//tracecall.SendTraceL()
       
   119 		OstTrace(attrs, KTraceId);
       
   120 		}
       
   121 	iPluginTestResult->iPluginName.Set(aPluginRunConfig.iPluginName);
       
   122 	iPluginTestResult->iPluginConfiguration=aPluginRunConfig.iPluginConfiguration;
       
   123 	iPluginTestResult->iPluginKey.Set(aPluginRunConfig.iPluginKey);
       
   124 	iPluginTestResult->iPluginValue.Set(aPluginRunConfig.iPluginValue);
       
   125 	iPluginTestResult->iTestType.Set(aPluginRunConfig.iTestType);
       
   126 	iPluginTestResult->iDataSize=aPluginRunConfig.iDataSize; //may not need
       
   127 	iPluginTestResult->iIteration=aPluginRunConfig.iIteration;
       
   128 
       
   129 	//iOutputPluginTestResult->iLatency; //in nanoseconds-> to be implemented once ULogger instrumented with testcode
       
   130 	return iPluginTestResult;
       
   131 	}
       
   132 
       
   133 
       
   134