traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_performance/src/te_perfapicall.cpp
branchRCL_3
changeset 23 26645d81f48d
parent 0 08ec8eefde2f
child 24 cc28652e0254
equal deleted inserted replaced
21:28839de615b4 23:26645d81f48d
    73 
    73 
    74 	//return the results of the API call tests to the calling program
    74 	//return the results of the API call tests to the calling program
    75 	return error;
    75 	return error;
    76 	}
    76 	}
    77 
    77 
    78 TInt CApiCallTest::CachedTraceTime(TApiRunConfig& aApiRunConfig, TApiTestResult& aApiTestResult)
    78 TInt CApiCallTest::CachedTraceTimeL(TApiRunConfig& aApiRunConfig, TApiTestResult& aApiTestResult)
    79 	{
    79 	{
    80 	TInt error = KErrNotSupported;
    80 	TInt error = KErrNotSupported;
    81 	//create a dummy time variable to be used for the baseline measurement	
    81 	//create a dummy time variable to be used for the baseline measurement	
    82 	TInt32 baselinetime = 0;
    82 	TInt32 baselinetime = 0;
    83 
    83 
    84 	//carry out the APIcall tests as required by the user
    84 	//carry out the APIcall tests as required by the user
    85 	__TEST_LOG("about to carry out cache trace");
    85 	__TEST_LOG("about to carry out cache trace");
    86 	if(aApiRunConfig.iDoMinExecution) 
    86 	if(aApiRunConfig.iDoMinExecution) 
    87 		{
    87 		{
    88 		CachedTraceBaselineTime(aApiRunConfig, baselinetime);
    88 		CachedTraceBaselineTimeL(aApiRunConfig, baselinetime);
    89 		__TEST_LOG("cache baseline");
    89 		__TEST_LOG("cache baseline");
    90 		__TEST_LOGNUM(baselinetime);
    90 		__TEST_LOGNUM(baselinetime);
    91 		error = CachedTraceTime(aApiRunConfig, aApiTestResult.iMinimumExecutionTime, baselinetime);
    91 		error = CachedTraceTimeL(aApiRunConfig, aApiTestResult.iMinimumExecutionTime, baselinetime);
    92 		__TEST_LOG("cache");
    92 		__TEST_LOG("cache");
    93 		__TEST_LOGNUM(aApiTestResult.iMinimumExecutionTime);
    93 		__TEST_LOGNUM(aApiTestResult.iMinimumExecutionTime);
    94 		}
    94 		}
    95 	return error;
    95 	return error;
    96 	}
    96 	}
    97 
    97 
    98 TInt CApiCallTest::NonCachedTraceTime(TApiRunConfig& aApiRunConfig, TApiTestResult& aApiTestResult)
    98 TInt CApiCallTest::NonCachedTraceTimeL(TApiRunConfig& aApiRunConfig, TApiTestResult& aApiTestResult)
    99 	{
    99 	{
   100 	TInt error = KErrNotSupported;
   100 	TInt error = KErrNotSupported;
   101 	//create a dummy time variable to be used for the baseline measurement	
   101 	//create a dummy time variable to be used for the baseline measurement	
   102 	TInt32 baselinetime = 0;
   102 	TInt32 baselinetime = 0;
   103 	__TEST_LOG("about to carry out non cache trace");
   103 	__TEST_LOG("about to carry out non cache trace");
   104 	if(aApiRunConfig.iDoTypicalExecution)
   104 	if(aApiRunConfig.iDoTypicalExecution)
   105 		{
   105 		{
   106 		NonCachedTraceBaselineTime(aApiRunConfig, baselinetime);
   106 		NonCachedTraceBaselineTimeL(aApiRunConfig, baselinetime);
   107 		__TEST_LOG("noncache baseline");
   107 		__TEST_LOG("noncache baseline");
   108 		__TEST_LOGNUM(baselinetime);
   108 		__TEST_LOGNUM(baselinetime);
   109 		error = NonCachedTraceTime(aApiRunConfig, aApiTestResult.iTypicalExecutionTime, baselinetime);
   109 		error = NonCachedTraceTimeL(aApiRunConfig, aApiTestResult.iTypicalExecutionTime, baselinetime);
   110 		__TEST_LOG("noncache");
   110 		__TEST_LOG("noncache");
   111 		__TEST_LOGNUM(aApiTestResult.iTypicalExecutionTime);				
   111 		__TEST_LOGNUM(aApiTestResult.iTypicalExecutionTime);				
   112 		}
   112 		}
   113 	return error;
   113 	return error;
   114 	}
   114 	}
   115 
   115 
   116 TInt CApiCallTest::StackUsage(TApiRunConfig& aApiRunConfig, TApiTestResult& aApiTestResult)
   116 TInt CApiCallTest::StackUsageL(TApiRunConfig& aApiRunConfig, TApiTestResult& aApiTestResult)
   117 	{
   117 	{
   118 	__TEST_LOG("about to carry out stack usage trace");
   118 	__TEST_LOG("about to carry out stack usage trace");
   119 	TInt error = StackUsage(aApiRunConfig, aApiTestResult.iRunResults.iApiStackUsage);
   119 	TInt error = StackUsageL(aApiRunConfig, aApiTestResult.iRunResults.iApiStackUsage);
   120 	if(aApiTestResult.iRunResults.iApiStackUsage == KErrNotSupported && !error)
   120 	if(aApiTestResult.iRunResults.iApiStackUsage == KErrNotSupported && !error)
   121 		error = KErrNotSupported;
   121 		error = KErrNotSupported;
   122 	return error;
   122 	return error;
   123 	}
   123 	}
   124 
   124 
   139 
   139 
   140 /** This user-side method calculates the minimum execution baseline time taken for a single commented API call.
   140 /** This user-side method calculates the minimum execution baseline time taken for a single commented API call.
   141 @param aMinimumExecutionBaselineTime is the minimum execution baseline time taken for the commented API call, calculated in nanoseconds
   141 @param aMinimumExecutionBaselineTime is the minimum execution baseline time taken for the commented API call, calculated in nanoseconds
   142 @return KErrNone if command was prepared correctly and a system wide error code otherwise.
   142 @return KErrNone if command was prepared correctly and a system wide error code otherwise.
   143  */
   143  */
   144 TInt CApiCallTest::CachedTraceBaselineTime(TApiRunConfig& aApiRunConfig, TInt32& aMinimumExecutionBaselineTime) 
   144 TInt CApiCallTest::CachedTraceBaselineTimeL(TApiRunConfig& aApiRunConfig, TInt32& aMinimumExecutionBaselineTime) 
   145 	{
   145 	{
   146 	//****NB: update this routine to something more maintainable
   146 	//****NB: update this routine to something more maintainable
   147 	TUptTraceTester timer;
   147 	TUptTraceTester timer;
   148 	TInt error = KErrNone;
   148 	TInt error = KErrNone;
   149 
   149 
   169 /** This user-side method calculates the minimum execution time taken for a single API call.
   169 /** This user-side method calculates the minimum execution time taken for a single API call.
   170 @param aMinimumExecutionTime is the minimum execution time taken for the API call, calculated in nanoseconds
   170 @param aMinimumExecutionTime is the minimum execution time taken for the API call, calculated in nanoseconds
   171 @param aMinimumExecutionBaselineTime is the minimum execution baseline time taken for commented API call, calculated in nanoseconds
   171 @param aMinimumExecutionBaselineTime is the minimum execution baseline time taken for commented API call, calculated in nanoseconds
   172 @return KErrNone if command was prepared correctly and a system wide error code otherwise.
   172 @return KErrNone if command was prepared correctly and a system wide error code otherwise.
   173  */	
   173  */	
   174 TInt CApiCallTest::CachedTraceTime(TApiRunConfig& aApiRunConfig, TInt32& aMinimumExecutionTime, TInt32& aMinimumExecutionBaselineTime)
   174 TInt CApiCallTest::CachedTraceTimeL(TApiRunConfig& aApiRunConfig, TInt32& aMinimumExecutionTime, TInt32& aMinimumExecutionBaselineTime)
   175 	{ 
   175 	{ 
   176 	//NB!!! any changes to this routine and you have to update the baseline calculation as well
   176 	//NB!!! any changes to this routine and you have to update the baseline calculation as well
   177 	TUptTraceTester timer;
   177 	TUptTraceTester timer;
   178 
   178 
   179 	TInt err =KErrNone;
   179 	TInt err =KErrNone;
   192 
   192 
   193 /** This user-side method calculates the typical execution baseline time taken for a single commented API call.
   193 /** This user-side method calculates the typical execution baseline time taken for a single commented API call.
   194 @param aTypicalExecutionBaselineTime is the typical execution baseline time taken for the API call, calculated in nanoseconds
   194 @param aTypicalExecutionBaselineTime is the typical execution baseline time taken for the API call, calculated in nanoseconds
   195 @return KErrNone if command was prepared correctly and a system wide error code otherwise.
   195 @return KErrNone if command was prepared correctly and a system wide error code otherwise.
   196  */	
   196  */	
   197 TInt CApiCallTest::NonCachedTraceBaselineTime(TApiRunConfig& aApiRunConfig, TInt32& aTypicalExecutionBaselineTime)
   197 TInt CApiCallTest::NonCachedTraceBaselineTimeL(TApiRunConfig& aApiRunConfig, TInt32& aTypicalExecutionBaselineTime)
   198 	{
   198 	{
   199 	//****NB: update this routine to something more maintainable
   199 	//****NB: update this routine to something more maintainable
   200 	TUptTraceTester timer;
   200 	TUptTraceTester timer;
   201 	
   201 	
   202 	TInt error = KErrNone;
   202 	TInt error = KErrNone;
   221 	
   221 	
   222 /** This user-side method calculates the typical execution time taken for a single API call.
   222 /** This user-side method calculates the typical execution time taken for a single API call.
   223 @param aTypicalExecutionTime is the typical execution time taken for the API call, calculated in nanoseconds
   223 @param aTypicalExecutionTime is the typical execution time taken for the API call, calculated in nanoseconds
   224 @return KErrNone if command was prepared correctly and a system wide error code otherwise.
   224 @return KErrNone if command was prepared correctly and a system wide error code otherwise.
   225  */	
   225  */	
   226 TInt CApiCallTest::NonCachedTraceTime(TApiRunConfig& aApiRunConfig, TInt32& aTypicalExecutionTime, TInt32& aTypicalExecutionBaselineTime)
   226 TInt CApiCallTest::NonCachedTraceTimeL(TApiRunConfig& aApiRunConfig, TInt32& aTypicalExecutionTime, TInt32& aTypicalExecutionBaselineTime)
   227 	{
   227 	{
   228 	
   228 	
   229 	TUptTraceTester timer;
   229 	TUptTraceTester timer;
   230 	
   230 	
   231 	TInt err =KErrNone;
   231 	TInt err =KErrNone;
   257  * This is only done on hardware, but this is taken care of in the
   257  * This is only done on hardware, but this is taken care of in the
   258  * actual stack usage methods. For emulator the result will always be 0.
   258  * actual stack usage methods. For emulator the result will always be 0.
   259  *  
   259  *  
   260  * @return KErrNone if command was prepared correctly and a system wide error code otherwise.
   260  * @return KErrNone if command was prepared correctly and a system wide error code otherwise.
   261  */
   261  */
   262 TInt CApiCallTest::StackUsage(TApiRunConfig& aApiRunConfig, TInt& aApiStackUsage)
   262 TInt CApiCallTest::StackUsageL(TApiRunConfig& aApiRunConfig, TInt& aApiStackUsage)
   263 	{
   263 	{
   264 	/*
   264 	/*
   265 	PSEUDOCODE 
   265 	PSEUDOCODE 
   266 	1) initiate a variable forced to the cleanup stack
   266 	1) initiate a variable forced to the cleanup stack
   267 			static volatile int foo = 0;
   267 			static volatile int foo = 0;
   309 	{
   309 	{
   310 	TInt err=TestStackUsage();
   310 	TInt err=TestStackUsage();
   311 	return err;
   311 	return err;
   312 	}
   312 	}
   313 
   313 
   314 /** This sanity test method is executed in Test() to verify that UPT StackUsage() method in
   314 /** This sanity test method is executed in Test() to verify that UPT StackUsageL() method in
   315 this class are stable before any of the stack size performance tests are carried out 
   315 this class are stable before any of the stack size performance tests are carried out 
   316 @return KErrNone if command was prepared correctly and system wide error code otherwise.
   316 @return KErrNone if command was prepared correctly and system wide error code otherwise.
   317  */	
   317  */	
   318 TInt CApiCallTest::TestStackUsage()
   318 TInt CApiCallTest::TestStackUsage()
   319 	{
   319 	{