os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/Te_EComAccumulatedClientRequestPerfTestStep.cpp
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Implementation of ECom Test to determine performance of ECom client calls during different stages of start-up.
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"
30 CEComAccumulatedClientRequestsPerfTest::CEComAccumulatedClientRequestsPerfTest() : CEComPerfTestBase(KEComAccumulatedClientRequestsPerfTest)
34 CEComAccumulatedClientRequestsPerfTest::~CEComAccumulatedClientRequestsPerfTest()
39 This test will retrieve the timing servicing client requests for the start-up states in this list
41 const TStartupStateIdentifier CEComAccumulatedClientRequestsPerfTest::iMeasuredStartupStates[] =
43 EStartupStateCriticalStatic,
44 EStartupStateCriticalDynamic,
45 EStartupStateNonCritical
47 const TInt CEComAccumulatedClientRequestsPerfTest::iNumMeasuredStartupStates = sizeof(iMeasuredStartupStates)/sizeof(iMeasuredStartupStates[0]);
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
53 TVerdict CEComAccumulatedClientRequestsPerfTest::doTestStepL()
55 #ifdef __ECOM_SERVER_PERFORMANCE__
56 // get all the timer results from the server
57 RClientRequestTimerResults clientTimerResults;
58 CleanupClosePushL(clientTimerResults);
59 clientTimerResults.RetrieveResultsL();
62 INFO_PRINTF1(_L("ECom client request start-up timing broken down by request type and startup state:\n"));
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
67 for (TInt startupStateIndex = 0; startupStateIndex < iNumMeasuredStartupStates; startupStateIndex++)
69 TPtrC startupStateName = StartupStateName(iMeasuredStartupStates[startupStateIndex]);
70 for (TInt clientRequestTypeInt = 0; clientRequestTypeInt < EEComNumClientRequestTypes; clientRequestTypeInt++)
72 TEComClientRequestType clientRequestType = (TEComClientRequestType)clientRequestTypeInt;
73 TPtrC clientRequestTypeName = ClientRequestTypeName(clientRequestType);
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);
84 INFO_PRINTF1(_L("\nECom client request start-up timing broken down by request type:\n"));
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
89 for (TInt clientRequestTypeInt = 0; clientRequestTypeInt < EEComNumClientRequestTypes; clientRequestTypeInt++)
91 TEComClientRequestType clientRequestType = (TEComClientRequestType)clientRequestTypeInt;
92 TPtrC clientRequestTypeName = ClientRequestTypeName(clientRequestType);
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);
101 INFO_PRINTF1(_L("\nECom client request start-up timing broken down by start-up state:\n"));
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
106 for (TInt startupStateIndex = 0; startupStateIndex < iNumMeasuredStartupStates; startupStateIndex++)
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);
117 // Total time servicing client requests
118 // This loop goes retrieves the total time spent servicing client requests
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);
125 if (totalNumRequests >= KAccumulatedClientRequestTimerResultMaxCount)
127 INFO_PRINTF2(_L("Number of client requests exceeded %d. Not all client requests may have been recorded\n"), KAccumulatedClientRequestTimerResultMaxCount);
131 CleanupStack::PopAndDestroy(&clientTimerResults);
134 MacroNotDefinedError();
135 #endif // __ECOM_SERVER_PERFORMANCE__
136 return TestStepResult();