sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Implementation of ECom Test to determine performance of ECom client calls during different stages of start-up. sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: */ sl@0: sl@0: #include "Te_EComAccumulatedClientRequestPerfTestStep.h" sl@0: #include sl@0: #include sl@0: #include "Interface.h" sl@0: #include "EComSessionAux.h" sl@0: #include "EComPerformance.h" sl@0: sl@0: CEComAccumulatedClientRequestsPerfTest::CEComAccumulatedClientRequestsPerfTest() : CEComPerfTestBase(KEComAccumulatedClientRequestsPerfTest) sl@0: { sl@0: } sl@0: sl@0: CEComAccumulatedClientRequestsPerfTest::~CEComAccumulatedClientRequestsPerfTest() sl@0: { sl@0: } sl@0: sl@0: /** sl@0: This test will retrieve the timing servicing client requests for the start-up states in this list sl@0: */ sl@0: const TStartupStateIdentifier CEComAccumulatedClientRequestsPerfTest::iMeasuredStartupStates[] = sl@0: { sl@0: EStartupStateCriticalStatic, sl@0: EStartupStateCriticalDynamic, sl@0: EStartupStateNonCritical sl@0: }; sl@0: const TInt CEComAccumulatedClientRequestsPerfTest::iNumMeasuredStartupStates = sizeof(iMeasuredStartupStates)/sizeof(iMeasuredStartupStates[0]); sl@0: sl@0: /** sl@0: Retrieves client request timer results from the ECom server sl@0: then prints out timer results organized by startup state, client request type, and then all client requests sl@0: */ sl@0: TVerdict CEComAccumulatedClientRequestsPerfTest::doTestStepL() sl@0: { sl@0: #ifdef __ECOM_SERVER_PERFORMANCE__ sl@0: // get all the timer results from the server sl@0: RClientRequestTimerResults clientTimerResults; sl@0: CleanupClosePushL(clientTimerResults); sl@0: clientTimerResults.RetrieveResultsL(); sl@0: sl@0: sl@0: INFO_PRINTF1(_L("ECom client request start-up timing broken down by request type and startup state:\n")); sl@0: // sl@0: // ECom start-up timing broken down by request type and startup state sl@0: // This loop goes through each start-up state in iMeasuredStartupStates, and for each client request type, retrieves the timing results from the clientTimerResults array sl@0: // sl@0: for (TInt startupStateIndex = 0; startupStateIndex < iNumMeasuredStartupStates; startupStateIndex++) sl@0: { sl@0: TPtrC startupStateName = StartupStateName(iMeasuredStartupStates[startupStateIndex]); sl@0: for (TInt clientRequestTypeInt = 0; clientRequestTypeInt < EEComNumClientRequestTypes; clientRequestTypeInt++) sl@0: { sl@0: TEComClientRequestType clientRequestType = (TEComClientRequestType)clientRequestTypeInt; sl@0: TPtrC clientRequestTypeName = ClientRequestTypeName(clientRequestType); sl@0: sl@0: TUint numRequestsByTypeAndStartupState = 0; sl@0: TReal timeForRequestsByTypeAndStartupState = clientTimerResults.GetAccumulatedClientRequestTime(iMeasuredStartupStates[startupStateIndex], clientRequestType, numRequestsByTypeAndStartupState); sl@0: INFO_PRINTF5(_L("Time servicing %S requests, %S State: [%f] msec, number of requests: [%d]"), sl@0: &clientRequestTypeName, &startupStateName, sl@0: timeForRequestsByTypeAndStartupState, numRequestsByTypeAndStartupState); sl@0: } sl@0: } sl@0: sl@0: sl@0: INFO_PRINTF1(_L("\nECom client request start-up timing broken down by request type:\n")); sl@0: // sl@0: // ECom start-up timing broken down by request type sl@0: // This loop goes through each client request type, retrieves the timing results from the clientTimerResults array sl@0: // sl@0: for (TInt clientRequestTypeInt = 0; clientRequestTypeInt < EEComNumClientRequestTypes; clientRequestTypeInt++) sl@0: { sl@0: TEComClientRequestType clientRequestType = (TEComClientRequestType)clientRequestTypeInt; sl@0: TPtrC clientRequestTypeName = ClientRequestTypeName(clientRequestType); sl@0: sl@0: TUint numRequestsByType = 0; sl@0: TReal timeForRequestsByType = clientTimerResults.GetAccumulatedClientRequestTime(clientRequestType, numRequestsByType); sl@0: INFO_PRINTF4(_L("Time servicing %S requests: [%f] msec, number of requests: [%d]"), sl@0: &clientRequestTypeName, timeForRequestsByType, numRequestsByType); sl@0: } sl@0: sl@0: sl@0: INFO_PRINTF1(_L("\nECom client request start-up timing broken down by start-up state:\n")); sl@0: // sl@0: // ECom start-up timing broken down by start-up state sl@0: // This loop goes through start-up state in iMeasuredStartupStates, and retrieves the timing results from the clientTimerResults array sl@0: // sl@0: for (TInt startupStateIndex = 0; startupStateIndex < iNumMeasuredStartupStates; startupStateIndex++) sl@0: { sl@0: TPtrC startupStateName = StartupStateName(iMeasuredStartupStates[startupStateIndex]); sl@0: TUint numRequestsByStartupState = 0; sl@0: TReal timeForRequestsByStartupState = clientTimerResults.GetAccumulatedClientRequestTime(iMeasuredStartupStates[startupStateIndex], numRequestsByStartupState); sl@0: INFO_PRINTF4(_L("Time servicing requests in %S State: [%f] msec, number of requests: [%d]"), sl@0: &startupStateName, timeForRequestsByStartupState, numRequestsByStartupState); sl@0: } sl@0: sl@0: sl@0: // sl@0: // Total time servicing client requests sl@0: // This loop goes retrieves the total time spent servicing client requests sl@0: // sl@0: TUint totalNumRequests = 0; sl@0: TReal totalTimeForRequests = clientTimerResults.GetAccumulatedClientRequestTime(totalNumRequests); sl@0: INFO_PRINTF3(_L("Total time servicing all requests: [%f] msec, number of requests: [%d]"), sl@0: totalTimeForRequests, totalNumRequests); sl@0: sl@0: if (totalNumRequests >= KAccumulatedClientRequestTimerResultMaxCount) sl@0: { sl@0: INFO_PRINTF2(_L("Number of client requests exceeded %d. Not all client requests may have been recorded\n"), KAccumulatedClientRequestTimerResultMaxCount); sl@0: return EFail; sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(&clientTimerResults); sl@0: sl@0: #else sl@0: MacroNotDefinedError(); sl@0: #endif // __ECOM_SERVER_PERFORMANCE__ sl@0: return TestStepResult(); sl@0: }