os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/Te_EComAccumulatedClientRequestPerfTestStep.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 // Implementation of ECom Test to determine performance of ECom client calls during different stages of start-up.
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20  @internalComponent
    21 */
    22 
    23 #include "Te_EComAccumulatedClientRequestPerfTestStep.h"
    24 #include <startup.hrh>
    25 #include <ecom/ecom.h>
    26 #include "Interface.h"
    27 #include "EComSessionAux.h"
    28 #include "EComPerformance.h"
    29 
    30 CEComAccumulatedClientRequestsPerfTest::CEComAccumulatedClientRequestsPerfTest() : CEComPerfTestBase(KEComAccumulatedClientRequestsPerfTest)
    31 	{
    32 	}
    33 
    34 CEComAccumulatedClientRequestsPerfTest::~CEComAccumulatedClientRequestsPerfTest()
    35 	{
    36 	}
    37 
    38 /**
    39  This test will retrieve the timing servicing client requests for the start-up states in this list
    40  */
    41 const TStartupStateIdentifier CEComAccumulatedClientRequestsPerfTest::iMeasuredStartupStates[] = 
    42 	{
    43 	EStartupStateCriticalStatic,
    44 	EStartupStateCriticalDynamic,
    45 	EStartupStateNonCritical
    46 	};
    47 const TInt CEComAccumulatedClientRequestsPerfTest::iNumMeasuredStartupStates = sizeof(iMeasuredStartupStates)/sizeof(iMeasuredStartupStates[0]);
    48 
    49 /**
    50  Retrieves client request timer results from the ECom server
    51  then prints out timer results organized by startup state, client request type, and then all client requests
    52  */
    53 TVerdict CEComAccumulatedClientRequestsPerfTest::doTestStepL()
    54 	{
    55 #ifdef __ECOM_SERVER_PERFORMANCE__
    56 	// get all the timer results from the server
    57 	RClientRequestTimerResults clientTimerResults;
    58 	CleanupClosePushL(clientTimerResults);
    59 	clientTimerResults.RetrieveResultsL();
    60 	
    61 	
    62 	INFO_PRINTF1(_L("ECom client request start-up timing broken down by request type and startup state:\n"));
    63 	//
    64 	// ECom start-up timing broken down by request type and startup state
    65 	// This loop goes through each start-up state in iMeasuredStartupStates, and for each client request type, retrieves the timing results from the clientTimerResults array
    66 	//
    67 	for (TInt startupStateIndex = 0; startupStateIndex < iNumMeasuredStartupStates; startupStateIndex++)
    68 		{
    69 		TPtrC startupStateName = StartupStateName(iMeasuredStartupStates[startupStateIndex]);
    70 		for (TInt clientRequestTypeInt = 0; clientRequestTypeInt < EEComNumClientRequestTypes; clientRequestTypeInt++)
    71 			{
    72 			TEComClientRequestType clientRequestType = (TEComClientRequestType)clientRequestTypeInt;
    73 			TPtrC clientRequestTypeName = ClientRequestTypeName(clientRequestType);
    74 			
    75 			TUint numRequestsByTypeAndStartupState = 0;
    76 			TReal timeForRequestsByTypeAndStartupState = clientTimerResults.GetAccumulatedClientRequestTime(iMeasuredStartupStates[startupStateIndex], clientRequestType, numRequestsByTypeAndStartupState);
    77 			INFO_PRINTF5(_L("Time servicing %S requests, %S State: [%f] msec, number of requests: [%d]"), 
    78 				&clientRequestTypeName, &startupStateName,
    79 				timeForRequestsByTypeAndStartupState, numRequestsByTypeAndStartupState);
    80 			}
    81 		}
    82 	
    83 
    84 	INFO_PRINTF1(_L("\nECom client request start-up timing broken down by request type:\n"));
    85 	//
    86 	// ECom start-up timing broken down by request type
    87 	// This loop goes through each client request type, retrieves the timing results from the clientTimerResults array
    88 	//
    89 	for (TInt clientRequestTypeInt = 0; clientRequestTypeInt < EEComNumClientRequestTypes; clientRequestTypeInt++)
    90 		{
    91 		TEComClientRequestType clientRequestType = (TEComClientRequestType)clientRequestTypeInt;
    92 		TPtrC clientRequestTypeName = ClientRequestTypeName(clientRequestType);
    93 
    94 		TUint numRequestsByType = 0;
    95 		TReal timeForRequestsByType = clientTimerResults.GetAccumulatedClientRequestTime(clientRequestType, numRequestsByType);
    96 		INFO_PRINTF4(_L("Time servicing %S requests: [%f] msec, number of requests: [%d]"), 
    97 			&clientRequestTypeName, timeForRequestsByType, numRequestsByType);
    98 		}
    99 
   100 
   101 	INFO_PRINTF1(_L("\nECom client request start-up timing broken down by start-up state:\n"));
   102 	//
   103 	// ECom start-up timing broken down by start-up state
   104 	// This loop goes through start-up state in iMeasuredStartupStates, and retrieves the timing results from the clientTimerResults array
   105 	//
   106 	for (TInt startupStateIndex = 0; startupStateIndex < iNumMeasuredStartupStates; startupStateIndex++)
   107 		{
   108 		TPtrC startupStateName = StartupStateName(iMeasuredStartupStates[startupStateIndex]);
   109 		TUint numRequestsByStartupState = 0;
   110 		TReal timeForRequestsByStartupState = clientTimerResults.GetAccumulatedClientRequestTime(iMeasuredStartupStates[startupStateIndex], numRequestsByStartupState);
   111 		INFO_PRINTF4(_L("Time servicing requests in %S State: [%f] msec, number of requests: [%d]"), 
   112 			&startupStateName, timeForRequestsByStartupState, numRequestsByStartupState);
   113 		}
   114 	
   115 
   116 	//
   117 	// Total time servicing client requests
   118 	// This loop goes retrieves the total time spent servicing client requests
   119 	//
   120 	TUint totalNumRequests = 0;
   121 	TReal totalTimeForRequests = clientTimerResults.GetAccumulatedClientRequestTime(totalNumRequests);
   122 	INFO_PRINTF3(_L("Total time servicing all requests: [%f] msec, number of requests: [%d]"), 
   123 		totalTimeForRequests, totalNumRequests);
   124 		
   125 	if (totalNumRequests >= KAccumulatedClientRequestTimerResultMaxCount)
   126 		{
   127 		INFO_PRINTF2(_L("Number of client requests exceeded %d. Not all client requests may have been recorded\n"), KAccumulatedClientRequestTimerResultMaxCount);
   128 		return EFail;
   129 		}
   130 
   131 	CleanupStack::PopAndDestroy(&clientTimerResults);
   132 
   133 #else
   134 	MacroNotDefinedError();
   135 #endif // __ECOM_SERVER_PERFORMANCE__
   136 	return TestStepResult();
   137 	}